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 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\PathResolver; |
||
15 | |||
16 | use ApiPlatform\Core\Operation\DashPathSegmentNameGenerator; |
||
17 | |||
18 | /** |
||
19 | * Generates a path with words separated by underscores. |
||
20 | * |
||
21 | * @author Paul Le Corre <[email protected]> |
||
22 | */ |
||
23 | View Code Duplication | final class DashOperationPathResolver implements OperationPathResolverInterface |
|
24 | { |
||
25 | /** |
||
26 | * {@inheritdoc} |
||
27 | */ |
||
28 | public function resolveOperationPath(string $resourceShortName, array $operation, $operationType/*, string $operationName = null*/): string |
||
29 | { |
||
30 | @trigger_error(sprintf('The use of %s is deprecated since 2.1. Please use PathSegmentNameGenerator instead.', __CLASS__), E_USER_DEPRECATED); |
||
31 | |||
32 | if (func_num_args() >= 4) { |
||
33 | $operationName = func_get_arg(3); |
||
34 | } else { |
||
35 | $operationName = null; |
||
36 | } |
||
37 | |||
38 | return (new OperationPathResolver(new DashPathSegmentNameGenerator()))->resolveOperationPath($resourceShortName, $operation, $operationType, $operationName); |
||
0 ignored issues
–
show
|
|||
39 | } |
||
40 | } |
||
41 |
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.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.