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
22:02
created

InputValidatorFactory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 4
Bugs 0 Features 0
Metric Value
eloc 14
c 4
b 0
f 0
dl 0
loc 30
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 11 2
A __construct() 0 8 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Overblog\GraphQLBundle\Validator;
6
7
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
8
use Symfony\Component\Validator\ConstraintValidatorFactoryInterface;
9
use Symfony\Component\Validator\Validator\ValidatorInterface;
10
use Symfony\Contracts\Translation\TranslatorInterface;
11
12
class InputValidatorFactory
13
{
14
    private ?ValidatorInterface $defaultValidator;
15
    private ?ConstraintValidatorFactoryInterface $constraintValidatorFactory;
16
    private ?TranslatorInterface $defaultTranslator;
17
18
    /**
19
     * InputValidatorFactory constructor.
20
     */
21
    public function __construct(
22
        ?ConstraintValidatorFactoryInterface $constraintValidatorFactory,
23
        ?ValidatorInterface $validator,
24
        ?TranslatorInterface $translator
25
    ) {
26
        $this->defaultValidator = $validator;
27
        $this->defaultTranslator = $translator;
28
        $this->constraintValidatorFactory = $constraintValidatorFactory;
29
    }
30
31
    public function create(array $resolverArgs): InputValidator
32
    {
33
        if (null === $this->defaultValidator) {
34
            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'");
35
        }
36
37
        return new InputValidator(
38
            $resolverArgs,
39
            $this->defaultValidator,
40
            $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

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