| Conditions | 4 |
| Paths | 3 |
| Total Lines | 21 |
| Code Lines | 12 |
| Lines | 21 |
| Ratio | 100 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 31 | View Code Duplication | public function addPermissionsCriterion(Criterion &$criterion) |
|
| 32 | { |
||
| 33 | $permissionCriterion = $this->getPermissionsCriterion(); |
||
| 34 | if ($permissionCriterion === true || $permissionCriterion === false) { |
||
| 35 | return $permissionCriterion; |
||
| 36 | } |
||
| 37 | |||
| 38 | // Merge with original $criterion |
||
| 39 | if ($criterion instanceof LogicalAnd) { |
||
| 40 | $criterion->criteria[] = $permissionCriterion; |
||
| 41 | } else { |
||
| 42 | $criterion = new LogicalAnd( |
||
| 43 | array( |
||
|
|
|||
| 44 | $criterion, |
||
| 45 | $permissionCriterion, |
||
| 46 | ) |
||
| 47 | ); |
||
| 48 | } |
||
| 49 | |||
| 50 | return true; |
||
| 51 | } |
||
| 52 | } |
||
| 53 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: