| Conditions | 5 |
| Paths | 6 |
| Total Lines | 28 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 24 | public function populate( |
||
| 25 | FormModel $model, |
||
| 26 | mixed $data, |
||
| 27 | array $map = [], |
||
| 28 | bool $strict = false, |
||
| 29 | ?string $scope = null |
||
| 30 | ): bool { |
||
| 31 | if (!is_array($data)) { |
||
| 32 | return false; |
||
| 33 | } |
||
| 34 | |||
| 35 | $scope ??= $model->getFormName(); |
||
| 36 | if ($scope === '') { |
||
| 37 | $hydrateData = $data; |
||
| 38 | } else { |
||
| 39 | if (!isset($data[$scope])) { |
||
| 40 | return false; |
||
| 41 | } |
||
| 42 | $hydrateData = $data[$scope]; |
||
| 43 | } |
||
| 44 | |||
| 45 | if (!is_array($hydrateData)) { |
||
| 46 | return false; |
||
| 47 | } |
||
| 48 | |||
| 49 | $this->hydrator->hydrate($model, $hydrateData, $map, $strict); |
||
|
|
|||
| 50 | |||
| 51 | return true; |
||
| 52 | } |
||
| 54 |
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.