| Conditions | 3 |
| Paths | 2 |
| Total Lines | 16 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 3.0175 |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 20 | 5 | public function compile(QueryBuilder $parentQueryBuilder): string |
|
| 21 | { |
||
| 22 | 5 | $this->expression->registerVariable($parentQueryBuilder->getVariables()); |
|
| 23 | |||
| 24 | 5 | $this->expression = $this->expression->compile($parentQueryBuilder); |
|
|
|
|||
| 25 | |||
| 26 | 5 | $parentQueryBuilder->binds = array_unique(array_merge($parentQueryBuilder->binds, $this->expression->binds)); |
|
| 27 | |||
| 28 | // Extract collections |
||
| 29 | 5 | if (isset($this->expression->collections)) { |
|
| 30 | 5 | foreach ($this->expression->collections as $collection => $mode) { |
|
| 31 | $parentQueryBuilder->registerCollections($this->expression->collections[$collection], $mode); |
||
| 32 | } |
||
| 33 | } |
||
| 34 | |||
| 35 | 5 | return '(' . $this->expression . ')'; |
|
| 36 | } |
||
| 38 |
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.