Completed
Push — master ( 960666...619cc6 )
by Tom
14s
created

Validator/Service/NoObjectExistsFactory.php (3 issues)

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
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
5
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
6
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
7
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
8
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
9
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
10
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
11
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
12
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
13
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
14
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15
 *
16
 * This software consists of voluntary contributions made by many individuals
17
 * and is licensed under the MIT license. For more information, see
18
 * <http://www.doctrine-project.org>.
19
 */
20
21
namespace DoctrineModule\Validator\Service;
22
23
use Interop\Container\ContainerInterface;
24
use DoctrineModule\Validator\NoObjectExists;
25
26
/**
27
 * Factory for creating NoObjectExists instances
28
 *
29
 * @license MIT
30
 * @link    http://www.doctrine-project.org/
31
 * @since   1.3.0
32
 * @author  Fabian Grutschus <[email protected]>
33
 */
34
class NoObjectExistsFactory extends AbstractValidatorFactory
35
{
36
    protected $validatorClass = NoObjectExists::class;
37
38 2
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
39
    {
40 2
        $container = $this->container($container);
41
42 2
        $repository = $this->getRepository($container, $options);
0 ignored issues
show
It seems like $options defined by parameter $options on line 38 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...
43
44 2
        $validator = new NoObjectExists($this->merge($options, [
0 ignored issues
show
It seems like $options defined by parameter $options on line 38 can also be of type null; however, DoctrineModule\Validator...lidatorFactory::merge() 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...
45 2
            'object_repository' => $repository,
46 2
            'fields'            => $this->getFields($options),
0 ignored issues
show
It seems like $options defined by parameter $options on line 38 can also be of type null; however, DoctrineModule\Validator...torFactory::getFields() 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...
47 2
        ]));
48
49 2
        return $validator;
50
    }
51
}
52