1 | <?php |
||
12 | class NodeCollection implements \ArrayAccess, \Countable, \IteratorAggregate |
||
13 | { |
||
14 | /** |
||
15 | * @var Node[] |
||
16 | */ |
||
17 | protected $nodes; |
||
18 | |||
19 | 174 | public function __construct(Node ...$nodeCollection) |
|
23 | |||
24 | 138 | public function all() |
|
28 | |||
29 | 45 | public function first() |
|
35 | |||
36 | 90 | public function isEmpty(): bool |
|
40 | |||
41 | /** |
||
42 | * Add one / many nodes to this collection |
||
43 | * |
||
44 | * @param Node[] ...$nodes |
||
45 | * @return $this |
||
46 | */ |
||
47 | 66 | public function add(Node ...$nodes) |
|
53 | |||
54 | /** |
||
55 | * Merge a collection into current one. |
||
56 | * |
||
57 | * @param NodeCollection $nodeCollection |
||
58 | * @return $this |
||
59 | */ |
||
60 | 126 | public function merge(self $nodeCollection) |
|
66 | |||
67 | /** |
||
68 | * Remove the child node |
||
69 | * |
||
70 | * Please note that all descendants of this |
||
71 | * child node will be removed as well. |
||
72 | * |
||
73 | * @param Node $child |
||
74 | * @return $this |
||
75 | */ |
||
76 | 36 | public function remove(Node $child) |
|
80 | |||
81 | /** |
||
82 | * Return flattened list of all nodes in this collection |
||
83 | * |
||
84 | * @return NodeCollection |
||
85 | */ |
||
86 | 6 | public function flatten() |
|
90 | |||
91 | /** |
||
92 | * Inflate a flattened collection back to its original structure |
||
93 | * |
||
94 | * @return NodeCollection |
||
95 | */ |
||
96 | 6 | public function inflate() |
|
100 | |||
101 | /** |
||
102 | * Slice one or more nodes out of the collection |
||
103 | * |
||
104 | * @param Node[] ...$nodes |
||
105 | * @return mixed |
||
106 | */ |
||
107 | 3 | public function slice(Node ...$nodes) |
|
111 | |||
112 | /** |
||
113 | * Find many nodes by attribute value |
||
114 | * |
||
115 | * @param $key |
||
116 | * @param array $values |
||
117 | * @return NodeCollection |
||
118 | */ |
||
119 | 3 | public function findMany($key, array $values): self |
|
123 | |||
124 | /** |
||
125 | * Find specific node by attribute value |
||
126 | * |
||
127 | * @param $key |
||
128 | * @param $value |
||
129 | * @return Node|null |
||
130 | */ |
||
131 | 9 | public function find($key, $value) |
|
135 | |||
136 | 21 | public function offsetExists($offset) |
|
142 | |||
143 | 33 | public function offsetGet($offset) |
|
147 | |||
148 | 21 | public function offsetSet($offset, $value) |
|
154 | |||
155 | 39 | public function offsetUnset($offset) |
|
159 | |||
160 | 66 | public function count() |
|
164 | |||
165 | 90 | public function getIterator() |
|
169 | } |
||
170 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..