Lines
100.00%
1 / 1
Functions and Methods
100.00%
1 / 1
Classes and Traits
100.00%
1 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| TestCodeScope | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | 100.00% | 1 / 1 | |||
| isInTestCode | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | declare(strict_types=1); | |
| 4 | ||
| 5 | namespace Stewart\PHPStan\Rule; | |
| 6 | ||
| 7 | use PHPStan\Analyser\Scope; | |
| 8 | ||
| 9 | // Tests seed made-up entities into the harness, so code inside a test case is not checked. | |
| 10 | final readonly class TestCodeScope | |
| 11 | { | |
| 12 | private const string TEST_CASE = 'PHPUnit\\Framework\\TestCase'; | |
| 13 | ||
| 14 | public function isInTestCode(Scope $scope): bool | |
| 15 | { | |
| 16 | return $scope->getClassReflection()?->is(self::TEST_CASE) === true; | |
| 17 | } | |
| 18 | } |