@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public static function shuffle(): Closure |
23 | 23 | { |
24 | - return static function (Collection $collection): Collection { |
|
24 | + return static function(Collection $collection): Collection { |
|
25 | 25 | $array = $collection->toArray(); |
26 | 26 | shuffle($array); |
27 | 27 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public static function random(int $count = 1): Closure |
38 | 38 | { |
39 | - return static function (Collection $collection) use ($count): Collection { |
|
39 | + return static function(Collection $collection) use ($count): Collection { |
|
40 | 40 | /** |
41 | 41 | * Collection |
42 | 42 | */ |
@@ -56,11 +56,11 @@ discard block |
||
56 | 56 | $generated = 0; |
57 | 57 | $multiplicity = (int)round($collectionSize / $expectedCount); |
58 | 58 | |
59 | - $rangeRandomizer = static function () use ($multiplicity): int { |
|
59 | + $rangeRandomizer = static function() use ($multiplicity): int { |
|
60 | 60 | return random_int(0, $multiplicity - 1); |
61 | 61 | }; |
62 | 62 | |
63 | - $trier = static function () use (& $generated, & $rest, $expectedCount, $rangeRandomizer): bool { |
|
63 | + $trier = static function() use (& $generated, & $rest, $expectedCount, $rangeRandomizer): bool { |
|
64 | 64 | $rest--; |
65 | 65 | if ($generated === $expectedCount) { |
66 | 66 | return false; |
@@ -89,13 +89,13 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public static function chunk(int $size): Closure |
91 | 91 | { |
92 | - return static function (Collection $collection) use ($size): Collection { |
|
92 | + return static function(Collection $collection) use ($size): Collection { |
|
93 | 93 | $chunkCollection = self::collectionConstructor(); |
94 | 94 | $currentChunk = self::collectionConstructor(); |
95 | 95 | $pointer = $size; |
96 | 96 | $collection |
97 | 97 | ->stream() |
98 | - ->each(static function ($el) use ($size, $chunkCollection, & $currentChunk, & $pointer) { |
|
98 | + ->each(static function($el) use ($size, $chunkCollection, & $currentChunk, & $pointer) { |
|
99 | 99 | $pointer--; |
100 | 100 | $currentChunk->add($el); |
101 | 101 | |
@@ -116,8 +116,8 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public static function collapse(): Closure |
118 | 118 | { |
119 | - return static function (Collection $collection): Collection { |
|
120 | - $flatIterable = static function (iterable $collection) use (& $flatIterable): array { |
|
119 | + return static function(Collection $collection): Collection { |
|
120 | + $flatIterable = static function(iterable $collection) use (& $flatIterable): array { |
|
121 | 121 | $res = []; |
122 | 122 | foreach ($collection as $item) { |
123 | 123 | if (is_iterable($item)) { |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | */ |
16 | 16 | public static function scalarComparator(): Closure |
17 | 17 | { |
18 | - return static function ($a, $b) { |
|
18 | + return static function($a, $b) { |
|
19 | 19 | return $a <=> $b; |
20 | 20 | }; |
21 | 21 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public static function objectPropertyComparator(string $property): Closure |
29 | 29 | { |
30 | - return static function ($a, $b) use ($property) { |
|
30 | + return static function($a, $b) use ($property) { |
|
31 | 31 | return ObjectFunctions::getPropertyValue($a, $property) <=> ObjectFunctions::getPropertyValue($b, $property); |
32 | 32 | }; |
33 | 33 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public static function callbackComparator(callable $f): Closure |
41 | 41 | { |
42 | - return static function ($a, $b) use ($f) { |
|
42 | + return static function($a, $b) use ($f) { |
|
43 | 43 | return $f($a) <=> $f($b); |
44 | 44 | }; |
45 | 45 | } |