Conditions | 2 |
Paths | 2 |
Total Lines | 11 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php |
||
40 | #[\ReturnTypeWillChange] |
||
41 | public static function __callStatic(string $name, array $arguments) |
||
42 | { |
||
43 | try { |
||
44 | $class = new \ReflectionClassConstant(static::class, $name); |
||
45 | } catch (\ReflectionException $th) { |
||
46 | throw new \Error('Undefined constant ' . static::class . '::' . $name); |
||
47 | } |
||
48 | |||
49 | // @phpstan-ignore-next-line |
||
50 | return new static($class->getValue()); |
||
|
|||
51 | } |
||
53 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.