-
Notifications
You must be signed in to change notification settings - Fork 130
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
Fix and update PHPStan to 1.3.x
#945
Conversation
test/phpstan-php-version.php
Outdated
|
||
return [ | ||
'parameters' => [ | ||
'phpVersion' => PHP_VERSION_ID, |
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.
We could also drop config.platform.php
from composer.json
: the reason it was added was to prevent invalid @dependabot upgrades, but we can get rid of it, if it has such an influence on other tools too...
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.
Yeah, "php": "~8.0.12 || ~8.1.0"
might be sufficient to keep valid dependencies.
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.
Interesting, the changed dropped composer/package-versions-deprecated
and installed ocramius/package-versions
, not sure why is that :) 8812e7b
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.
Massive improvement, I'd say 🤣
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.
13dcc98
to
8812e7b
Compare
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.
Thanks @ondrejmirtes!
This PR solves the failures from #939.
The problem here is quite tricky - PHPStan complains about some PHP classes that don't exist when running on PHP 8.1, because on PHP 8.0.x these really don't exist. PHPStan uses
config.platform.php
to determine the PHP version to test against.At the same time it's funny that PHPStan doesn't complain about the same problems when running on PHP 8.0. That's because PHPStan itself loads these classes as stubs so that BetterReflection Adapter layer can work. And since PHPStan sees these classes as defined by the user, it considers them as existing.
I can't make PHPStan fail with the same errors when running on PHP 8.0, because I can't sensibly differentiate between these PHPStan-related stubs, and actual user-defined polyfills...
Here I fixed it with the same approach I use in phpstan-src - it tells PHPStan to ignore the setting from config.platform.php.