1 | <?php |
||
32 | final class Utils |
||
33 | { |
||
34 | /** |
||
35 | * Get the content of given file and returns the results. |
||
36 | * |
||
37 | * @param string $file The path to the file |
||
38 | * |
||
39 | * @return mixed The results of the include |
||
40 | * @since 0.2.4 |
||
41 | * @codeCoverageIgnore |
||
42 | */ |
||
43 | public static function getContent($file = null) |
||
47 | |||
48 | /** |
||
49 | * Get the given file and returns the results. |
||
50 | * |
||
51 | * @param string $path The path to the file |
||
52 | * |
||
53 | * @return mixed The results of the include |
||
54 | * @since 0.2.4 |
||
55 | * @codeCoverageIgnore |
||
56 | */ |
||
57 | public static function getFile($path = null) |
||
64 | |||
65 | /** |
||
66 | * Takes a value and checks if it's a Closure or not, if it's a Closure it |
||
67 | * will return the result of the closure, if not, it will simply return the |
||
68 | * value. |
||
69 | * |
||
70 | * @param mixed $var The value to get |
||
71 | * |
||
72 | * @return mixed |
||
73 | * @since 0.1.0 |
||
74 | * @codeCoverageIgnore |
||
75 | */ |
||
76 | public static function checkValue($var = null) |
||
80 | |||
81 | /** |
||
82 | * Trim array elements. |
||
83 | * |
||
84 | * @param array $content The array to trim |
||
85 | * |
||
86 | * @return mixed |
||
87 | * @since 0.2.4 |
||
88 | * @codeCoverageIgnore |
||
89 | */ |
||
90 | public static function trimArrayElements($content = null) |
||
100 | |||
101 | /** |
||
102 | * Remove quotes. |
||
103 | * |
||
104 | * @param string $string The string to remove quotes from |
||
105 | * |
||
106 | * @return string |
||
107 | * @since 0.2.4 |
||
108 | * @codeCoverageIgnore |
||
109 | */ |
||
110 | public static function removeQuotes($string = null) |
||
120 | |||
121 | /** |
||
122 | * Strip Backslashes from given string. |
||
123 | * |
||
124 | * @param array|null $content String |
||
125 | * |
||
126 | * @return array |
||
127 | * @since 0.2.4 |
||
128 | * @codeCoverageIgnore |
||
129 | */ |
||
130 | public static function stripBackslashes($content = null) |
||
140 | |||
141 | /** |
||
142 | * Checks if the string starts with the given needle. |
||
143 | * |
||
144 | * @param string $needle Search string |
||
145 | * @param string $string String to search in |
||
146 | * |
||
147 | * @return bool |
||
148 | * @since 0.2.4 |
||
149 | * @codeCoverageIgnore |
||
150 | */ |
||
151 | public static function stringStart($needle, $string) |
||
155 | |||
156 | /** |
||
157 | * Opens given file and convert it to an array. |
||
158 | * |
||
159 | * @param string $path The path to the file |
||
160 | * |
||
161 | * @return array |
||
162 | * @since 0.2.4 |
||
163 | * @codeCoverageIgnore |
||
164 | */ |
||
165 | public static function fileToArray($path = null) |
||
178 | |||
179 | /** |
||
180 | * Opens given file and convert it to an array. |
||
181 | * |
||
182 | * @param string $content The file content |
||
183 | * |
||
184 | * @return string |
||
185 | * @since 0.2.4 |
||
186 | * @codeCoverageIgnore |
||
187 | */ |
||
188 | public static function fileContentToArray($content = null) |
||
197 | |||
198 | /** |
||
199 | * Get lines matching number. |
||
200 | * |
||
201 | * @param string $type The line type |
||
202 | * @param array $analysis Array to analyze |
||
203 | * |
||
204 | * @return int |
||
205 | * @since 0.2.4 |
||
206 | * @codeCoverageIgnore |
||
207 | */ |
||
208 | public static function getNumberLinesMatching($type, array $analysis) |
||
220 | |||
221 | /** |
||
222 | * __toString. |
||
223 | * |
||
224 | * @return string |
||
225 | * @since 0.1.2 |
||
226 | * @codeCoverageIgnore |
||
227 | */ |
||
228 | public function __toString() |
||
232 | } |
||
233 | |||
235 |
There are different options of fixing this problem.
If you want to be on the safe side, you can add an additional type-check:
If you are sure that the expression is traversable, you might want to add a doc comment cast to improve IDE auto-completion and static analysis:
Mark the issue as a false-positive: Just hover the remove button, in the top-right corner of this issue for more options.