Sanity check #[RequiresPhp] value and range#269
Conversation
| $this->deprecationRulesInstalled = $deprecationRulesInstalled; | ||
|
|
||
| $parser = new VersionParser(); | ||
| $this->phpstanVersionConstraint = $parser->parseConstraints($phpVersion->getVersionString()); |
There was a problem hiding this comment.
maybe this should compare against the composer.json min version instead of the phpstan.neon version?
|
I'd rather use https://github.com/phar-io/version which is also used by PHPUnit I think https://github.com/sebastianbergmann/phpunit/blob/2d6dc600b52cd74141c422a5d0601ca26c185bb9/src/Metadata/Version/Requirement.php Yeah, comparing against |
thats only one part of the story. see also https://github.com/sebastianbergmann/phpunit/blob/2d6dc600b52cd74141c422a5d0601ca26c185bb9/src/Metadata/Version/Requirement.php#L41-L48 which adds a fallback path on top which is implemented in phpunit itself. reworked it to match that |
|
The related PR was merged so you can resume your work on this. Thank you. |
I got an idea for this one. I will push it tomorrow into this PR |
|
@VincentLanglet finally, this is really ready for review :-) |
|
|
||
| $this->analyse([__DIR__ . '/data/requires-php-version-mismatch.php'], [ | ||
| [ | ||
| 'Version requirement will always evaluate to false.', |
There was a problem hiding this comment.
#[RequiresPhp('<= 8.5')] will always evaluate to false ?
There was a problem hiding this comment.
because the test assumes PHP_VERSION_ID 80500 and the constraint only has 2 digits.
it would not error for '<= 8.5.0'.
this is what #303 is about
#[RequiresPhp]is lower then the phpstan analysis version, reports a test requirement as beeing always false#[RequiresPhp]contains a version which is not parse-able, reports a error