Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Config] Do not generate unreachable configuration paths#58995
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
stof commentedNov 26, 2024
Tests need to be updated to reflect the new behavior. |
stof commentedNov 26, 2024
And new tests should probably be added covering the case being fixed for array parameters. |
bobvandevijver commentedNov 26, 2024
Yeah, I am working on the updated tests 👍🏻 |
bobvandevijver commentedNov 26, 2024
@stof Tests have been added, I added an new testcase which adds a configuration sample for the cases I hit. |
...nt/Config/Tests/Builder/Fixtures/ArrayValues/Symfony/Config/ArrayValues/TransportsConfig.phpShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
...ony/Component/Config/Tests/Builder/Fixtures/ArrayValues/Symfony/Config/ArrayValuesConfig.phpShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
...nt/Config/Tests/Builder/Fixtures/ArrayValues/Symfony/Config/ArrayValues/ErrorPagesConfig.phpShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
d361dc7 to098586cCompare098586c toc79c6a2Comparefabpot commentedJul 26, 2025
Thank you@bobvandevijver. |
97429b7 intosymfony:6.4Uh oh!
There was an error while loading.Please reload this page.
PHPStan was having issues correctly inferring the returned type of a configuration function.
Consider the following messages as example:
This came from the following generated config class:
When the determined parameter type is
array, only that type can be passed meaning that theis_arrayis unnecessary. The same holds for the generated docblock: as only an array can be passed, there is no need to define a template and psalm returns.With the changes in this PR this method is generated more cleanly:
A similar issue happens with functions that do accept more than an array value:
This is caused by the following generated method:
While the method seems fine, the
@templatedefinition is not correctly defined, seehttps://phpstan.org/r/09317897-4cc8-4f67-98ca-8b6da3671b31.With the changes in this PR the template is now strictly defined so it matches the function signature:
Seehttps://phpstan.org/r/986db325-9869-4a6f-8587-6af06c0612d4 for the results.
While the second change might actually be enough to fix the errors, I prefer both fixes as it no longers generates code that can not be executed anyways.