Conditions | 4 |
Paths | 4 |
Total Lines | 18 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
22 | public function create(AdminResource $definition): AdminResource |
||
23 | { |
||
24 | $resource = $this->decorated->create($definition); |
||
25 | $errors = $this->validator->validate($resource, [new AdminValid(), new Valid()]); |
||
26 | |||
27 | if ($errors->count() > 0) { |
||
28 | throw new InvalidAdminException($resource->getName(), $errors); |
||
29 | } |
||
30 | |||
31 | foreach ($resource->getOperations() as $operation) { |
||
32 | $errors = $this->validator->validate($operation, [new Valid()]); |
||
33 | |||
34 | if ($errors->count() > 0) { |
||
35 | throw new InvalidOperationException($resource->getName(), $operation->getName(), $errors); |
||
|
|||
36 | } |
||
37 | } |
||
38 | |||
39 | return $resource; |
||
40 | } |
||
42 |
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.