These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace LesserPhp; |
||
4 | |||
5 | /** |
||
6 | * lesserphp |
||
7 | * https://www.maswaba.de/lesserphp |
||
8 | * |
||
9 | * LESS CSS compiler, adapted from http://lesscss.org |
||
10 | * |
||
11 | * Copyright 2013, Leaf Corcoran <[email protected]> |
||
12 | * Copyright 2016, Marcus Schwarz <[email protected]> |
||
13 | * Licensed under MIT or GPLv3, see LICENSE |
||
14 | * @package LesserPhp |
||
15 | */ |
||
16 | class NodeEnv |
||
17 | { |
||
18 | |||
19 | public $seenNames; |
||
20 | |||
21 | /** |
||
22 | * @var \LesserPhp\NodeEnv |
||
23 | */ |
||
24 | private $parent; |
||
25 | |||
26 | /** |
||
27 | * @var array |
||
28 | */ |
||
29 | private $store = []; |
||
30 | |||
31 | /** |
||
32 | * @var \stdClass |
||
33 | */ |
||
34 | private $block; |
||
35 | |||
36 | /** |
||
37 | * @var array|null |
||
38 | */ |
||
39 | private $selectors; |
||
40 | |||
41 | /** |
||
42 | * @var array|null |
||
43 | */ |
||
44 | private $arguments = []; |
||
45 | |||
46 | /** |
||
47 | * @var array |
||
48 | */ |
||
49 | private $imports = []; |
||
50 | |||
51 | /** |
||
52 | * @return \LesserPhp\NodeEnv |
||
53 | */ |
||
54 | 49 | public function getParent() |
|
55 | { |
||
56 | 49 | return $this->parent; |
|
57 | } |
||
58 | |||
59 | /** |
||
60 | * @param \LesserPhp\NodeEnv $parent |
||
61 | */ |
||
62 | 49 | public function setParent($parent) |
|
63 | { |
||
64 | 49 | $this->parent = $parent; |
|
65 | 49 | } |
|
66 | |||
67 | /** |
||
68 | * @return array |
||
69 | */ |
||
70 | 28 | public function getStore() |
|
71 | { |
||
72 | 28 | return $this->store; |
|
73 | } |
||
74 | |||
75 | /** |
||
76 | * @param array $store |
||
77 | */ |
||
78 | 49 | public function setStore($store) |
|
79 | { |
||
80 | 49 | $this->store = $store; |
|
81 | 49 | } |
|
82 | |||
83 | 27 | public function addStore($index, $value) |
|
84 | { |
||
85 | 27 | $this->store[$index] = $value; |
|
86 | 27 | } |
|
87 | |||
88 | /** |
||
89 | * @return \stdClass |
||
90 | */ |
||
91 | 3 | public function getBlock() |
|
92 | { |
||
93 | 3 | return $this->block; |
|
94 | } |
||
95 | |||
96 | /** |
||
97 | * @param string $block |
||
98 | */ |
||
99 | 49 | public function setBlock($block) |
|
100 | { |
||
101 | 49 | $this->block = $block; |
|
0 ignored issues
–
show
|
|||
102 | 49 | } |
|
103 | |||
104 | /** |
||
105 | * @return array |
||
106 | */ |
||
107 | 46 | public function getSelectors() |
|
108 | { |
||
109 | 46 | return $this->selectors; |
|
110 | } |
||
111 | |||
112 | /** |
||
113 | * @param array $selectors |
||
114 | */ |
||
115 | 46 | public function setSelectors($selectors) |
|
116 | { |
||
117 | 46 | $this->selectors = $selectors; |
|
118 | 46 | } |
|
119 | |||
120 | /** |
||
121 | * @return mixed |
||
122 | */ |
||
123 | 3 | public function getArguments() |
|
124 | { |
||
125 | 3 | return $this->arguments; |
|
126 | } |
||
127 | |||
128 | /** |
||
129 | * @param mixed $arguments |
||
130 | */ |
||
131 | 16 | public function setArguments($arguments) |
|
132 | { |
||
133 | 16 | $this->arguments = $arguments; |
|
134 | 16 | } |
|
135 | |||
136 | /** |
||
137 | * @param null $index |
||
138 | * |
||
139 | * @return array |
||
140 | */ |
||
141 | 3 | public function getImports($index = null) |
|
142 | { |
||
143 | 3 | if ($index === null) { |
|
144 | return $this->imports; |
||
145 | } |
||
146 | 3 | return $this->imports[$index]; |
|
147 | } |
||
148 | |||
149 | /** |
||
150 | * @param array|null $imports |
||
151 | */ |
||
152 | public function setImports($imports) |
||
153 | { |
||
154 | $this->imports = $imports; |
||
0 ignored issues
–
show
It seems like
$imports can be null . However, the property $imports is declared as array . Maybe change the type of the property to array|null or add a type check?
Our type inference engine has found an assignment of a scalar value (like a string, an integer or null) to a property which is an array. Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property. To type hint that a parameter can be either an array or null, you can set a type hint of array and a default value of null. The PHP interpreter will then accept both an array or null for that parameter. function aContainsB(array $needle = null, array $haystack) {
if (!$needle) {
return false;
}
return array_intersect($haystack, $needle) == $haystack;
}
The function can be called with either null or an array for the parameter
Loading history...
|
|||
155 | } |
||
156 | |||
157 | 3 | public function addImports($index, $value) |
|
158 | { |
||
159 | 3 | $this->imports[$index] = $value; |
|
160 | 3 | } |
|
161 | } |
||
162 |
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..