1 | <?php |
||
13 | class DataStructureMethods extends AbstractDataStructure |
||
14 | { |
||
15 | /** |
||
16 | * @var array |
||
17 | */ |
||
18 | private $allowedPrefixes; |
||
19 | |||
20 | /** |
||
21 | * @var array |
||
22 | */ |
||
23 | private $whitelist; |
||
24 | |||
25 | /** |
||
26 | * @param AbstractNode|ClassNode $node |
||
27 | */ |
||
28 | 6 | public function apply(AbstractNode $node) |
|
51 | |||
52 | /** |
||
53 | * @param MethodNode $method |
||
54 | * |
||
55 | * @return bool |
||
56 | */ |
||
57 | 3 | private function isMethodNameOnWhitelist(MethodNode $method) |
|
61 | |||
62 | /** |
||
63 | * @param MethodNode|ASTMethod $node |
||
64 | * |
||
65 | * @return bool |
||
66 | */ |
||
67 | 3 | private function hasCorrectPrefix(MethodNode $node) |
|
77 | |||
78 | /** |
||
79 | * @param MethodNode|ASTMethod $node |
||
80 | * |
||
81 | * @return bool |
||
82 | */ |
||
83 | 3 | private function isSimpleMethod(MethodNode $node) |
|
104 | |||
105 | /** |
||
106 | * @param MethodNode $node |
||
107 | * |
||
108 | * @return int |
||
109 | */ |
||
110 | 3 | private function countThis(MethodNode $node) |
|
123 | } |
||
124 |
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.
Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.