1 | <?php |
||||
2 | |||||
3 | namespace DeGraciaMathieu\Nero; |
||||
4 | |||||
5 | class Breaker { |
||||
6 | |||||
7 | /** |
||||
8 | * Destroy your application |
||||
9 | * @param string $name |
||||
10 | * @param mixed $arguments |
||||
11 | * @return exit |
||||
0 ignored issues
–
show
|
|||||
12 | */ |
||||
13 | public static function __callStatic($name, $arguments) |
||||
14 | { |
||||
15 | $file = isset($arguments[0]) ? $arguments[0] : self::getFilePath(); |
||||
16 | |||||
17 | $line = isset($arguments[1]) ? $arguments[1] : self::getRandomLine($file); |
||||
18 | |||||
19 | $parameter = isset($arguments[2]) ? $arguments[2] : null; |
||||
20 | |||||
21 | call_user_func_array([new Errors, $name], [$file, $line, $parameter]); |
||||
22 | } |
||||
23 | |||||
24 | /** |
||||
25 | * get the path of the calling page |
||||
26 | * @return string |
||||
27 | */ |
||||
28 | protected static function getFilePath() |
||||
29 | { |
||||
30 | $backtrace = debug_backtrace(); |
||||
31 | |||||
32 | return $backtrace[1]['file']; |
||||
33 | } |
||||
34 | |||||
35 | /** |
||||
36 | * random number |
||||
37 | * @param string $path |
||||
38 | * @return integer |
||||
39 | */ |
||||
40 | protected static function getRandomLine($path) |
||||
41 | { |
||||
42 | $numberMax = 200; |
||||
43 | |||||
44 | if (file_exists($path)) { |
||||
45 | $numberMax = count(file($path)); |
||||
0 ignored issues
–
show
It seems like
file($path) can also be of type false ; however, parameter $var of count() does only seem to accept Countable|array , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
46 | } |
||||
47 | |||||
48 | return rand(1, $numberMax); |
||||
49 | } |
||||
50 | } |
||||
51 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths