@@ -37,7 +37,7 @@ |
||
37 | 37 | */ |
38 | 38 | function cond(array $pairs): \Closure |
39 | 39 | { |
40 | - return function (... $args) use ($pairs) { |
|
40 | + return function(... $args) use ($pairs) { |
|
41 | 41 | $callPredicate = partial(apply, [__, $args]); |
42 | 42 | $pairMatchingArgs = compose([$callPredicate, nth(0)]); |
43 | 43 | $getTransformer = pipe([ |
@@ -34,9 +34,9 @@ |
||
34 | 34 | reduce(max, 0), |
35 | 35 | ]); |
36 | 36 | |
37 | - return curryN($getArity($predicates), function (... $values) use ($predicates) { |
|
37 | + return curryN($getArity($predicates), function(... $values) use ($predicates) { |
|
38 | 38 | return reduce( |
39 | - function ($carry, callable $p) use ($values) { |
|
39 | + function($carry, callable $p) use ($values) { |
|
40 | 40 | return (false === $carry) ? false : $p(...$values); |
41 | 41 | }, |
42 | 42 | true, |
@@ -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 | } |
@@ -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 | } |
@@ -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 | }; |
@@ -20,11 +20,11 @@ |
||
20 | 20 | */ |
21 | 21 | function once(callable $fn): \Closure |
22 | 22 | { |
23 | - return function (... $args) use ($fn) { |
|
23 | + return function(... $args) use ($fn) { |
|
24 | 24 | static $result; |
25 | 25 | |
26 | 26 | if (false === is_object($result)) { |
27 | - $result = (object)['result' => $fn(... $args)]; |
|
27 | + $result = (object) ['result' => $fn(... $args)]; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | return $result->result; |