| Total Complexity | 4 |
| Total Lines | 35 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | class EventManager |
||
| 9 | { |
||
| 10 | private $events; |
||
| 11 | |||
| 12 | private $data = []; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * BasicEventManager constructor. |
||
| 16 | * |
||
| 17 | * @param $events |
||
| 18 | * |
||
| 19 | * @return EventManager |
||
| 20 | */ |
||
| 21 | 8 | public function init(array $events): self |
|
| 26 | } |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @param $listener |
||
| 30 | */ |
||
| 31 | 8 | public function commitChain(callable $listener) |
|
| 32 | { |
||
| 33 | 8 | $r = $this->events; |
|
| 34 | 8 | $t = app(HeyManSwitcher::class)->wrapForIgnorance($listener, 'event'); |
|
| 35 | |||
| 36 | 8 | $this->data[] = [$r, $t]; |
|
| 37 | 8 | } |
|
| 38 | |||
| 39 | 91 | public function start() |
|
| 43 | } |
||
| 44 | 91 | } |
|
| 46 |
This check compares calls to functions or methods with their respective definitions. If the call has less 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.