File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed
Inpsyde/Sniffs/CodeQuality Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change 25
25
*/
26
26
final class NoAccessorsSniff implements Sniff
27
27
{
28
- public $ allowSetUp = true ;
28
+ const ALLOWED_NAMES = [
29
+ 'getIterator ' ,
30
+ 'getInnerIterator ' ,
31
+ 'getChildren ' ,
32
+ 'setUp ' ,
33
+ ];
29
34
30
35
public $ skipForFunctions = true ;
31
36
@@ -50,7 +55,7 @@ public function process(File $file, $position)
50
55
51
56
$ functionName = $ file ->getDeclarationName ($ position );
52
57
53
- if (!$ functionName || ($ functionName === ' setUp ' && $ this -> allowSetUp )) {
58
+ if (!$ functionName || in_array ($ functionName, self :: ALLOWED_NAMES , true )) {
54
59
return ;
55
60
}
56
61
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ function setTheThing($foo, $bar);
21
21
function setting ();
22
22
}
23
23
24
- class WithAccessors {
24
+ class WithAccessors implements \IteratorAggregate {
25
25
26
26
function thing () {
27
27
@@ -44,4 +44,12 @@ function withThing() {
44
44
function setTheThing ($ foo , $ bar ) {
45
45
46
46
}
47
+
48
+ /**
49
+ * @inheritdoc
50
+ */
51
+ public function getIterator ()
52
+ {
53
+ return new \ArrayIterator ();
54
+ }
47
55
}
You can’t perform that action at this time.
0 commit comments