Skip to content

Commit dc8d8d0

Browse files
committed
Fix build
1 parent 7a21423 commit dc8d8d0

7 files changed

+30
-16
lines changed

tests/PHPStan/Rules/Classes/DuplicateDeclarationRuleTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use PHPStan\Rules\Rule;
66
use PHPStan\Testing\RuleTestCase;
7+
use const PHP_VERSION_ID;
78

89
/**
910
* @extends RuleTestCase<DuplicateDeclarationRule>
@@ -67,6 +68,10 @@ public function testDuplicatePromotedProperty(): void
6768

6869
public function testDuplicateEnumCase(): void
6970
{
71+
if (PHP_VERSION_ID < 80100) {
72+
$this->markTestSkipped('Test requires PHP 8.1.');
73+
}
74+
7075
$this->analyse([__DIR__ . '/data/duplicate-enum-cases.php'], [
7176
[
7277
'Cannot redeclare enum case DuplicatedEnumCase\Foo::BAR.',

tests/PHPStan/Rules/EnumCases/EnumCaseAttributesRuleTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use PHPStan\Rules\Rule;
1414
use PHPStan\Rules\RuleLevelHelper;
1515
use PHPStan\Testing\RuleTestCase;
16+
use const PHP_VERSION_ID;
1617

1718
/**
1819
* @extends RuleTestCase<EnumCaseAttributesRule>
@@ -47,6 +48,10 @@ protected function getRule(): Rule
4748

4849
public function testRule(): void
4950
{
51+
if (PHP_VERSION_ID < 80100) {
52+
$this->markTestSkipped('Test requires PHP 8.1.');
53+
}
54+
5055
$this->analyse([__DIR__ . '/data/enum-case-attributes.php'], [
5156
[
5257
'Attribute class EnumCaseAttributes\AttributeWithPropertyTarget does not have the class constant target.',

tests/PHPStan/Rules/Functions/ReturnTypeRuleTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,10 @@ public function testBug7766(): void
227227

228228
public function testBug8846(): void
229229
{
230+
if (PHP_VERSION_ID < 80100) {
231+
$this->markTestSkipped('Test requires PHP 8.1.');
232+
}
233+
230234
$this->checkExplicitMixed = true;
231235
$this->checkNullables = true;
232236
$this->analyse([__DIR__ . '/data/bug-8846.php'], []);

tests/PHPStan/Rules/PhpDoc/RequireExtendsDefinitionClassRuleTest.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,8 @@ protected function getRule(): Rule
3232

3333
public function testRule(): void
3434
{
35-
$enumError = 'PHPDoc tag @phpstan-require-extends cannot contain non-class type IncompatibleRequireExtends\SomeEnum.';
36-
$enumTip = null;
3735
if (PHP_VERSION_ID < 80100) {
38-
$enumError = 'PHPDoc tag @phpstan-require-extends contains unknown class IncompatibleRequireExtends\SomeEnum.';
39-
$enumTip = 'Learn more at https://phpstan.org/user-guide/discovering-symbols';
36+
$this->markTestSkipped('Test requires PHP 8.1.');
4037
}
4138

4239
$this->analyse([__DIR__ . '/data/incompatible-require-extends.php'], [
@@ -49,9 +46,8 @@ public function testRule(): void
4946
13,
5047
],
5148
[
52-
$enumError,
49+
'PHPDoc tag @phpstan-require-extends cannot contain non-class type IncompatibleRequireExtends\SomeEnum.',
5350
18,
54-
$enumTip,
5551
],
5652
[
5753
'PHPDoc tag @phpstan-require-extends contains unknown class IncompatibleRequireExtends\TypeDoesNotExist.',

tests/PHPStan/Rules/PhpDoc/RequireExtendsDefinitionTraitRuleTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use PHPStan\Rules\ClassNameCheck;
88
use PHPStan\Rules\Rule;
99
use PHPStan\Testing\RuleTestCase;
10+
use const PHP_VERSION_ID;
1011

1112
/**
1213
* @extends RuleTestCase<RequireExtendsDefinitionTraitRule>
@@ -32,6 +33,10 @@ protected function getRule(): Rule
3233

3334
public function testRule(): void
3435
{
36+
if (PHP_VERSION_ID < 80100) {
37+
$this->markTestSkipped('Test requires PHP 8.1.');
38+
}
39+
3540
$this->analyse([__DIR__ . '/data/incompatible-require-extends.php'], [
3641
[
3742
'PHPDoc tag @phpstan-require-extends cannot contain final class IncompatibleRequireExtends\SomeFinalClass.',

tests/PHPStan/Rules/PhpDoc/RequireImplementsDefinitionClassRuleTest.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use PHPStan\Rules\Rule;
66
use PHPStan\Testing\RuleTestCase;
7+
use const PHP_VERSION_ID;
78

89
/**
910
* @extends RuleTestCase<RequireImplementsDefinitionClassRule>
@@ -18,7 +19,11 @@ protected function getRule(): Rule
1819

1920
public function testRule(): void
2021
{
21-
$expectedErrors = [
22+
if (PHP_VERSION_ID < 80100) {
23+
$this->markTestSkipped('Test requires PHP 8.1.');
24+
}
25+
26+
$this->analyse([__DIR__ . '/data/incompatible-require-implements.php'], [
2227
[
2328
'PHPDoc tag @phpstan-require-implements is only valid on trait.',
2429
40,
@@ -27,9 +32,7 @@ public function testRule(): void
2732
'PHPDoc tag @phpstan-require-implements is only valid on trait.',
2833
45,
2934
],
30-
];
31-
32-
$this->analyse([__DIR__ . '/data/incompatible-require-implements.php'], $expectedErrors);
35+
]);
3336
}
3437

3538
}

tests/PHPStan/Rules/PhpDoc/RequireImplementsDefinitionTraitRuleTest.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,8 @@ protected function getRule(): Rule
3131

3232
public function testRule(): void
3333
{
34-
$enumError = 'PHPDoc tag @phpstan-require-implements cannot contain non-interface type IncompatibleRequireImplements\SomeEnum.';
35-
$enumTip = null;
3634
if (PHP_VERSION_ID < 80100) {
37-
$enumError = 'PHPDoc tag @phpstan-require-implements contains unknown class IncompatibleRequireImplements\SomeEnum.';
38-
$enumTip = 'Learn more at https://phpstan.org/user-guide/discovering-symbols';
35+
$this->markTestSkipped('Test requires PHP 8.1.');
3936
}
4037

4138
$expectedErrors = [
@@ -44,9 +41,8 @@ public function testRule(): void
4441
8,
4542
],
4643
[
47-
$enumError,
44+
'PHPDoc tag @phpstan-require-implements cannot contain non-interface type IncompatibleRequireImplements\SomeEnum.',
4845
13,
49-
$enumTip,
5046
],
5147
[
5248
'PHPDoc tag @phpstan-require-implements contains unknown class IncompatibleRequireImplements\TypeDoesNotExist.',

0 commit comments

Comments
 (0)