-
-
Notifications
You must be signed in to change notification settings - Fork 864
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
An int constant used in parametersSchema
isn't expanded to int during validation
#10223
Comments
This bug report is missing a link to reproduction at phpstan.org/try. It will most likely be closed after manual review. |
I just tried this and it works:
This is a bit of a pain. I persuaded David to do nette/di#291 and it broke nette/di for many people for many versions - see the number of releases since then 😂 PHPStan validates parameters here https://github.com/phpstan/phpstan-src/blob/a49f7d43140a952695009561c99d999769281d63/src/DependencyInjection/ContainerFactory.php#L339 after container creation. It used to be in its own So hopefully this isn't gonna break any time soon :) |
Thanks, I just remembered I've seen the
instead of just Should this be handled on my side, or is that something PHPStan should do? I don't know, just asking :-) |
Scratch that, this is my test not handling the |
Why are you doing this in so complicated way? :) You should put the test .neon file into That way you don't need to reimplement what PHPStan already does :)
|
Ah, nice, thanks. It was introduced after I wrote my first test and I missed it when it was introduced (or forgot) :-) Also thanks for the |
…arametersSchema The getRule method could be then simplified, too. See phpstan/phpstan#10223
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Bug report
Hi,
I have an extension that uses the following config:
ENT_QUOTES
's value is int3
.My
parametersSchema
contains this (simplified):Meaning
allowParamFlagsAnywhere
can be an array of ints (or array of structures, irrelevant at this point).But PHPStan complains that it sees a string
'::ENT_QUOTES'
, not an int:I can easily change my config and add a comment, but I was wondering whether it's something that can be changed in PHPStan, or whether it would be too something (e.g. complicated, dangerous, ...). As far as I remember, the constant expansion is a feature of nette/di, and the constant is expanded/replaced to its value during the analysis, but not in the validation phase.
Code snippet that reproduces the problem
No response
Expected output
Configuration is validated fine.
Did PHPStan help you today? Did it make you happy in any way?
Yes, you deserve a cold one 🍺
The text was updated successfully, but these errors were encountered: