Skip to content

Commit

Permalink
fix: interfaces, traits, enums can not be readonly
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianstucke87 committed Mar 30, 2024
1 parent fbbcbe5 commit a4b5f8c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Expression/ForClasses/IsReadonly.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function describe(ClassDescription $theClass, string $because): Descripti

public function evaluate(ClassDescription $theClass, Violations $violations, string $because): void
{
if ($theClass->isReadonly()) {
if ($theClass->isReadonly() || $theClass->isInterface() || $theClass->isTrait() || $theClass->isEnum()) {
return;
}

Expand Down
6 changes: 3 additions & 3 deletions tests/Unit/Expressions/ForClasses/IsReadonlyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function test_interfaces_can_not_be_readonly_and_should_be_ignored(): voi
[],
null,
false,
true,
false,
false,
true,
false,
Expand All @@ -90,7 +90,7 @@ public function test_traits_can_not_be_readonly_and_should_be_ignored(): void
[],
null,
false,
true,
false,
false,
false,
true,
Expand All @@ -111,7 +111,7 @@ public function test_enums_can_not_be_readonly_and_should_be_ignored(): void
[],
null,
false,
true,
false,
false,
false,
false,
Expand Down

0 comments on commit a4b5f8c

Please sign in to comment.