CI: Introduce PHP compatibility check #7844
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Inspired by this finding, bug introduced in #7616, reproduced here - we have invalid return type in code and none of the tools caught this. I thought this is because we run PHPStan on 8.3 which then assumes it's valid return type, but I modified
dev-tools/composer.json
, allowed PHP 7.4 and checked on it, but PHPStan still did not report it, even onmax
level. I believe this is a bug (CC: @ondrejmirtes), but anyway I thought maybe it's a good idea to introduce PHPCompatibility check, which is more focused on differences between PHP versions.This is a draft and CI will fail, because we need to decide how we want to handle dynamic usages of PHP consts etc. I believe that sniffs should not report these problems if constant is used in
if
condition, like:but this is separate problem that should be addressed and fixed in long-term (CC: @jrfnl).
PS. There is
10.x-dev as 9.99.0
constraint because10.x
development version has more checks, but at the same time is not compatible withphpcompatibility/phpcompatibility-symfony
which handles Symfony polyfills. We've been using this setup for months in GetResponse and it helped us with migration from 7.4 to 8.2, so I assume it as safe enough 馃檪.