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 (#855)
by Piotr
23:57
created

TotalCountCache::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Overblog\GraphQLBundle\Relay\Connection;
6
7
use Symfony\Contracts\Service\ResetInterface;
8
9
class TotalCountCache implements ResetInterface
10
{
11
    /**
12
     * @var int|callable
13
     */
14
    private $total;
15
    private int $totalCount;
16
17
    /**
18
     * @param int|callable $total
19
     */
20
    public function __construct($total)
21
    {
22
        $this->total = $total;
23
    }
24
25
    public function __invoke(array $callableArgs = []): int
26
    {
27
        if (isset($this->totalCount)) {
28
            return $this->totalCount;
29
        }
30
31
        $this->totalCount = is_callable($this->total) ? call_user_func_array($this->total, $callableArgs) : $this->total;
0 ignored issues
show
Bug introduced by
It seems like $this->total can also be of type integer; however, parameter $callback of call_user_func_array() does only seem to accept callable, 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

31
        $this->totalCount = is_callable($this->total) ? call_user_func_array(/** @scrutinizer ignore-type */ $this->total, $callableArgs) : $this->total;
Loading history...
32
33
        return $this->totalCount;
34
    }
35
36
    public function reset(): void
37
    {
38
        unset($this->totalCount);
39
    }
40
}
41