8000 Add more explicit nullable types for default null values by alexandre-daubois · Pull Request #54308 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Add more explicit nullable types for default null values #54308

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

Merged

Conversation

alexandre-daubois
Copy link
Member
@alexandre-daubois alexandre-daubois commented Mar 16, 2024
Q A
Branch? 5.4
Bug fix? no
New feature? no
Deprecations? no
Issues -
License MIT

Continuing to bring deprecation-free support for PHP 8.4 (https://php.watch/versions/8.4/implicitly-marking-parameter-type-nullable-deprecated)

If this gets merged, I'll take care of adding missing ones in upper branches if not done during upmerge 🙂

@alexandre-daubois alexandre-daubois force-pushed the explicit-nullable-type branch 2 times, most recently from 1d58cbc to 1b8ad1f Compare March 18, 2024 15:43
@nicolas-grekas
8000 Copy link
Member

Looks like there are more found by the CI?

@alexandre-daubois
Copy link
Member Author
alexandre-daubois commented Mar 19, 2024

I think the remaining ones are raised by Composer and PHPUnit, which have been fixed in recent commits: composer/composer@62126e1 and sebastianbergmann/phpunit@eb22ea1

@nicolas-grekas
Copy link
Member

Thank you @alexandre-daubois.

@@ -405,6 +406,9 @@ public function testResolveParameter()
$this->assertEquals(Foo::class, $container->getDefinition('bar')->getArgument(0));
}

/**
* @group legacy
Copy link
Member

Choose a reason for hiding this comment

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

Why was this change necessary?

Copy link
Member

Choose a reason for hiding this comment

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

This test case is specifically about the deprecated syntax, testing autowiring of arguments with default value positioned before a required one.

Copy link
Member Author

Choose a reason for hiding this comment

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

To get rid of a wanted deprecation, see #54308 (comment) for the details 🙂

Copy link
Member

Choose a reason for hiding this comment

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

Understood, but why wasn't the legacy group required before?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't know. It is deprecated since 8.1 (https://3v4l.org/n4leq), however I wouldn't be able to explain why this warning pops now 🤔

Copy link
Member
@nicolas-grekas nicolas-grekas Mar 20, 2024

Choose a reason for hiding this comment

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

This was not deprecated in 8.1 but has just been in 8.4. It was not deprecated because that's the only syntax that was once supported on older versions to make a type nullable.
https://3v4l.org/K8qWH

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the info 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0