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 (#815)
by Timur
25:10
created

InputValidatorFactory::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 3
dl 0
loc 8
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Overblog\GraphQLBundle\Validator;
6
7
use Overblog\GraphQLBundle\Definition\ResolverArgs;
8
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
9
use Symfony\Component\Validator\ConstraintValidatorFactoryInterface;
10
use Symfony\Component\Validator\Validator\ValidatorInterface;
11
use Symfony\Contracts\Translation\TranslatorInterface;
12
13
class InputValidatorFactory
14
{
15
    private ?ValidatorInterface $defaultValidator;
16
    private ?ConstraintValidatorFactoryInterface $constraintValidatorFactory;
17
    private ?TranslatorInterface $defaultTranslator;
18
19
    /**
20
     * InputValidatorFactory constructor.
21
     */
22
    public function __construct(
23
        ?ConstraintValidatorFactoryInterface $constraintValidatorFactory,
24
        ?ValidatorInterface $validator,
25
        ?TranslatorInterface $translator
26
    ) {
27
        $this->defaultValidator = $validator;
28
        $this->defaultTranslator = $translator;
29
        $this->constraintValidatorFactory = $constraintValidatorFactory;
30
    }
31
32
    public function create(ResolverArgs $args): InputValidator
33
    {
34
        if (null === $this->defaultValidator) {
35
            throw new ServiceNotFoundException("The 'validator' service is not found. To use the 'InputValidator' you need to install the Symfony Validator Component first. See: 'https://symfony.com/doc/current/validation.html'");
36
        }
37
38
        return new InputValidator(
39
            $args,
40
            $this->defaultValidator,
41
            $this->constraintValidatorFactory,
0 ignored issues
show
Bug introduced by
It seems like $this->constraintValidatorFactory can also be of type null; however, parameter $constraintValidatorFactory of Overblog\GraphQLBundle\V...alidator::__construct() does only seem to accept Symfony\Component\Valida...lidatorFactoryInterface, 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

41
            /** @scrutinizer ignore-type */ $this->constraintValidatorFactory,
Loading history...
42
            $this->defaultTranslator
43
        );
44
    }
45
}
46