Passed
Push — master ( 8bd912...d93388 )
by Alan
06:58 queued 02:20
created

Doctrine/Orm/Filter/AbstractContextAwareFilter.php (1 issue)

Severity
1
<?php
2
3
/*
4
 * This file is part of the API Platform project.
5
 *
6
 * (c) Kévin Dunglas <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace ApiPlatform\Core\Bridge\Doctrine\Orm\Filter;
15
16
use ApiPlatform\Core\Bridge\Doctrine\Orm\Util\QueryNameGeneratorInterface;
17
use Doctrine\ORM\QueryBuilder;
18
19
abstract class AbstractContextAwareFilter extends AbstractFilter implements ContextAwareFilterInterface
20
{
21
    /**
22
     * {@inheritdoc}
23
     */
24
    public function apply(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, string $operationName = null, array $context = [])
25
    {
26
        if (!isset($context['filters']) || !\is_array($context['filters'])) {
27
            parent::apply($queryBuilder, $queryNameGenerator, $resourceClass, $operationName, $context);
28
29
            return;
30
        }
31
32
        foreach ($context['filters'] as $property => $value) {
33
            $this->filterProperty($this->denormalizePropertyName($property), $value, $queryBuilder, $queryNameGenerator, $resourceClass, $operationName, $context);
0 ignored issues
show
The call to ApiPlatform\Core\Bridge\...ilter::filterProperty() has too many arguments starting with $context. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

33
            $this->/** @scrutinizer ignore-call */ 
34
                   filterProperty($this->denormalizePropertyName($property), $value, $queryBuilder, $queryNameGenerator, $resourceClass, $operationName, $context);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
34
        }
35
    }
36
}
37