1 | <?php |
||
56 | class IsEmpty implements Check, ListCheck |
||
57 | { |
||
58 | // saves us having to implement inspectList() ourselves |
||
59 | use ListCheckHelper; |
||
60 | |||
61 | /** |
||
62 | * check if an item is empty |
||
63 | * |
||
64 | * empty means one of: |
||
65 | * - item itself is empty |
||
66 | * - item is a data container, and only contains empty data items |
||
67 | * |
||
68 | * BE AWARE that this check WILL descend down into the contents of $fieldOrVar |
||
69 | * until it finds the first piece of non-empty data. This has the potential |
||
70 | * to be computationally expensive. |
||
71 | * |
||
72 | * @param mixed $fieldOrVar |
||
73 | * the item to check |
||
74 | * @return bool |
||
75 | * TRUE if the item is empty |
||
76 | * FALSE otherwise |
||
77 | */ |
||
78 | public static function check($fieldOrVar) |
||
103 | |||
104 | /** |
||
105 | * check if an item is empty |
||
106 | * |
||
107 | * empty means one of: |
||
108 | * - item itself has no content |
||
109 | * - item is a data container, and only contains empty data items |
||
110 | * |
||
111 | * BE AWARE that this check WILL descend down into the contents of $fieldOrVar |
||
112 | * until it finds the first piece of non-empty data. This has the potential |
||
113 | * to be computationally expensive. |
||
114 | * |
||
115 | * @param array $fieldOrVar |
||
116 | * the item to check |
||
117 | * @return bool |
||
118 | * TRUE if the item is empty |
||
119 | * FALSE otherwise |
||
120 | */ |
||
121 | private static function checkArray($fieldOrVar) |
||
129 | |||
130 | /** |
||
131 | * check if an item is empty |
||
132 | * |
||
133 | * empty means one of: |
||
134 | * - the string has zero length |
||
135 | * - the string only contains whitespace |
||
136 | * |
||
137 | * @param string $fieldOrVar |
||
138 | * the item to check |
||
139 | * @return bool |
||
140 | * TRUE if the item is empty |
||
141 | * FALSE otherwise |
||
142 | */ |
||
143 | private static function checkString($fieldOrVar) |
||
151 | |||
152 | /** |
||
153 | * check if an item is empty |
||
154 | * |
||
155 | * empty means one of: |
||
156 | * - item itself has no content |
||
157 | * - item is a data container, and only contains empty data items |
||
158 | * |
||
159 | * BE AWARE that this check WILL descend down into the contents of $fieldOrVar |
||
160 | * until it finds the first piece of non-empty data. This has the potential |
||
161 | * to be computationally expensive. |
||
162 | * |
||
163 | * @param array $fieldOrVar |
||
164 | * the item to check |
||
165 | * @return bool |
||
166 | * TRUE if the item is empty |
||
167 | * FALSE otherwise |
||
168 | */ |
||
169 | private static function checkTraversable($fieldOrVar) |
||
180 | |||
181 | /** |
||
182 | * check if an item is empty |
||
183 | * |
||
184 | * empty means one of: |
||
185 | * - item itself is empty |
||
186 | * - item is a data container, and only contains empty data items |
||
187 | * |
||
188 | * BE AWARE that this check WILL descend down into the contents of $fieldOrVar |
||
189 | * until it finds the first piece of non-empty data. This has the potential |
||
190 | * to be computationally expensive. |
||
191 | * |
||
192 | * @param mixed $fieldOrVar |
||
193 | * the item to check |
||
194 | * @return bool |
||
195 | * TRUE if the item is empty |
||
196 | * FALSE otherwise |
||
197 | */ |
||
198 | public function inspect($fieldOrVar) |
||
202 | |||
203 | /** |
||
204 | * is every entry in $list empty? |
||
205 | * |
||
206 | * @param mixed $list |
||
207 | * the list of items to be checked |
||
208 | * @return bool |
||
209 | * TRUE if every item in $list is empty |
||
210 | * FALSE otherwise |
||
211 | */ |
||
212 | public static function checkList($list) |
||
217 | } |
||
218 |
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: