Skip to content

Commit fabcf34

Browse files
Fix tests
1 parent 637626e commit fabcf34

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

Diff for: src/Type/ObjectShapeType.php

+7
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,19 @@ public function accepts(Type $type, bool $strictTypes): AcceptsResult
174174
if (in_array($propertyName, $this->optionalProperties, true)) {
175175
continue;
176176
}
177+
177178
return $hasProperty;
178179
}
179180
if ($hasProperty->maybe() && in_array($propertyName, $this->optionalProperties, true)) {
180181
$hasProperty = AcceptsResult::createYes();
181182
}
182183

184+
if (!$hasProperty->yes() && $type->hasStaticProperty($propertyName)->yes()) {
185+
return new AcceptsResult(TrinaryLogic::createNo(), [
186+
sprintf('Property %s::$%s is static.', $type->getStaticProperty($propertyName, $scope)->getDeclaringClass()->getDisplayName(), $propertyName),
187+
]);
188+
}
189+
183190
$result = $result->and($hasProperty);
184191

185192
try {

Diff for: 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

Diff for: 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)