| Total Complexity | 5 |
| Total Lines | 42 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 30 | trait Enumerates |
||
| 31 | { |
||
| 32 | /** |
||
| 33 | * Create a new collection instance if the value isn't one already. |
||
| 34 | * |
||
| 35 | * @param mixed $items |
||
| 36 | * |
||
| 37 | * @return static |
||
| 38 | */ |
||
| 39 | public static function make($items = []) |
||
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * Create a collection of all elements that do not pass a given truth test. |
||
| 46 | * |
||
| 47 | * @param \callable|mixed $callable |
||
| 48 | * |
||
| 49 | * @return static |
||
| 50 | */ |
||
| 51 | public function reject($callback = true) |
||
| 52 | { |
||
| 53 | $useAsCallable = $this->useAsCallable($callback); |
||
| 54 | |||
| 55 | return $this->filter(function($value, $key) use ($callback, $useAsCallable) { |
||
| 56 | return $useAsCallable |
||
| 57 | ? ! $callback($value, $key) |
||
| 58 | : $value != $callback; |
||
| 59 | }); |
||
| 60 | } |
||
| 61 | |||
| 62 | /** |
||
| 63 | * Determine if the given value is callable, but not a string. |
||
| 64 | * |
||
| 65 | * @param mixed $value |
||
| 66 | * |
||
| 67 | * @return bool |
||
| 68 | */ |
||
| 69 | protected function useAsCallable($value) |
||
| 72 | } |
||
| 73 | } |
||
| 74 |
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.