-
-
Notifications
You must be signed in to change notification settings - Fork 946
Closed
Description
<?php
abstract class AbstractConstants
{
public static function __callStatic($name, $arguments)
{
if (! isset($arguments) || count($arguments) === 0) {
throw new \Exception('The Code is required');
}
$code = $arguments[0];
$name = strtolower(substr($name, 3));
array_shift($arguments);
$message = '';
$count = count($arguments);
if ($count > 0) {
return sprintf($message, ...(array) $arguments[0]);
}
return $message;
}
}
$ vendor/bin/phpstan analyse -l 5 index.php
1/1 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
------ --------------------------------------------------------------------
Line index.php
------ --------------------------------------------------------------------
19 Comparison operation ">" between int<1, max> and 0 is always true.
23 Unreachable statement - code above always terminates.
------ --------------------------------------------------------------------
[ERROR] Found 2 errors
If the $arguments is [0], the operation ">" should between int <0, max>
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels