| Conditions | 2 |
| Paths | 1 |
| Total Lines | 19 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 25 | public function register(): void |
||
| 26 | { |
||
| 27 | 1 | $this->container->share(DriverManager::class, function () { |
|
| 28 | // Here we will discover all drivers installed |
||
| 29 | // And add all found drivers to the manager |
||
| 30 | |||
| 31 | 1 | $manager = new DriverManager($this->container); |
|
|
|
|||
| 32 | /** @var Assets $assetLoader */ |
||
| 33 | 1 | $assetLoader = $this->container->get(Assets::class); |
|
| 34 | |||
| 35 | 1 | $assets = $assetLoader->discover('driver'); |
|
| 36 | |||
| 37 | 1 | foreach ($assets as $asset) { |
|
| 38 | 1 | $manager->add($this->container->get($asset)); |
|
| 39 | } |
||
| 40 | |||
| 41 | 1 | return $manager; |
|
| 42 | 1 | }); |
|
| 43 | 1 | } |
|
| 44 | } |
||
| 45 |
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.
In this case you can add the
@ignorePhpDoc annotation to the duplicate definition and it will be ignored.