-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Config] ConfigBuilderGenerator: define template types #54008
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
base: 7.3
Are you sure you want to change the base?
Conversation
2e524b4
to
eca96b0
Compare
src/Symfony/Component/Config/Builder/ConfigBuilderGenerator.php
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like we're missing a case where we have a union type as "of"
This helps phpstan to properly identify the return types, in our case for the `$framework->messenger()->transport('async')->dsn(env('MESSENGER_TRANSPORT_DSN'));` Where '->dns()` failed with the following Phpstan error: `Call to an undefined method Symfony\Config\Framework\Messenger\TransportConfig|Symfony\Config\Framework\MessengerConfig::dsn()`
true, all the test cases were only handling |
Another issue we identified is the messenger routing configuration, which confuses PhpStan. But could not find a way to solve it, notes:
|
@thePanz for some reason PHPStan have two problems here that should be solved on PHPStan side (I think), conditional return on template does not work properly, and native return with I have also reported bug for the dead code / bad native typing to Edit: this would also work for PHPStan even with conditional return based on generics https://phpstan.org/r/9ecae399-0ee4-4deb-9dc5-a1f3db4017b0 |
This helps phpstan to properly identify the return types, in our case for the
$framework->messenger()->transport('async')->dsn(env('MESSENGER_TRANSPORT_DSN'));
Where
->dns()
failed with the following Phpstan error:Call to an undefined method Symfony\Config\Framework\Messenger\TransportConfig|Symfony\Config\Framework\MessengerConfig::dsn()