Skip to content

Commit a083f41

Browse files
committed
Report non static access of static properties
1 parent e99b27c commit a083f41

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Rules/Properties/AccessPropertiesCheck.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,16 @@ private function processSingleProperty(Scope $scope, PropertyFetch $node, string
160160
}
161161

162162
$propertyReflection = $type->getProperty($name, $scope);
163+
if ($propertyReflection->isStatic()) {
164+
return [
165+
RuleErrorBuilder::message(sprintf(
166+
'Non static access to static property %s::$%s.',
167+
$propertyReflection->getDeclaringClass()->getDisplayName(),
168+
$name,
169+
))->identifier('property.nonStaticAccess')->build(),
170+
];
171+
}
172+
163173
if ($write) {
164174
if ($scope->canWriteProperty($propertyReflection)) {
165175
return [];

0 commit comments

Comments
 (0)