Skip to content

Commit aa653e9

Browse files
Fix tests
1 parent eb35211 commit aa653e9

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

src/Type/ObjectShapeType.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,12 @@ public function accepts(Type $type, bool $strictTypes): AcceptsResult
187187
$hasProperty = AcceptsResult::createYes();
188188
}
189189

190+
if (!$hasProperty->yes() && $type->hasStaticProperty($propertyName)->yes()) {
191+
return new AcceptsResult(TrinaryLogic::createNo(), [
192+
sprintf('Property %s::$%s is static.', $type->getStaticProperty($propertyName, $scope)->getDeclaringClass()->getDisplayName(), $propertyName),
193+
]);
194+
}
195+
190196
$result = $result->and($hasProperty);
191197
$otherProperty = $type->getInstanceProperty($propertyName, $scope);
192198
if (!$otherProperty->isPublic()) {

tests/PHPStan/Analyser/LegacyNodeScopeResolverTest.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8739,10 +8739,6 @@ public static function dataUnionProperties(): array
87398739
'UnionProperties\Bar|UnionProperties\Foo',
87408740
'$something->doSomething',
87418741
],
8742-
[
8743-
'UnionProperties\Bar|UnionProperties\Foo',
8744-
'$something::$doSomething',
8745-
],
87468742
];
87478743
}
87488744

tests/PHPStan/Analyser/nsrt/bug-nullsafe-prop-static-access.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,4 @@ function foo(?A $a): void
2626
\PHPStan\Testing\assertType('string|null', $a?->b->get());
2727

2828
\PHPStan\Testing\assertType('int|null', $a?->b::$value);
29-
\PHPStan\Testing\assertType('int|null', $a?->b->value);
3029
}

0 commit comments

Comments
 (0)