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
Push — master ( 3d1c69...73cd7f )
by Jérémiah
19:41
created

EventDispatcherVersionHelper::isForLegacy()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 7
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Overblog\GraphQLBundle\Event;
6
7
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
8
use Symfony\Component\HttpKernel\Kernel;
9
10
/**
11
 * @internal
12
 */
13
final class EventDispatcherVersionHelper
14
{
15
    private static $isForLegacy;
16
17 115
    public static function isForLegacy(): bool
18
    {
19 115
        if (null === self::$isForLegacy) {
20 1
            self::$isForLegacy = \version_compare(Kernel::VERSION, '4.3.0', '<');
21
        }
22
23 115
        return self::$isForLegacy;
24
    }
25
26 113
    public static function dispatch(EventDispatcherInterface $dispatcher, $event, ?string $eventName)
27
    {
28 113
        if (self::isForLegacy()) {
29
            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

29
            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

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