-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
PHP 8 support issue in handling of current() factories in DI #39737
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
Comments
I'd call it "passive support" for union types: If you can make Symfony 4.4 explode by using a union type in your application, this is a bug we need to fix. 😃 |
|
Forget what I just wrote. It's late and I should go to bed. 😉 The pass raises the exception internally and drops it if one of the types of the union matches. So #39746 should actually fix your problem. |
…r function parameters (derrabus) This PR was merged into the 4.4 branch. Discussion ---------- [DependencyInjection] Fix InvalidParameterTypeException for function parameters | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #39737 | License | MIT | Doc PR | N/A Commits ------- 1854543 [DependencyInjection] Fix InvalidParameterTypeException for function parameters
Thanks for the quick fix @derrabus, I can confirm it works for me :) |
Symfony version(s) affected: 4.4.18
Description
symfony/src/Symfony/Component/DependencyInjection/Exception/InvalidParameterTypeException.php
Line 28 in 9b719ab
$parameter->getDeclaringClass()->getName()
fails becausegetDeclaringClass
returns null.This only happens on PHP 8 because
symfony/src/Symfony/Component/HttpKernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php
Line 155 in fe91b86
current
in PHP 8 will result in a parameter type hint beingarray|object
, while PHP 7 did not have a type hint: https://3v4l.org/YKHtO and apparently Symfony also does not support union types as per @nicolas-grekas.How to reproduce
I could not reduce it to a minimal repro case sorry
The text was updated successfully, but these errors were encountered: