@@ -21,7 +21,7 @@ |
||
| 21 | 21 | if (is_object($callable)) { |
| 22 | 22 | return $callable; |
| 23 | 23 | } |
| 24 | - return function () use ($callable) { |
|
| 24 | + return function() use ($callable) { |
|
| 25 | 25 | return call_user_func_array($callable, func_get_args()); |
| 26 | 26 | }; |
| 27 | 27 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | public function map(callable $callable) |
| 71 | 71 | { |
| 72 | 72 | $function = $this->normalizeAsCallables($callable); |
| 73 | - $mapping = function ($iterator) use ($function) { |
|
| 73 | + $mapping = function($iterator) use ($function) { |
|
| 74 | 74 | foreach ($iterator as $key => $item) { |
| 75 | 75 | yield $key => $function($item); |
| 76 | 76 | } |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | public function filter(callable $callable) |
| 85 | 85 | { |
| 86 | 86 | $function = $this->normalizeAsCallables($callable); |
| 87 | - $filter = function ($iterator) use ($function) { |
|
| 87 | + $filter = function($iterator) use ($function) { |
|
| 88 | 88 | foreach ($iterator as $key => $item) { |
| 89 | 89 | if ($function($item)) { |
| 90 | 90 | yield $item; |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | public function reject(callable $callable) |
| 113 | 113 | { |
| 114 | 114 | $function = $this->normalizeAsCallables($callable); |
| 115 | - $rejection = function ($iterator) use ($function) { |
|
| 115 | + $rejection = function($iterator) use ($function) { |
|
| 116 | 116 | foreach ($iterator as $key => $item) { |
| 117 | 117 | if (!$function($item)) { |
| 118 | 118 | yield $item; |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | */ |
| 128 | 128 | public function merge(...$collections) |
| 129 | 129 | { |
| 130 | - $merging = function (...$iterators) { |
|
| 130 | + $merging = function(...$iterators) { |
|
| 131 | 131 | foreach ($iterators as $iterator) { |
| 132 | 132 | foreach ($iterator as $item) { |
| 133 | 133 | yield $item; |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | $function = $this->normalizeAsCallables($callable); |
| 112 | 112 | return new static(array_filter( |
| 113 | 113 | $this->getArrayCopy(), |
| 114 | - function ($item) use ($function) { |
|
| 114 | + function($item) use ($function) { |
|
| 115 | 115 | return !$function($item); |
| 116 | 116 | } |
| 117 | 117 | )); |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | */ |
| 186 | 186 | public function merge(...$collections) |
| 187 | 187 | { |
| 188 | - $values = array_map(function (CollectionInterface $collection) { |
|
| 188 | + $values = array_map(function(CollectionInterface $collection) { |
|
| 189 | 189 | return $collection->values(); |
| 190 | 190 | }, $collections); |
| 191 | 191 | return new static(array_merge($this->values(), ...$values)); |
@@ -200,14 +200,14 @@ discard block |
||
| 200 | 200 | $results = []; |
| 201 | 201 | foreach ($this->values() as $key => $value) { |
| 202 | 202 | $groupKeys = $function($value, $key); |
| 203 | - if (! is_array($groupKeys)) { |
|
| 203 | + if (!is_array($groupKeys)) { |
|
| 204 | 204 | $groupKeys = [$groupKeys]; |
| 205 | 205 | } |
| 206 | 206 | foreach ($groupKeys as $groupKey) { |
| 207 | 207 | if (!in_array(gettype($groupKey), ['string', 'int'])) { |
| 208 | 208 | $groupKey = (int) $groupKey; |
| 209 | 209 | } |
| 210 | - if (! array_key_exists($groupKey, $results)) { |
|
| 210 | + if (!array_key_exists($groupKey, $results)) { |
|
| 211 | 211 | $results[$groupKey] = new static; |
| 212 | 212 | } |
| 213 | 213 | $results[$groupKey]->offsetSet($preserveKeys ? $key : null, $value); |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | public function concat() |
| 225 | 225 | { |
| 226 | 226 | return $this->reduce( |
| 227 | - function (CollectionInterface $accumulator, Collection $item) { |
|
| 227 | + function(CollectionInterface $accumulator, Collection $item) { |
|
| 228 | 228 | if ($item instanceof Collection) { |
| 229 | 229 | $accumulator = $accumulator->merge($item); |
| 230 | 230 | } |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | { |
| 88 | 88 | $validateItem = static::validateItem($itemType); |
| 89 | 89 | array_map( |
| 90 | - function ($item) use ($validateItem) { |
|
| 90 | + function($item) use ($validateItem) { |
|
| 91 | 91 | $validateItem($item); |
| 92 | 92 | }, |
| 93 | 93 | $items |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | protected static function validateItem($type) |
| 104 | 104 | { |
| 105 | - return function ($item) use ($type) { |
|
| 105 | + return function($item) use ($type) { |
|
| 106 | 106 | if (!is_object($item)) { |
| 107 | 107 | throw new \InvalidArgumentException(sprintf('Invalid type [%s], expected [%s].', gettype($item), $type)); |
| 108 | 108 | } |