diff --git a/src/Rule/EnforceReadonlyPublicPropertyRule.php b/src/Rule/EnforceReadonlyPublicPropertyRule.php index e7f0776..b6b77dc 100644 --- a/src/Rule/EnforceReadonlyPublicPropertyRule.php +++ b/src/Rule/EnforceReadonlyPublicPropertyRule.php @@ -41,7 +41,7 @@ public function processNode( return []; } - if (!$node->isPublic() || $node->isReadOnly() || $node->hasHooks() || $node->isPrivateSet() || $node->isProtectedSet()) { + if (!$node->isPublic() || $node->isReadOnly() || $node->hasHooks() || $node->isPrivateSet() || $node->isProtectedSet() || $node->isStatic()) { return []; } diff --git a/tests/Rule/data/EnforceReadonlyPublicPropertyRule/code-81.php b/tests/Rule/data/EnforceReadonlyPublicPropertyRule/code-81.php index 90a466f..23cde24 100644 --- a/tests/Rule/data/EnforceReadonlyPublicPropertyRule/code-81.php +++ b/tests/Rule/data/EnforceReadonlyPublicPropertyRule/code-81.php @@ -12,6 +12,8 @@ trait MyTrait { private string $private; + public static string $static; + } class MyClass { @@ -26,6 +28,8 @@ class MyClass { private int $bag; + public static string $static; + } readonly class MyReadonlyClass { diff --git a/tests/Rule/data/EnforceReadonlyPublicPropertyRule/code-84.php b/tests/Rule/data/EnforceReadonlyPublicPropertyRule/code-84.php index 2da599c..43d4e27 100644 --- a/tests/Rule/data/EnforceReadonlyPublicPropertyRule/code-84.php +++ b/tests/Rule/data/EnforceReadonlyPublicPropertyRule/code-84.php @@ -14,6 +14,8 @@ trait MyTrait { private string $private; + public static string $static; + } class MyClass { @@ -30,6 +32,8 @@ class MyClass { private int $bag; + public static string $static; + } readonly class MyReadonlyClass {