1 | <?php |
||
9 | class Tree |
||
10 | { |
||
11 | /** @var array Collection of ignored DOM nodes */ |
||
12 | public static $ignoredNodes = array( |
||
13 | 'head', |
||
14 | 'meta', |
||
15 | 'script', |
||
16 | 'noscript', |
||
17 | 'link', |
||
18 | 'title', |
||
19 | 'br', |
||
20 | ); |
||
21 | |||
22 | /** |
||
23 | * Build destination code tree from source code. |
||
24 | * |
||
25 | * @param string $source Source code |
||
26 | * |
||
27 | * @return Node Less tree root node |
||
28 | */ |
||
29 | 2 | public function build($source) |
|
37 | |||
38 | /** |
||
39 | * Source code cleaner. |
||
40 | * |
||
41 | * @param string $source |
||
42 | * |
||
43 | * @return string Cleared source code |
||
44 | */ |
||
45 | 2 | protected function prepare($source) |
|
50 | |||
51 | /** |
||
52 | * Analyze source code and create destination code tree. |
||
53 | * |
||
54 | * @param string $source Source code |
||
55 | * |
||
56 | * @return Node Internal code tree |
||
57 | */ |
||
58 | 2 | protected function &analyze($source) |
|
69 | |||
70 | /** |
||
71 | * Perform source node analysis. |
||
72 | * |
||
73 | * @param \DOMNode $domNode |
||
74 | * @param Node $parent |
||
75 | * |
||
76 | * @return Node |
||
77 | */ |
||
78 | 2 | protected function &analyzeSourceNode(\DOMNode $domNode, Node $parent) |
|
131 | |||
132 | /** |
||
133 | * Get DOM node attribute value. |
||
134 | * |
||
135 | * @param \DOMNode $domNode |
||
136 | * @param string $attributeName |
||
137 | * |
||
138 | * @return null|string DOM node attribute value |
||
139 | */ |
||
140 | 2 | protected function getDOMAttributeValue(\DOMNode $domNode, $attributeName) |
|
156 | |||
157 | /** |
||
158 | * Get current \DOMNode LESS selector. |
||
159 | * |
||
160 | * @param \DOMNode $child |
||
161 | * @param string $tag |
||
162 | * @param array $classes |
||
163 | * |
||
164 | * @return string LESS selector |
||
165 | */ |
||
166 | 2 | protected function getSelector(\DOMNode $child, $tag, array &$classes) |
|
179 | |||
180 | /** |
||
181 | * Optimize by grouping tag name LESS nodes. |
||
182 | * |
||
183 | * @param Node[] $tagNodes |
||
184 | * @param Node $parent |
||
185 | */ |
||
186 | 2 | protected function optimizeGroupTags($tagNodes, Node $parent) |
|
226 | |||
227 | /** |
||
228 | * Render LESS tree. This function is recursive. |
||
229 | * |
||
230 | * @param Node $node Current LESS tree node |
||
231 | * @param string $output Final LESS code string |
||
232 | * @param int $level Current recursion level |
||
233 | * |
||
234 | * @return string LESS code |
||
235 | */ |
||
236 | 2 | public function output(Node $node, $output = '', $level = 0) |
|
250 | |||
251 | /** |
||
252 | * Get spaces for LESS tree level. |
||
253 | * |
||
254 | * @param int $level LESS tree depth |
||
255 | * |
||
256 | * @return string Spaces for current LESS tree depth |
||
257 | */ |
||
258 | 2 | protected function spaces($level = 0) |
|
262 | } |
||
263 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: