@@ -4,7 +4,7 @@ |
||
| 4 | 4 | use Baethon\Phln\Phln as P; |
| 5 | 5 | use function Baethon\Phln\assert_object; |
| 6 | 6 | |
| 7 | -P::macro('keys', function ($object): array { |
|
| 7 | +P::macro('keys', function($object): array { |
|
| 8 | 8 | assert_object($object); |
| 9 | 9 | |
| 10 | 10 | $value = is_object($object) |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | use Baethon\Phln\Phln as P; |
| 5 | 5 | use function Baethon\Phln\assert_object; |
| 6 | 6 | |
| 7 | -P::macro('prop', function ($key, $object) { |
|
| 7 | +P::macro('prop', function($key, $object) { |
|
| 8 | 8 | assert_object($object); |
| 9 | 9 | |
| 10 | 10 | return is_object($object) |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | use Baethon\Phln\Phln as P; |
| 5 | 5 | use function Baethon\Phln\assert_object; |
| 6 | 6 | |
| 7 | -P::macro('propEq', function (string $prop, $value, $object): bool { |
|
| 7 | +P::macro('propEq', function(string $prop, $value, $object): bool { |
|
| 8 | 8 | assert_object($object); |
| 9 | 9 | |
| 10 | 10 | return P::apply( |
@@ -7,17 +7,17 @@ discard block |
||
| 7 | 7 | load_macro('type', 'is'); |
| 8 | 8 | load_macro('logic', 'cond'); |
| 9 | 9 | |
| 10 | -P::macro('both', call_user_func(function () { |
|
| 10 | +P::macro('both', call_user_func(function() { |
|
| 11 | 11 | $allPrimitives = P::unapply(P::all(P::is('bool'))); |
| 12 | 12 | $allCallables = P::unapply(P::all(P::is('callable'))); |
| 13 | 13 | |
| 14 | - $bothPredicate = function ($left, $right) { |
|
| 15 | - return function (...$args) use ($left, $right) { |
|
| 14 | + $bothPredicate = function($left, $right) { |
|
| 15 | + return function(...$args) use ($left, $right) { |
|
| 16 | 16 | return $left(...$args) && $right(...$args); |
| 17 | 17 | }; |
| 18 | 18 | }; |
| 19 | 19 | |
| 20 | - $compareBooleans = function ($left, $right) { |
|
| 20 | + $compareBooleans = function($left, $right) { |
|
| 21 | 21 | return $left && $right; |
| 22 | 22 | }; |
| 23 | 23 | |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | [P::otherwise(), P::throwException(\InvalidArgumentException::class, [])], |
| 28 | 28 | ]); |
| 29 | 29 | |
| 30 | - return function ($left, $right) use ($both) { |
|
| 30 | + return function($left, $right) use ($both) { |
|
| 31 | 31 | return $both($left, $right); |
| 32 | 32 | }; |
| 33 | 33 | })); |
@@ -6,16 +6,16 @@ discard block |
||
| 6 | 6 | |
| 7 | 7 | load_macro('type', 'is'); |
| 8 | 8 | |
| 9 | -P::macro('either', call_user_func(function () { |
|
| 9 | +P::macro('either', call_user_func(function() { |
|
| 10 | 10 | $allPrimitives = P::unapply(P::all(P::is('bool'))); |
| 11 | 11 | $allCallables = P::unapply(P::all(P::is('callable'))); |
| 12 | 12 | |
| 13 | - $compareBooleans = function ($left, $right) { |
|
| 13 | + $compareBooleans = function($left, $right) { |
|
| 14 | 14 | return $left || $right; |
| 15 | 15 | }; |
| 16 | 16 | |
| 17 | - $eitherPredicate = function ($left, $right) { |
|
| 18 | - return function (...$args) use ($left, $right) { |
|
| 17 | + $eitherPredicate = function($left, $right) { |
|
| 18 | + return function(...$args) use ($left, $right) { |
|
| 19 | 19 | return $left(...$args) || $right(...$args); |
| 20 | 20 | }; |
| 21 | 21 | }; |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | [P::otherwise(), P::throwException(\InvalidArgumentException::class, [])], |
| 27 | 27 | ]); |
| 28 | 28 | |
| 29 | - return function ($left, $right) use ($either) { |
|
| 29 | + return function($left, $right) use ($either) { |
|
| 30 | 30 | return $either($left, $right); |
| 31 | 31 | }; |
| 32 | 32 | })); |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | load_macro('collection', 'reduce'); |
| 9 | 9 | |
| 10 | 10 | P::macro('collapse', P::reduce( |
| 11 | - function ($carry, $item) { |
|
| 11 | + function($carry, $item) { |
|
| 12 | 12 | return is_array($item) |
| 13 | 13 | ? array_merge($carry, $item) |
| 14 | 14 | : P::append($item, $carry); |
@@ -7,7 +7,7 @@ |
||
| 7 | 7 | load_macro('collection', 'reduce'); |
| 8 | 8 | |
| 9 | 9 | P::macro('fromPairs', P::reduce( |
| 10 | - function ($carry, $item) { |
|
| 10 | + function($carry, $item) { |
|
| 11 | 11 | list ($key, $value) = $item; |
| 12 | 12 | |
| 13 | 13 | return array_merge($carry, [$key => $value]); |
@@ -4,13 +4,13 @@ |
||
| 4 | 4 | use Baethon\Phln\Phln as P; |
| 5 | 5 | use function Baethon\Phln\assert_object; |
| 6 | 6 | |
| 7 | -P::macro('props', function (array $props, $object): array { |
|
| 7 | +P::macro('props', function(array $props, $object): array { |
|
| 8 | 8 | assert_object($object); |
| 9 | 9 | |
| 10 | 10 | $getProp = P::partial(P::prop(), [P::__, $object]); |
| 11 | 11 | |
| 12 | 12 | return P::reduce( |
| 13 | - function ($carry, $prop) use ($getProp) { |
|
| 13 | + function($carry, $prop) use ($getProp) { |
|
| 14 | 14 | return P::append($getProp($prop), $carry); |
| 15 | 15 | }, |
| 16 | 16 | [], |
@@ -3,8 +3,8 @@ |
||
| 3 | 3 | |
| 4 | 4 | use Baethon\Phln\Phln as P; |
| 5 | 5 | |
| 6 | -P::macro('invoker', function (int $arity, string $method): callable { |
|
| 7 | - $wrapper = function (...$args) use ($arity, $method) { |
|
| 6 | +P::macro('invoker', function(int $arity, string $method): callable { |
|
| 7 | + $wrapper = function(...$args) use ($arity, $method) { |
|
| 8 | 8 | $args = array_slice($args, 0, $arity + 1); |
| 9 | 9 | $object = array_pop($args); |
| 10 | 10 | |