Skip to content

Commit ac28977

Browse files
authored
ForbidCustomFunctionsRule: test denied anonymous class parent (#289)
1 parent 73aec08 commit ac28977

File tree

1 file changed

+3
-0
lines changed
  • tests/Rule/data/ForbidCustomFunctionsRule

1 file changed

+3
-0
lines changed

tests/Rule/data/ForbidCustomFunctionsRule/code.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ public function test(
143143
$forbiddenConstructor->foo();
144144
$union->forbiddenMethod(); // error: Method ForbidCustomFunctionsRule\SomeClass::forbiddenMethod() is forbidden. Description 4
145145

146+
new class {};
147+
new class extends ClassWithForbiddenConstructor {}; // error: Method ForbidCustomFunctionsRule\ClassWithForbiddenConstructor::__construct() is forbidden. Description 3
148+
new class extends ClassWithForbiddenAllMethods {}; // error: Class ForbidCustomFunctionsRule\ClassWithForbiddenAllMethods is forbidden. Description 2
146149
new ClassWithForbiddenConstructor(); // error: Method ForbidCustomFunctionsRule\ClassWithForbiddenConstructor::__construct() is forbidden. Description 3
147150
new ClassWithForbiddenAllMethods(); // error: Class ForbidCustomFunctionsRule\ClassWithForbiddenAllMethods is forbidden. Description 2
148151

0 commit comments

Comments
 (0)