Skip to content

Commit 4223869

Browse files
Fix tests
1 parent 637626e commit 4223869

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

src/Type/ObjectShapeType.php

+7
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,13 @@ public function accepts(Type $type, bool $strictTypes): AcceptsResult
174174
if (in_array($propertyName, $this->optionalProperties, true)) {
175175
continue;
176176
}
177+
178+
if ($type->hasStaticProperty($propertyName)->yes()) {
179+
return new AcceptsResult(TrinaryLogic::createNo(), [
180+
sprintf('Property %s::$%s is static.', $type->getStaticProperty($propertyName, $scope)->getDeclaringClass()->getDisplayName(), $propertyName),
181+
]);
182+
}
183+
177184
return $hasProperty;
178185
}
179186
if ($hasProperty->maybe() && in_array($propertyName, $this->optionalProperties, true)) {

tests/PHPStan/Analyser/LegacyNodeScopeResolverTest.php

-4
Original file line numberDiff line numberDiff line change
@@ -9118,10 +9118,6 @@ public function dataUnionProperties(): array
91189118
'UnionProperties\Bar|UnionProperties\Foo',
91199119
'$something->doSomething',
91209120
],
9121-
[
9122-
'UnionProperties\Bar|UnionProperties\Foo',
9123-
'$something::$doSomething',
9124-
],
91259121
];
91269122
}
91279123

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

-1
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)