| Conditions | 3 |
| Paths | 3 |
| Total Lines | 12 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 39 | protected function middlewareExists(string $m) |
||
| 40 | { |
||
| 41 | if(class_exists(str_replace('::class','',$m))){ |
||
| 42 | $m = str_replace('::class','',$m); |
||
| 43 | return new $m(); |
||
| 44 | } |
||
| 45 | |||
| 46 | if(array_key_exists($m,$this->middlewares)){ |
||
| 47 | return new $this->middlewares[$m](); |
||
| 48 | } |
||
| 49 | |||
| 50 | throw new Exception("Middleware {$m} not found."); |
||
| 51 | } |
||
| 54 |
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.