Skip to content

Commit 39a1f1f

Browse files
committed
Document and test that allowInClassWithMethodAttributes means any method including private, static, final etc.
Follow-up to #296
1 parent 1761c31 commit 39a1f1f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

docs/allow-in-class-with-method-attributes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## Allow in class with given attributes on any method
22

33
You can allow or disallow a function or a method, an attribute, a namespace or a classname in a class where any method, including the method the call is done in, but not the class itself, has the specified attribute.
4-
This is done with `allowInClassWithMethodAttributes` and `allowExceptInClassWithMethodAttributes` (or `disallowInClassWithMethodAttributes` which is an alias).
4+
This is done with `allowInClassWithMethodAttributes` and `allowExceptInClassWithMethodAttributes` (or `disallowInClassWithMethodAttributes` which is an alias). The method with the attribute can also be static, final or even abstract, and the method visibility doesn't matter.
55

66
```neon
77
parameters:

tests/src/AttributeClass.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,19 +103,19 @@ public function method1(): void
103103

104104

105105
#[\Attribute6]
106-
public function method2(): void
106+
private function method2(): void
107107
{
108108
}
109109

110110

111111
#[\Attribute8]
112-
public function method3(): void
112+
protected function method3(): void
113113
{
114114
}
115115

116116

117117
#[\Attribute7, \Attribute9]
118-
public function method4(): void
118+
final public static function method4(): void
119119
{
120120
}
121121

0 commit comments

Comments
 (0)