@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | public static function lock(): Closure |
| 19 | 19 | { |
| 20 | - return static function (): bool { |
|
| 20 | + return static function(): bool { |
|
| 21 | 21 | return false; |
| 22 | 22 | }; |
| 23 | 23 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | public static function notNull(): Closure |
| 30 | 30 | { |
| 31 | - return static function ($el): bool { |
|
| 31 | + return static function($el): bool { |
|
| 32 | 32 | return $el !== null; |
| 33 | 33 | }; |
| 34 | 34 | } |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | public static function notResistance(): Closure |
| 41 | 41 | { |
| 42 | - return static function (): bool { |
|
| 42 | + return static function(): bool { |
|
| 43 | 43 | return true; |
| 44 | 44 | }; |
| 45 | 45 | } |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | public static function eachEven(): Closure |
| 52 | 52 | { |
| 53 | 53 | $isEven = false; |
| 54 | - return static function () use (& $isEven) { |
|
| 54 | + return static function() use (& $isEven) { |
|
| 55 | 55 | $res = $isEven; |
| 56 | 56 | $isEven = !$isEven; |
| 57 | 57 | |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | public static function nth($number): Closure |
| 68 | 68 | { |
| 69 | 69 | $counter = 0; |
| 70 | - return static function () use ($number, & $counter) { |
|
| 70 | + return static function() use ($number, & $counter) { |
|
| 71 | 71 | $res = ++$counter % $number === 0; |
| 72 | 72 | if ($res) { |
| 73 | 73 | $counter = 0; |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | public static function equal($value): Closure |
| 85 | 85 | { |
| 86 | - return static function ($el) use ($value): bool { |
|
| 86 | + return static function($el) use ($value): bool { |
|
| 87 | 87 | return $el === $value; |
| 88 | 88 | }; |
| 89 | 89 | } |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | public static function lockDuplicated(?callable $caster = null): Closure |
| 95 | 95 | { |
| 96 | 96 | $set = new HashSet(); |
| 97 | - return static function ($el) use ($set, $caster): bool { |
|
| 97 | + return static function($el) use ($set, $caster): bool { |
|
| 98 | 98 | $el = isset($caster) ? $caster($el) : $el; |
| 99 | 99 | $res = !$set->contains($el); |
| 100 | 100 | $set->add($el); |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | public static function lessThan($value): Closure |
| 111 | 111 | { |
| 112 | - return static function ($el) use ($value): bool { |
|
| 112 | + return static function($el) use ($value): bool { |
|
| 113 | 113 | return $el < $value; |
| 114 | 114 | }; |
| 115 | 115 | } |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | */ |
| 122 | 122 | public static function lessOrEqual($value): Closure |
| 123 | 123 | { |
| 124 | - return static function ($el) use ($value): bool { |
|
| 124 | + return static function($el) use ($value): bool { |
|
| 125 | 125 | return $el <= $value; |
| 126 | 126 | }; |
| 127 | 127 | } |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | */ |
| 134 | 134 | public static function greaterThan($value): Closure |
| 135 | 135 | { |
| 136 | - return static function ($el) use ($value): bool { |
|
| 136 | + return static function($el) use ($value): bool { |
|
| 137 | 137 | return $el > $value; |
| 138 | 138 | }; |
| 139 | 139 | } |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | */ |
| 146 | 146 | public static function greaterOrEqual($value): Closure |
| 147 | 147 | { |
| 148 | - return static function ($el) use ($value): bool { |
|
| 148 | + return static function($el) use ($value): bool { |
|
| 149 | 149 | return $el >= $value; |
| 150 | 150 | }; |
| 151 | 151 | } |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | */ |
| 158 | 158 | public static function not($value): Closure |
| 159 | 159 | { |
| 160 | - return static function ($el) use ($value): bool { |
|
| 160 | + return static function($el) use ($value): bool { |
|
| 161 | 161 | return $el !== $value; |
| 162 | 162 | }; |
| 163 | 163 | } |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | */ |
| 170 | 170 | public static function in(array $values): Closure |
| 171 | 171 | { |
| 172 | - return static function ($el) use ($values): bool { |
|
| 172 | + return static function($el) use ($values): bool { |
|
| 173 | 173 | return in_array($el, $values, true); |
| 174 | 174 | }; |
| 175 | 175 | } |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | */ |
| 182 | 182 | public static function notIn(array $values): Closure |
| 183 | 183 | { |
| 184 | - return static function ($el) use ($values): bool { |
|
| 184 | + return static function($el) use ($values): bool { |
|
| 185 | 185 | return !in_array($el, $values, true); |
| 186 | 186 | }; |
| 187 | 187 | } |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | */ |
| 195 | 195 | public static function where(string $property, $value): Closure |
| 196 | 196 | { |
| 197 | - return static function ($ob) use ($property, $value) { |
|
| 197 | + return static function($ob) use ($property, $value) { |
|
| 198 | 198 | return $value === ObjectFunctions::getPropertyValue($ob, $property); |
| 199 | 199 | }; |
| 200 | 200 | } |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | */ |
| 208 | 208 | public static function whereNot(string $property, $value): Closure |
| 209 | 209 | { |
| 210 | - return static function ($ob) use ($property, $value) { |
|
| 210 | + return static function($ob) use ($property, $value) { |
|
| 211 | 211 | return $value !== ObjectFunctions::getPropertyValue($ob, $property); |
| 212 | 212 | }; |
| 213 | 213 | } |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | */ |
| 221 | 221 | public static function whereIn(string $property, array $values): Closure |
| 222 | 222 | { |
| 223 | - return static function ($ob) use ($property, $values) { |
|
| 223 | + return static function($ob) use ($property, $values) { |
|
| 224 | 224 | return in_array(ObjectFunctions::getPropertyValue($ob, $property), $values, true); |
| 225 | 225 | }; |
| 226 | 226 | } |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | */ |
| 234 | 234 | public static function whereNotIn(string $property, array $values): Closure |
| 235 | 235 | { |
| 236 | - return static function ($ob) use ($property, $values) { |
|
| 236 | + return static function($ob) use ($property, $values) { |
|
| 237 | 237 | return !in_array(ObjectFunctions::getPropertyValue($ob, $property), $values, true); |
| 238 | 238 | }; |
| 239 | 239 | } |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | */ |
| 247 | 247 | public static function whereGreaterThan(string $property, $value): Closure |
| 248 | 248 | { |
| 249 | - return static function ($ob) use ($property, $value) { |
|
| 249 | + return static function($ob) use ($property, $value) { |
|
| 250 | 250 | return ObjectFunctions::getPropertyValue($ob, $property) > $value; |
| 251 | 251 | }; |
| 252 | 252 | } |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | */ |
| 260 | 260 | public static function whereLessThan(string $property, $value): Closure |
| 261 | 261 | { |
| 262 | - return static function ($ob) use ($property, $value) { |
|
| 262 | + return static function($ob) use ($property, $value) { |
|
| 263 | 263 | return ObjectFunctions::getPropertyValue($ob, $property) < $value; |
| 264 | 264 | }; |
| 265 | 265 | } |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | */ |
| 273 | 273 | public static function whereGreaterOrEqual(string $property, $value): Closure |
| 274 | 274 | { |
| 275 | - return static function ($ob) use ($property, $value) { |
|
| 275 | + return static function($ob) use ($property, $value) { |
|
| 276 | 276 | return ObjectFunctions::getPropertyValue($ob, $property) >= $value; |
| 277 | 277 | }; |
| 278 | 278 | } |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | */ |
| 286 | 286 | public static function whereLessOrEqual(string $property, $value): Closure |
| 287 | 287 | { |
| 288 | - return static function ($ob) use ($property, $value) { |
|
| 288 | + return static function($ob) use ($property, $value) { |
|
| 289 | 289 | return ObjectFunctions::getPropertyValue($ob, $property) <= $value; |
| 290 | 290 | }; |
| 291 | 291 | } |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | public static function first(): Closure |
| 298 | 298 | { |
| 299 | 299 | $runOut = false; |
| 300 | - return static function () use (& $runOut) { |
|
| 300 | + return static function() use (& $runOut) { |
|
| 301 | 301 | if ($runOut) { |
| 302 | 302 | return false; |
| 303 | 303 | } |
@@ -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 | |
@@ -120,8 +120,8 @@ discard block |
||
| 120 | 120 | if ($depth === 0) { |
| 121 | 121 | $depth = null; |
| 122 | 122 | } |
| 123 | - return static function (Collection $collection) use ($depth): Collection { |
|
| 124 | - $flatIterable = static function (iterable $collection, $depth) use (& $flatIterable): array { |
|
| 123 | + return static function(Collection $collection) use ($depth): Collection { |
|
| 124 | + $flatIterable = static function(iterable $collection, $depth) use (& $flatIterable): array { |
|
| 125 | 125 | $goToDepth = $depth > 0 || $depth === null; |
| 126 | 126 | if ($depth !== null) { |
| 127 | 127 | $depth--; |