@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | * @param callable $fn |
| 89 | 89 | * @param int $argsCount |
| 90 | 90 | * @param array $boundArgs |
| 91 | - * @return callable |
|
| 91 | + * @return \Closure |
|
| 92 | 92 | */ |
| 93 | 93 | function _curried_function($fn, $argsCount, $boundArgs = []) { |
| 94 | 94 | return function() use($fn, $argsCount, $boundArgs) { |
@@ -158,8 +158,6 @@ discard block |
||
| 158 | 158 | * ``` |
| 159 | 159 | * |
| 160 | 160 | * @signature (*... -> a) -> [*] -> a |
| 161 | - * @param callable $fn |
|
| 162 | - * @param array $args |
|
| 163 | 161 | * @return mixed |
| 164 | 162 | */ |
| 165 | 163 | function apply() { |
@@ -181,7 +179,7 @@ discard block |
||
| 181 | 179 | * |
| 182 | 180 | * @signature (((a, b, ...) -> o), (o -> p), ..., (y -> z)) -> ((a, b, ...) -> z) |
| 183 | 181 | * @param callable ...$fns |
| 184 | - * @return callable |
|
| 182 | + * @return \Closure |
|
| 185 | 183 | */ |
| 186 | 184 | function pipe() { |
| 187 | 185 | $fns = func_get_args(); |
@@ -57,8 +57,9 @@ discard block |
||
| 57 | 57 | $restCount = $allArgsCount - $fnArgsCount; |
| 58 | 58 | while($placeholdersCount > 0 && $k < $restCount) { |
| 59 | 59 | $arg = $rest[$k]; |
| 60 | - while(! _is_placeholder($args[$i])) |
|
| 61 | - $i++; |
|
| 60 | + while(! _is_placeholder($args[$i])) { |
|
| 61 | + $i++; |
|
| 62 | + } |
|
| 62 | 63 | if (! _is_placeholder($arg)) { |
| 63 | 64 | $args[$i] = $arg; |
| 64 | 65 | $placeholdersCount --; |
@@ -93,8 +94,9 @@ discard block |
||
| 93 | 94 | function _curried_function($fn, $argsCount, $boundArgs = []) { |
| 94 | 95 | return function() use($fn, $argsCount, $boundArgs) { |
| 95 | 96 | $merged = _merge_args($argsCount, $boundArgs, func_get_args()); |
| 96 | - if ($merged['count'] >= $argsCount) |
|
| 97 | - return call_user_func_array($fn, $merged['args']); |
|
| 97 | + if ($merged['count'] >= $argsCount) { |
|
| 98 | + return call_user_func_array($fn, $merged['args']); |
|
| 99 | + } |
|
| 98 | 100 | return _curried_function($fn, $argsCount, $merged['args']); |
| 99 | 101 | }; |
| 100 | 102 | } |
@@ -185,8 +187,9 @@ discard block |
||
| 185 | 187 | */ |
| 186 | 188 | function pipe() { |
| 187 | 189 | $fns = func_get_args(); |
| 188 | - if(count($fns) < 1) |
|
| 189 | - throw new InvalidArgument("pipe() requires at least one argument"); |
|
| 190 | + if(count($fns) < 1) { |
|
| 191 | + throw new InvalidArgument("pipe() requires at least one argument"); |
|
| 192 | + } |
|
| 190 | 193 | return curry(function () use ($fns) { |
| 191 | 194 | $result = _apply(array_shift($fns), func_get_args()); |
| 192 | 195 | foreach ($fns as $fn) { |
@@ -19,7 +19,6 @@ discard block |
||
| 19 | 19 | * ``` |
| 20 | 20 | * |
| 21 | 21 | * @signature a -> a |
| 22 | - * @param mixed $value |
|
| 23 | 22 | * @return mixed |
| 24 | 23 | */ |
| 25 | 24 | function clone_() { |
@@ -74,7 +73,6 @@ discard block |
||
| 74 | 73 | * ``` |
| 75 | 74 | * |
| 76 | 75 | * @signature {k: v} -> {k: v} |
| 77 | - * @param object $object |
|
| 78 | 76 | * @return array |
| 79 | 77 | */ |
| 80 | 78 | function attributes() { |
@@ -150,8 +148,6 @@ discard block |
||
| 150 | 148 | * ``` |
| 151 | 149 | * |
| 152 | 150 | * @signature k -> {k: v} -> Boolean |
| 153 | - * @param string|int $name |
|
| 154 | - * @param mixed $object |
|
| 155 | 151 | * @return bool |
| 156 | 152 | */ |
| 157 | 153 | function has() { |
@@ -180,8 +176,6 @@ discard block |
||
| 180 | 176 | * ``` |
| 181 | 177 | * |
| 182 | 178 | * @signature k -> {k: v} -> Maybe(v) |
| 183 | - * @param string $name |
|
| 184 | - * @param array $object |
|
| 185 | 179 | * @return mixed |
| 186 | 180 | */ |
| 187 | 181 | function get() { |
@@ -208,8 +202,6 @@ discard block |
||
| 208 | 202 | * ``` |
| 209 | 203 | * |
| 210 | 204 | * @signature [k] -> {k: v} -> v |
| 211 | - * @param array $path |
|
| 212 | - * @param mixed $object |
|
| 213 | 205 | * @return mixed |
| 214 | 206 | */ |
| 215 | 207 | function getPath() { |
@@ -232,9 +224,6 @@ discard block |
||
| 232 | 224 | * ``` |
| 233 | 225 | * |
| 234 | 226 | * @signature k -> v -> {k: v} -> {k: v} |
| 235 | - * @param string|int $name |
|
| 236 | - * @param mixed $value |
|
| 237 | - * @param mixed $object |
|
| 238 | 227 | * @return mixed |
| 239 | 228 | */ |
| 240 | 229 | function set() { |
@@ -257,9 +246,6 @@ discard block |
||
| 257 | 246 | * ``` |
| 258 | 247 | * |
| 259 | 248 | * @signature (a -> Boolean) -> k -> {k : a} -> Boolean |
| 260 | - * @param callable $predicate |
|
| 261 | - * @param string|int $key |
|
| 262 | - * @param mixed $object |
|
| 263 | 249 | * @return bool |
| 264 | 250 | */ |
| 265 | 251 | function check() { |
@@ -8,8 +8,6 @@ discard block |
||
| 8 | 8 | * Returns `$a && $b`. |
| 9 | 9 | * |
| 10 | 10 | * @signature Boolean -> Boolean -> Boolean |
| 11 | - * @param bool $a |
|
| 12 | - * @param bool $b |
|
| 13 | 11 | * @return bool |
| 14 | 12 | */ |
| 15 | 13 | function and_() { |
@@ -22,8 +20,6 @@ discard block |
||
| 22 | 20 | * Returns `$a || $b`. |
| 23 | 21 | * |
| 24 | 22 | * @signature Boolean -> Boolean -> Boolean |
| 25 | - * @param bool $a |
|
| 26 | - * @param bool $b |
|
| 27 | 23 | * @return bool |
| 28 | 24 | */ |
| 29 | 25 | function or_() { |
@@ -36,7 +32,6 @@ discard block |
||
| 36 | 32 | * Returns `!$x`. |
| 37 | 33 | * |
| 38 | 34 | * @signature Boolean -> Boolean |
| 39 | - * @param bool $x |
|
| 40 | 35 | * @return bool |
| 41 | 36 | */ |
| 42 | 37 | function not() { |
@@ -50,8 +45,6 @@ discard block |
||
| 50 | 45 | * Returns `$x == $y`. |
| 51 | 46 | * |
| 52 | 47 | * @signature * -> * -> Boolean |
| 53 | - * @param mixed $a |
|
| 54 | - * @param mixed $b |
|
| 55 | 48 | * @return bool |
| 56 | 49 | */ |
| 57 | 50 | function eq() { |
@@ -64,8 +57,6 @@ discard block |
||
| 64 | 57 | * Returns `$x != $y`. |
| 65 | 58 | * |
| 66 | 59 | * @signature * -> * -> Boolean |
| 67 | - * @param mixed $a |
|
| 68 | - * @param mixed $b |
|
| 69 | 60 | * @return bool |
| 70 | 61 | */ |
| 71 | 62 | function notEq() { |
@@ -78,8 +69,6 @@ discard block |
||
| 78 | 69 | * Returns `$x === $y`. |
| 79 | 70 | * |
| 80 | 71 | * @signature * -> * -> Boolean |
| 81 | - * @param mixed $a |
|
| 82 | - * @param mixed $b |
|
| 83 | 72 | * @return bool |
| 84 | 73 | */ |
| 85 | 74 | function eqq() { |
@@ -92,8 +81,6 @@ discard block |
||
| 92 | 81 | * Returns `$x !== $y`. |
| 93 | 82 | * |
| 94 | 83 | * @signature * -> * -> Boolean |
| 95 | - * @param mixed $a |
|
| 96 | - * @param mixed $b |
|
| 97 | 84 | * @return bool |
| 98 | 85 | */ |
| 99 | 86 | function notEqq() { |
@@ -118,8 +105,6 @@ discard block |
||
| 118 | 105 | * ``` |
| 119 | 106 | * |
| 120 | 107 | * @signature * -> * -> Boolean |
| 121 | - * @param mixed $a |
|
| 122 | - * @param mixed $b |
|
| 123 | 108 | * @return bool |
| 124 | 109 | */ |
| 125 | 110 | function equals() { |
@@ -157,8 +142,6 @@ discard block |
||
| 157 | 142 | * Returns `$a < $b`. |
| 158 | 143 | * |
| 159 | 144 | * @signature * -> * -> Boolean |
| 160 | - * @param mixed $a |
|
| 161 | - * @param mixed $b |
|
| 162 | 145 | * @return bool |
| 163 | 146 | */ |
| 164 | 147 | function lt() { |
@@ -171,8 +154,6 @@ discard block |
||
| 171 | 154 | * Returns `$a <= $b`. |
| 172 | 155 | * |
| 173 | 156 | * @signature * -> * -> Boolean |
| 174 | - * @param mixed $a |
|
| 175 | - * @param mixed $b |
|
| 176 | 157 | * @return bool |
| 177 | 158 | */ |
| 178 | 159 | function lte() { |
@@ -185,8 +166,6 @@ discard block |
||
| 185 | 166 | * Returns `$a > $b`. |
| 186 | 167 | * |
| 187 | 168 | * @signature * -> * -> Boolean |
| 188 | - * @param mixed $a |
|
| 189 | - * @param mixed $b |
|
| 190 | 169 | * @return bool |
| 191 | 170 | */ |
| 192 | 171 | function gt() { |
@@ -199,8 +178,6 @@ discard block |
||
| 199 | 178 | * Returns `$a >= $b`. |
| 200 | 179 | * |
| 201 | 180 | * @signature * -> * -> Boolean |
| 202 | - * @param mixed $a |
|
| 203 | - * @param mixed $b |
|
| 204 | 181 | * @return bool |
| 205 | 182 | */ |
| 206 | 183 | function gte() { |
@@ -11,8 +11,9 @@ |
||
| 11 | 11 | private function __construct(){} |
| 12 | 12 | public static function get() |
| 13 | 13 | { |
| 14 | - if(static::$instance === null) |
|
| 15 | - static::$instance = new Placeholder; |
|
| 14 | + if(static::$instance === null) { |
|
| 15 | + static::$instance = new Placeholder; |
|
| 16 | + } |
|
| 16 | 17 | return static::$instance; |
| 17 | 18 | } |
| 18 | 19 | public function __toString(){ |
@@ -14,8 +14,9 @@ |
||
| 14 | 14 | function curriedFunction($fn, $argsCount, $boundArgs = []) { |
| 15 | 15 | return function() use($fn, $argsCount, $boundArgs) { |
| 16 | 16 | $boundArgs = array_merge($boundArgs, func_get_args()); |
| 17 | - if (count($boundArgs) >= $argsCount) |
|
| 18 | - return call_user_func_array($fn, $boundArgs); |
|
| 17 | + if (count($boundArgs) >= $argsCount) { |
|
| 18 | + return call_user_func_array($fn, $boundArgs); |
|
| 19 | + } |
|
| 19 | 20 | return curriedFunction($fn, $argsCount, $boundArgs); |
| 20 | 21 | }; |
| 21 | 22 | } |