Skip to content

fix: symfony deprecations #7277

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

VincentLanglet
Copy link
Contributor

Q A
Branch? main for features / current stable version branch for bug fixes
Tickets Closes #..., closes #...
License MIT
Doc PR api-platform/docs#...

@VincentLanglet VincentLanglet changed the title fix: deprecations fix: symfony deprecations Jul 3, 2025
@@ -23,7 +23,7 @@
],
"require": {
"php": ">=8.2",
"api-platform/metadata": "^4.1.11",
"api-platform/metadata": "^4.1.16",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The AccessDeniedException was introduced in 4.1.16.
b2b5f99

@@ -541,7 +545,6 @@ public function withNativeType(?Type $nativeType): self
{
$self = clone $this;
$self->nativeType = $nativeType;
$self->builtinTypes = PropertyInfoToTypeInfoHelper::convertTypeToLegacyTypes($nativeType) ?? [];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using withNativeType was triggering the symfony deprecation.

Instead we should hydrate the buildinTypes only if necessary, which means, only if getBuildinTypes is called.

This solve the deprecations.

@@ -46,7 +46,11 @@ public function testSupports(Constraint $constraint, ApiProperty $propertyMetada
public static function supportsProvider(): \Generator
{
yield 'email' => [new Email(), new ApiProperty(), true];
yield 'url' => [new Url(), new ApiProperty(), true];
if (property_exists(Url::class, 'requireTld')) {
yield 'url' => [new Url(requireTld: true), new ApiProperty(), true];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not passing requireTld imply a deprecation for sf > 7.1 ; but the property only exists since 7.1

@VincentLanglet VincentLanglet marked this pull request as ready for review July 3, 2025 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant