Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Completed
Pull Request — 0.11 (#495)
by Jérémiah
21:05
created

EventDispatcherVersionHelper::dispatch()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 3
1
<?php
2
3
namespace Overblog\GraphQLBundle\Event;
4
5
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
6
use Symfony\Component\HttpKernel\Kernel;
7
8
/**
9
 * @internal
10
 */
11
final class EventDispatcherVersionHelper
12
{
13
    private static $isForLegacy;
14
15
    public static function isForLegacy(): bool
16
    {
17
        if (\is_null(self::$isForLegacy)) {
18
            self::$isForLegacy = \version_compare(Kernel::VERSION, '4.3.0', '<');
19
        }
20
21
        return self::$isForLegacy;
22
    }
23
24
    public static function dispatch(EventDispatcherInterface $dispatcher, $event, ?string $eventName)
25
    {
26
        if (self::isForLegacy()) {
27
            return $dispatcher->dispatch($eventName, $event);
0 ignored issues
show
Unused Code introduced by
The call to Symfony\Contracts\EventD...erInterface::dispatch() has too many arguments starting with $event. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

27
            return $dispatcher->/** @scrutinizer ignore-call */ dispatch($eventName, $event);

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.

Loading history...
Bug introduced by
It seems like $eventName can also be of type string; however, parameter $event of Symfony\Contracts\EventD...erInterface::dispatch() does only seem to accept object, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

27
            return $dispatcher->dispatch(/** @scrutinizer ignore-type */ $eventName, $event);
Loading history...
28
        } else {
29
            return $dispatcher->dispatch($event, $eventName);
30
        }
31
    }
32
}
33