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

Passed
Pull Request — master (#496)
by Jérémiah
19:36
created

Executor::execute()   A

Complexity

Conditions 4
Paths 2

Size

Total Lines 21
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 4

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 21
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0
cc 4
nc 2
nop 8
crap 4

How to fix   Many Parameters   

Many Parameters

Methods with many parameters are not only hard to understand, but their parameters also often become inconsistent when you need more, or different data.

There are several approaches to avoid long parameter lists:

1
<?php
2
3
declare(strict_types=1);
4
5
namespace Overblog\GraphQLBundle\Executor;
6
7
use GraphQL\Executor\ExecutionResult;
8
use GraphQL\Executor\Promise\PromiseAdapter;
9
use GraphQL\GraphQL;
10
use GraphQL\Type\Schema;
11
use Overblog\GraphQLBundle\Executor\Promise\PromiseAdapterInterface;
12
13
class Executor implements ExecutorInterface
14
{
15
    /** @var PromiseAdapter */
16
    private $promiseAdapter;
17
18
    /**
19
     * {@inheritdoc}
20
     */
21 84
    public function execute(
22
        Schema $schema,
23
        string $requestString,
24
        $rootValue = null,
25
        $contextValue = null,
26
        $variableValues = null,
27
        $operationName = null,
28
        ?callable $fieldResolver = null,
29
        ?array $validationRules = null
30
    ): ExecutionResult {
31 84
        if ($this->promiseAdapter && !$this->promiseAdapter instanceof PromiseAdapterInterface && !\is_callable([$this->promiseAdapter, 'wait'])) {
32 1
            throw new \RuntimeException(
33 1
                \sprintf(
34 1
                    'PromiseAdapter should be an object instantiating "%s" or "%s" with a "wait" method.',
35 1
                    PromiseAdapterInterface::class,
36 1
                    PromiseAdapter::class
37
                )
38
            );
39
        }
40
41 83
        return $this->promiseAdapter->wait(GraphQL::promiseToExecute($this->promiseAdapter, ...\func_get_args()));
0 ignored issues
show
Bug introduced by
The method wait() does not exist on GraphQL\Executor\Promise\PromiseAdapter. It seems like you code against a sub-type of said class. However, the method does not exist in GraphQL\Executor\Promise...ter\ReactPromiseAdapter. Are you sure you never get one of those? ( Ignorable by Annotation )

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

41
        return $this->promiseAdapter->/** @scrutinizer ignore-call */ wait(GraphQL::promiseToExecute($this->promiseAdapter, ...\func_get_args()));
Loading history...
42
    }
43
44 103
    public function setPromiseAdapter(PromiseAdapter $promiseAdapter): void
45
    {
46 103
        $this->promiseAdapter = $promiseAdapter;
47 103
    }
48
}
49