@@ -42,10 +42,10 @@ |
||
@@ -24,11 +24,11 @@ |
||
| 24 | 24 | */ |
| 25 | 25 | function curryN(int $n, callable $fn, array $args = []) |
| 26 | 26 | { |
| 27 | - $argumentsLengthMatch = function (array $arguments) use ($n) { |
|
| 27 | + $argumentsLengthMatch = function(array $arguments) use ($n) { |
|
| 28 | 28 | return count($arguments) >= $n; |
| 29 | 29 | }; |
| 30 | 30 | |
| 31 | - $wrapper = function (...$wrapperArguments) use ($fn, $args, $argumentsLengthMatch, $n) { |
|
| 31 | + $wrapper = function(...$wrapperArguments) use ($fn, $args, $argumentsLengthMatch, $n) { |
|
| 32 | 32 | $combined = array_merge($args, $wrapperArguments); |
| 33 | 33 | return $argumentsLengthMatch($combined) ? $fn(...$combined) : curryN($n, $fn, $combined); |
| 34 | 34 | }; |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | */ |
| 22 | 22 | function throwException(string $exception = \Exception::class, array $args = []): \Closure |
| 23 | 23 | { |
| 24 | - return function () use ($exception, $args) { |
|
| 24 | + return function() use ($exception, $args) { |
|
| 25 | 25 | throw new $exception(...$args); |
| 26 | 26 | }; |
| 27 | 27 | } |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | |
| 32 | 32 | function |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | */ |
| 22 | 22 | function negate(callable $predicate): \Closure |
| 23 | 23 | { |
| 24 | - return function (...$args) use ($predicate) { |
|
| 24 | + return function(...$args) use ($predicate) { |
|
| 25 | 25 | return !$predicate(...$args); |
| 26 | 26 | }; |
| 27 | 27 | } |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | |
| 31 | 31 | function |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | function swap(callable $f): \Closure |
| 22 | 22 | { |
| 23 | - return function ($second, $first, ...$tail) use ($f) { |
|
| 23 | + return function($second, $first, ...$tail) use ($f) { |
|
| 24 | 24 | $arguments = array_merge([$first, $second], $tail); |
| 25 | 25 | return $f(...$arguments); |
| 26 | 26 | }; |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | function always($value): \Closure |
| 21 | 21 | { |
| 22 | - return function () use ($value) { |
|
| 22 | + return function() use ($value) { |
|
| 23 | 23 | return $value; |
| 24 | 24 | }; |
| 25 | 25 | } |
@@ -23,11 +23,11 @@ |
||
| 23 | 23 | throw new \UnderflowException('pipe requires at least one argument'); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - return function (...$args) use ($fns) { |
|
| 26 | + return function(...$args) use ($fns) { |
|
| 27 | 27 | $head = $fns[0]; |
| 28 | 28 | $tail = array_slice($fns, 1); |
| 29 | 29 | |
| 30 | - return array_reduce($tail, function ($carry, callable $fn) { |
|
| 30 | + return array_reduce($tail, function($carry, callable $fn) { |
|
| 31 | 31 | return $fn($carry); |
| 32 | 32 | }, $head(... $args)); |
| 33 | 33 | }; |