Skip to content

Commit fadb439

Browse files
committed
PropertyDescriptor - correctly resolve from reflection whether a property is static or not
1 parent 1893100 commit fadb439

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Rules/Properties/PropertyDescriptor.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function describeProperty(PropertyReflection $property, $propertyFetch):
1616
{
1717
/** @var \PhpParser\Node\Identifier $name */
1818
$name = $propertyFetch->name;
19-
if ($propertyFetch instanceof \PhpParser\Node\Expr\PropertyFetch) {
19+
if (!$property->isStatic()) {
2020
return sprintf('Property %s::$%s', $property->getDeclaringClass()->getDisplayName(), $name->name);
2121
}
2222

tests/PHPStan/Rules/Properties/TypesAssignedToPropertiesRuleTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function testTypesAssignedToProperties(): void
3939
37,
4040
],
4141
[
42-
'Static property PropertiesAssignedTypes\Ipsum::$parentStringProperty (string) does not accept int.',
42+
'Property PropertiesAssignedTypes\Ipsum::$parentStringProperty (string) does not accept int.',
4343
39,
4444
],
4545
[

0 commit comments

Comments
 (0)