1 | <?php |
||
12 | final class IteratableToNodeConverter implements IteratableToNodeConverterInterface |
||
13 | { |
||
14 | /** |
||
15 | * @var ScalarToNodeConverterInterface |
||
16 | */ |
||
17 | private $scalarToNodeConverter; |
||
18 | |||
19 | /** |
||
20 | * @param ScalarToNodeConverterInterface $scalarToNodeConverter |
||
21 | */ |
||
22 | 4 | public function __construct(ScalarToNodeConverterInterface $scalarToNodeConverter) |
|
26 | |||
27 | /** |
||
28 | * @param array|\Traversable $data |
||
29 | * @param string $path |
||
30 | * @param bool $allowSerializeEmpty |
||
31 | * |
||
32 | * @return AbstractParentNode |
||
33 | * |
||
34 | * @throws \InvalidArgumentException |
||
35 | */ |
||
36 | 4 | public function convert($data, string $path = '', bool $allowSerializeEmpty = false): AbstractParentNode |
|
51 | |||
52 | /** |
||
53 | * @param array|\Traversable $data |
||
54 | * |
||
55 | * @return bool |
||
56 | */ |
||
57 | 3 | private function isArray($data): bool |
|
70 | |||
71 | /** |
||
72 | * @param bool $isArray |
||
73 | * @param bool $allowSerializeEmpty |
||
74 | * |
||
75 | * @return AbstractParentNode |
||
76 | */ |
||
77 | 3 | private function getParentNode(bool $isArray, bool $allowSerializeEmpty): AbstractParentNode |
|
85 | |||
86 | /** |
||
87 | * @param AbstractParentNode $parentNode |
||
88 | * @param int|string $key |
||
89 | * @param mixed $value |
||
90 | * @param string $path |
||
91 | * @param bool $isArray |
||
92 | * @param bool $allowSerializeEmpty |
||
93 | */ |
||
94 | 3 | private function addChildNode( |
|
111 | |||
112 | /** |
||
113 | * @param string $path |
||
114 | * @param string|int $key |
||
115 | * @param bool $isArray |
||
116 | * |
||
117 | * @return string |
||
118 | */ |
||
119 | 3 | private function getSubPath(string $path, $key, bool $isArray): string |
|
129 | |||
130 | /** |
||
131 | * @param mixed $value |
||
132 | * @param string $path |
||
133 | * @param bool $allowSerializeEmpty |
||
134 | * |
||
135 | * @return AbstractNode |
||
136 | */ |
||
137 | 3 | private function getNode($value, string $path, bool $allowSerializeEmpty): AbstractNode |
|
145 | } |
||
146 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.