Completed
Branch master (a31674)
by Radosław
02:21
created
src/macros/logic/allPass.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -6,16 +6,16 @@
 block discarded – undo
6 6
 
7 7
 load_macro('relation', 'max');
8 8
 
9
-P::macro('allPass', call_user_func(function () {
9
+P::macro('allPass', call_user_func(function() {
10 10
     $getArity = P::pipe([
11 11
         P::map(P::raw('arity')),
12 12
         P::reduce(P::max(), 0),
13 13
     ]);
14 14
 
15
-    return function (array $predicates) use ($getArity): callable {
16
-        return P::curryN($getArity($predicates), function (...$values) use ($predicates) {
15
+    return function(array $predicates) use ($getArity): callable {
16
+        return P::curryN($getArity($predicates), function(...$values) use ($predicates) {
17 17
             return P::reduce(
18
-                function ($carry, callable $p) use ($values) {
18
+                function($carry, callable $p) use ($values) {
19 19
                     return (false === $carry) ? false : $p(...$values);
20 20
                 },
21 21
                 true,
Please login to merge, or discard this patch.
src/macros/logic/both.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,17 +7,17 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 }));
Please login to merge, or discard this patch.
src/macros/logic/either.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -6,16 +6,16 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 }));
Please login to merge, or discard this patch.
src/macros/logic/cond.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@
 block discarded – undo
3 3
 
4 4
 use Baethon\Phln\Phln as P;
5 5
 
6
-P::macro('cond', function (array $pairs): \Closure {
7
-    return function (... $args) use ($pairs) {
6
+P::macro('cond', function(array $pairs): \Closure {
7
+    return function(... $args) use ($pairs) {
8 8
         $callPredicate = P::partialRight(P::apply(), [$args]);
9 9
         $pairMatchingArgs = P::compose([$callPredicate, P::nth(0)]);
10 10
         $getTransformer = P::pipe([
Please login to merge, or discard this patch.
src/macros/collection/collapse.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
src/macros/collection/concat.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,9 +9,9 @@
 block discarded – undo
9 9
 load_macro('relation', 'equals');
10 10
 load_macro('fn', ['T', 'unapply', 'compose', 'throwException']);
11 11
 
12
-P::macro('concat', call_user_func(function () {
12
+P::macro('concat', call_user_func(function() {
13 13
     $argsToTypes = P::unapply(P::map('\\gettype'));
14
-    $matchesType = function (string $type) use ($argsToTypes) {
14
+    $matchesType = function(string $type) use ($argsToTypes) {
15 15
         return P::compose([P::equals([$type, $type]), $argsToTypes]);
16 16
     };
17 17
 
Please login to merge, or discard this patch.
src/macros/collection/fromPairs.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
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]);
Please login to merge, or discard this patch.
src/macros/collection/head.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
 load_macro('type', ['typeCond', 'is']);
11 11
 load_macro('collection', ['slice', 'length', 'nth']);
12 12
 
13
-P::macro('head', call_user_func(function () {
13
+P::macro('head', call_user_func(function() {
14 14
     $sliceFirst = P::slice(0, 1);
15 15
     $moreThanZero = P::compose([P::lte(1), P::length()]);
16 16
     $headOfArray = P::cond([
Please login to merge, or discard this patch.
src/macros/collection/last.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
 
7 7
 load_macro('logic', 'isEmpty');
8 8
 
9
-P::macro('last', call_user_func(function () {
9
+P::macro('last', call_user_func(function() {
10 10
     $lastElement = P::slice(-1, 1);
11 11
     $lastOfArray = P::pipe([
12 12
         $lastElement,
Please login to merge, or discard this patch.