-
Notifications
You must be signed in to change notification settings - Fork 519
Allow 8.5 as PHP version #4188
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
Allow 8.5 as PHP version #4188
Conversation
e24be89
to
31098f5
Compare
Thank you. You also need to update the workflows to include 8.5 (everywhere the matrix includes 7.4...8.4). |
No you need to figure out why the build is failing 😊 |
I assume the typo in the first word 😊. I have found out that |
…in post install script
this reasoning is a bit suspicious to me. Why would code on PHP 8+ take values from a polyfill? Can you point to a specific line that causes this issue? |
I haven't found why (yet?). You can verify it by changing |
I've thought about it more and the polyfill isn't the reason for this problem. We don't need the change in Symfony code. The same problem would arise when analysing a project that supplies its own different polyfill with Composer. The correct solution is to provide our own Attribute class stub and put it as own of the first locators in BetterReflectionSourceLocator factory. Please know I debuggged this in my head while on vacation. I can verify these claims later. |
I agree we don't need it, but somehow removing it (see changes in
Wouldn't it be better if we ignore the polyfill class and rely on the built-in one? |
I said what needs to happen. The fact that PHPStan prioritizes Composer-provided vendor/ classes instead of PHP-built-in ones doesn't have an easy solution. Because sometimes, there's an obscure PHP extension represented in phpstorm-stubs and people have a class with the same name in their project which they actually use (like Event or HttpRequest). That's why I'm proposing a one-off solution for Attribute. I bet you can reproduce the same issue on PHP 8.4 if you create a project with its own Attribute class and different values for its constants. |
Can you give me a hint on how to do that? Was there any similar change made in the past? I've tried to add a new stub in Also, I have found this: https://github.com/phpstan/phpstan-src/blob/2.1.21/stubs/runtime/Attribute.php, but adding/changing values there are ignored. |
Something like OptimizedSingleFileSourceLocator has to be put in the locators array somewhere early in BetterReflectionSourceLocatorFactory. |
I can't push to your fork so I'm trying my luck here #4192 |
And we're green! Thank you. |
Since the update of
nikic/PHP-Parser
, PHPStan recognises PHP 8.5 constants (such asT_PIPE
orT_VOID_CAST
), so let's allow setting up 8.5 as the PHP version.