@@ -51,8 +51,12 @@ discard block |
||
| 51 | 51 | if(!function_exists('iterable_to_array')) { |
| 52 | 52 | function iterable_to_array(?iterable $it): array |
| 53 | 53 | { |
| 54 | - if(null === $it) return []; |
|
| 55 | - if (is_array($it)) return $it; |
|
| 54 | + if(null === $it) { |
|
| 55 | + return []; |
|
| 56 | + } |
|
| 57 | + if (is_array($it)) { |
|
| 58 | + return $it; |
|
| 59 | + } |
|
| 56 | 60 | $ret = []; |
| 57 | 61 | array_push($ret, ...$it); |
| 58 | 62 | return $ret; |
@@ -62,7 +66,9 @@ discard block |
||
| 62 | 66 | |
| 63 | 67 | function iterable_to_traversable(?iterable $it): Traversable |
| 64 | 68 | { |
| 65 | - if(null === $it) $it = []; |
|
| 69 | + if(null === $it) { |
|
| 70 | + $it = []; |
|
| 71 | + } |
|
| 66 | 72 | yield from $it; |
| 67 | 73 | } |
| 68 | 74 | } |
| 69 | 75 | \ No newline at end of file |