Completed
Push — master ( 968a4e...5cbcd6 )
by Tom
10s
created

Validator/Service/ObjectExistsFactory.php (1 issue)

Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
4
namespace DoctrineModule\Validator\Service;
5
6
use Interop\Container\ContainerInterface;
7
use DoctrineModule\Validator\ObjectExists;
8
9
/**
10
 * Factory for creating ObjectExists instances
11
 *
12
 * @license MIT
13
 * @link    http://www.doctrine-project.org/
14
 * @since   1.3.0
15
 * @author  Fabian Grutschus <[email protected]>
16
 */
17
class ObjectExistsFactory extends AbstractValidatorFactory
18
{
19
    protected $validatorClass = ObjectExists::class;
20
21 1
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
22
    {
23 1
        $container = $this->container($container);
24
25 1
        $repository = $this->getRepository($container, $options);
0 ignored issues
show
It seems like $options defined by parameter $options on line 21 can also be of type null; however, DoctrineModule\Validator...actory::getRepository() does only seem to accept array, maybe add an additional type check?

This check looks at variables that have been passed in as parameters and are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
26
27 1
        $validator = new ObjectExists($this->merge($options, [
28 1
            'object_repository' => $repository,
29 1
            'fields'            => $this->getFields($options),
30
        ]));
31
32 1
        return $validator;
33
    }
34
}
35