| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| parameters: | ||
| phpVersion: | ||
| min: 80200 | ||
| max: 80400 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| <?php declare(strict_types = 1); | ||
|
|
||
| namespace PHPStan\Rules\PHPUnit; | ||
|
|
||
| use PHPStan\Php\PhpVersion; | ||
| use PHPStan\Rules\Rule; | ||
| use PHPStan\Testing\RuleTestCase; | ||
| use PHPStan\Type\FileTypeMapper; | ||
|
|
||
| /** | ||
| * @extends RuleTestCase<AttributeRequiresPhpVersionRule> | ||
| */ | ||
| final class AttributeRequiresPhpVersionRangeRuleTest extends RuleTestCase | ||
| { | ||
|
|
||
| private int $phpVersion = 80500; | ||
|
|
||
| public function testPhpVersionMismatch(): void | ||
| { | ||
| $this->analyse([__DIR__ . '/data/requires-php-version-mismatch.php'], [ | ||
| [ | ||
| 'Version requirement will always evaluate to false.', | ||
| 20, | ||
| ], | ||
| [ | ||
| 'Version requirement will always evaluate to false.', | ||
| 28, | ||
| ], | ||
| [ | ||
| 'Version requirement will always evaluate to false.', | ||
| 36, | ||
| ], | ||
| [ | ||
| 'Version requirement will always evaluate to false.', | ||
| 44, | ||
| ], | ||
| [ | ||
| 'Version requirement will always evaluate to false.', | ||
| 76, | ||
| ], | ||
| ]); | ||
| } | ||
|
|
||
| protected function getRule(): Rule | ||
| { | ||
| $phpunitVersion = new PHPUnitVersion(null, null); | ||
|
|
||
| return new AttributeRequiresPhpVersionRule( | ||
| $phpunitVersion, | ||
| new TestMethodsHelper( | ||
| self::getContainer()->getByType(FileTypeMapper::class), | ||
| $phpunitVersion, | ||
| ), | ||
| false, | ||
| new PhpVersion($this->phpVersion), | ||
| ); | ||
| } | ||
|
|
||
| public static function getAdditionalConfigFiles(): array | ||
| { | ||
| return [ | ||
| __DIR__ . '/AttributeRequiresPhpVersionRangeRule.neon', | ||
| ]; | ||
| } | ||
|
|
||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| parameters: | ||
| phpVersion: 80500 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| <?php | ||
|
|
||
| namespace RequiresPhpVersionMismatch; | ||
|
|
||
| use PHPUnit\Framework\Attributes\DataProvider; | ||
| use PHPUnit\Framework\Attributes\Test; | ||
| use PHPUnit\Framework\TestCase; | ||
| use PHPUnit\Framework\Attributes\RequiresPhp; | ||
|
|
||
| class InvalidConstraint extends TestCase | ||
| { | ||
| #[RequiresPhp('abc')] | ||
| public function testFoo(): void { | ||
|
|
||
| } | ||
| } | ||
|
|
| Back | FazBrowse Home | New Git URL |
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.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality#[RequiresPhp('<= 8.5')] will always evaluate to false ?
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Qualitybecause 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
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityThat's tricky.
Should we have a test with 8.6 to ensure this one is not reported ?
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Qualitydone
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.