| Conditions | 5 |
| Paths | 3 |
| Total Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 30 |
| Changes | 0 | ||
| 1 | <?php |
||
| 48 | public static function mergeRecursiveDistinct(array &$array1, array &$array2) |
||
| 49 | { |
||
| 50 | $merged = $array1; |
||
| 51 | |||
| 52 | foreach ($array2 as $key => &$value) { |
||
| 53 | if (\is_array($value) && isset($merged[$key]) && \is_array($merged[$key])) { |
||
| 54 | $merged[$key] = self::mergeRecursiveDistinct($merged[$key], $value); |
||
| 55 | } else { |
||
| 56 | $merged[$key] = $value; |
||
| 57 | } |
||
| 58 | } |
||
| 59 | |||
| 60 | return $merged; |
||
| 61 | } |
||
| 62 | } |
||
| 63 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)or! empty(...)instead.