1 | <?php |
||
11 | class TreeSelfReference implements Buildable |
||
12 | { |
||
13 | /** |
||
14 | * @var ExtensibleClassMetadata |
||
15 | */ |
||
16 | protected $classMetadata; |
||
17 | |||
18 | /** |
||
19 | * @var string |
||
20 | */ |
||
21 | protected $fieldName; |
||
22 | |||
23 | /** |
||
24 | * @var string |
||
25 | */ |
||
26 | private $key; |
||
27 | |||
28 | /** |
||
29 | * @param ExtensibleClassMetadata $classMetadata |
||
30 | * @param string $fieldName |
||
31 | * @param string $key |
||
32 | */ |
||
33 | 13 | public function __construct(ExtensibleClassMetadata $classMetadata, $fieldName, $key) |
|
39 | |||
40 | /** |
||
41 | * Enable TreeRoot and TreeParent macros. |
||
42 | * |
||
43 | * @return void |
||
44 | */ |
||
45 | 8 | public static function enable() |
|
50 | |||
51 | /** |
||
52 | * Enable only the TreeRoot macro. |
||
53 | * |
||
54 | * @return void |
||
55 | */ |
||
56 | 92 | public static function enableRoot() |
|
60 | |||
61 | /** |
||
62 | * Enable only the TreeParent macro. |
||
63 | * |
||
64 | * @return void |
||
65 | */ |
||
66 | 93 | public static function enableParent() |
|
70 | |||
71 | /** |
||
72 | * @param string $method |
||
73 | * @param string $key |
||
74 | * |
||
75 | * @return void |
||
76 | */ |
||
77 | 93 | protected static function addMacro($method, $key) |
|
91 | |||
92 | /** |
||
93 | * Execute the build process |
||
94 | */ |
||
95 | 9 | public function build() |
|
101 | |||
102 | /** |
||
103 | * Return the name of the actual extension. |
||
104 | * |
||
105 | * @return string |
||
106 | */ |
||
107 | 9 | public function getExtensionName() |
|
111 | } |
||
112 |
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.