1 | <?php |
||
13 | class ForeachProcessor extends AbstractProcessor |
||
14 | { |
||
15 | public const DEFAULT_IGNORE_MISSING_VALUE = false; |
||
16 | |||
17 | /** |
||
18 | * @param AbstractProcessor|array $processor |
||
19 | */ |
||
20 | public function __construct(string $field, $processor) |
||
32 | |||
33 | /** |
||
34 | * Set field. |
||
35 | * |
||
36 | * @return $this |
||
37 | */ |
||
38 | public function setField(string $field): self |
||
42 | |||
43 | /** |
||
44 | * Set processor. |
||
45 | * |
||
46 | * @return $this |
||
47 | */ |
||
48 | public function setProcessor(AbstractProcessor $processor): self |
||
52 | |||
53 | /** |
||
54 | * Set raw processor. |
||
55 | * Example : ['remove' => ['field' => 'user_agent']]. |
||
56 | * |
||
57 | * @return $this |
||
58 | */ |
||
59 | public function setRawProcessor(array $processor): self |
||
63 | |||
64 | /** |
||
65 | * Set ignore_missing. Default value false. |
||
66 | * |
||
67 | * If true and field does not exist or is null, the processor quietly exits without modifying the document |
||
68 | * |
||
69 | * @return $this |
||
70 | */ |
||
71 | public function setIgnoreMissing(bool $ignoreMissing): self |
||
75 | } |
||
76 |
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.