Skip to content

Commit 6c1a295

Browse files
committed
Fix build
1 parent e5c589b commit 6c1a295

File tree

4 files changed

+33
-19
lines changed

4 files changed

+33
-19
lines changed

tests/PHPStan/Analyser/LegacyNodeScopeResolverTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1841,7 +1841,7 @@ public static function dataProperties(): array
18411841
'$this->overriddenReadOnlyProperty',
18421842
],
18431843
[
1844-
'DOMElement|null',
1844+
PHP_VERSION_ID < 80100 ? 'string' : 'DOMElement|null',
18451845
'$this->documentElement',
18461846
],
18471847
];

tests/PHPStan/Rules/Properties/AccessPropertiesInAssignRuleTest.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,16 @@ public function testObjectShapes(): void
130130

131131
public function testConflictingAnnotationProperty(): void
132132
{
133-
$this->analyse([__DIR__ . '/data/conflicting-annotation-property.php'], [
134-
[
135-
'Access to private property ConflictingAnnotationProperty\PropertyWithAnnotation::$test.',
136-
27,
137-
],
138-
]);
133+
$errors = [];
134+
if (PHP_VERSION_ID >= 80200) {
135+
$errors = [
136+
[
137+
'Access to private property ConflictingAnnotationProperty\PropertyWithAnnotation::$test.',
138+
27,
139+
],
140+
];
141+
}
142+
$this->analyse([__DIR__ . '/data/conflicting-annotation-property.php'], $errors);
139143
}
140144

141145
public function testBug10477(): void

tests/PHPStan/Rules/Properties/AccessPropertiesRuleTest.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -947,12 +947,17 @@ public function testConflictingAnnotationProperty(): void
947947
$this->checkThisOnly = false;
948948
$this->checkUnionTypes = true;
949949
$this->checkDynamicProperties = true;
950-
$this->analyse([__DIR__ . '/data/conflicting-annotation-property.php'], [
951-
[
952-
'Access to private property ConflictingAnnotationProperty\PropertyWithAnnotation::$test.',
953-
26,
954-
],
955-
]);
950+
951+
$errors = [];
952+
if (PHP_VERSION_ID >= 80200) {
953+
$errors = [
954+
[
955+
'Access to private property ConflictingAnnotationProperty\PropertyWithAnnotation::$test.',
956+
26,
957+
],
958+
];
959+
}
960+
$this->analyse([__DIR__ . '/data/conflicting-annotation-property.php'], $errors);
956961
}
957962

958963
#[RequiresPhp('>= 8.1')]

tests/PHPStan/Rules/Properties/WritingToReadOnlyPropertiesRuleTest.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use PHPStan\Rules\RuleLevelHelper;
77
use PHPStan\Testing\RuleTestCase;
88
use PHPUnit\Framework\Attributes\RequiresPhp;
9+
use const PHP_VERSION_ID;
910

1011
/**
1112
* @extends RuleTestCase<WritingToReadOnlyPropertiesRule>
@@ -80,12 +81,16 @@ public function testObjectShapes(): void
8081
public function testConflictingAnnotationProperty(): void
8182
{
8283
$this->checkThisOnly = false;
83-
$this->analyse([__DIR__ . '/data/conflicting-annotation-property.php'], [
84-
/*[
85-
'Property ConflictingAnnotationProperty\PropertyWithAnnotation::$test is not writable.',
86-
27,
87-
],*/
88-
]);
84+
$errors = [];
85+
if (PHP_VERSION_ID < 80200) {
86+
$errors = [
87+
[
88+
'Property ConflictingAnnotationProperty\PropertyWithAnnotation::$test is not writable.',
89+
27,
90+
],
91+
];
92+
}
93+
$this->analyse([__DIR__ . '/data/conflicting-annotation-property.php'], $errors);
8994
}
9095

9196
#[RequiresPhp('>= 8.4')]

0 commit comments

Comments
 (0)