Completed
Push — master ( 24fea9...77ab9c )
by Amine
01:44
created
build.php 3 patches
Doc Comments   -3 removed lines patch added patch discarded remove patch
@@ -634,8 +634,6 @@  discard block
 block discarded – undo
634 634
  * Gets an element of the stream methods list.
635 635
  *
636 636
  * @signature String -> Block -> String
637
- * @param  string $moduleName
638
- * @param  object $block
639 637
  * @return string
640 638
  */
641 639
 function stream_method_link() {
@@ -661,7 +659,6 @@  discard block
 block discarded – undo
661 659
  * Dump a variable and returns it.
662 660
  *
663 661
  * @signature a -> a
664
- * @param  mixed $something
665 662
  * @return mixed
666 663
  */
667 664
 function log() {
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
  * @return array
117 117
  */
118 118
 function get_modules() {
119
-    $composer = json_decode(file_get_contents(__DIR__.'/composer.json'));
119
+    $composer = json_decode(file_get_contents(__DIR__ . '/composer.json'));
120 120
     return $composer->autoload->files;
121 121
 }
122 122
 
@@ -147,10 +147,10 @@  discard block
 block discarded – undo
147 147
  */
148 148
 function write_module($module) {
149 149
     if ($module->docs) {
150
-        $docsDir  = dirname($module->docsPath);
150
+        $docsDir = dirname($module->docsPath);
151 151
         if (!is_dir($docsDir))
152 152
             mkdir($docsDir, 0777, true);
153
-        file_put_contents($module->docsPath,  $module->docs);
153
+        file_put_contents($module->docsPath, $module->docs);
154 154
     }
155 155
     if ($module->tests) {
156 156
         $testsDir = dirname($module->testsPath);
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
         'fill_docs_path',
180 180
         'fill_tests_path',
181 181
         'fill_blocks'
182
-    ]), [(object)['path' => $path]]);
182
+    ]), [(object) ['path' => $path]]);
183 183
 }
184 184
 
185 185
 /**
@@ -233,8 +233,8 @@  discard block
 block discarded – undo
233 233
 function fill_blocks($module) {
234 234
     $module->blocks = apply(pipe(
235 235
         prepend('dox -r < '), // "dox -r < src/...php"
236
-        'shell_exec',         // "[{...}, ...]"
237
-        'json_decode',        // [DoxBlock]
236
+        'shell_exec', // "[{...}, ...]"
237
+        'json_decode', // [DoxBlock]
238 238
         map(_f('make_block'))
239 239
         // sort()
240 240
     ), [$module->path]);
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
     if (has('class', $tags)) $type = 'class';
257 257
     if (has('method', $tags)) $type = 'method';
258 258
 
259
-    $params = map(function($tag){
259
+    $params = map(function($tag) {
260 260
         $parts = split(' ', get('value', $tag));
261 261
         return [
262 262
             'type' => $parts[0],
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
  */
293 293
 function tags_of($doxBlock) {
294 294
     if ($doxBlock->tags)
295
-        return map(function($tag){
295
+        return map(function($tag) {
296 296
             return (object) [
297 297
                 'name'  => $tag->type,
298 298
                 'value' => $tag->string
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
  * @return object
342 342
  */
343 343
 function generate_docs_sommaire($module) {
344
-    $blocks = filter (
344
+    $blocks = filter(
345 345
         satisfiesAll(['ignore' => not(), 'internal' => not(), 'type' => equals('function')]),
346 346
         $module->blocks
347 347
     );
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
  * @return object
372 372
  */
373 373
 function generate_docs_contents($module) {
374
-    $blocks = filter (
374
+    $blocks = filter(
375 375
         satisfiesAll(['ignore' => not(), 'internal' => not()]),
376 376
         $module->blocks
377 377
     );
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
     $additionalNamespace = replace("/", "\\", remove(6, dirname($module->testsPath)));
430 430
     if ($additionalNamespace)
431 431
         $namespace .= "\\" . $additionalNamespace;
432
-    $name = remove(-4, last(split("/", $module->testsPath)));
432
+    $name = remove(- 4, last(split("/", $module->testsPath)));
433 433
     $module->tests .= "<?php namespace {$namespace};\n\nuse Tarsana\Functional as F;\n\nclass {$name} extends \Tarsana\UnitTests\Functional\UnitTest {\n";
434 434
     return $module;
435 435
 }
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
  * @return object
443 443
  */
444 444
 function generate_tests_contents($module) {
445
-    $blocks = filter (
445
+    $blocks = filter(
446 446
         satisfiesAll(['ignore' => not()]),
447 447
         $module->blocks
448 448
     );
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
     if (!contains('```php', $description))
500 500
         return '';
501 501
     $code = remove(7 + indexOf('```php', $description), $description);
502
-    return remove(-4, trim($code));
502
+    return remove(- 4, trim($code));
503 503
 }
504 504
 
505 505
 /**
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
  * @return array
553 553
  */
554 554
 function generate_stream_operations($module) {
555
-    $blocks = filter (
555
+    $blocks = filter(
556 556
         satisfiesAll(['ignore' => equals(false), 'stream' => equals(true)]),
557 557
         $module->blocks
558 558
     );
@@ -621,7 +621,7 @@  discard block
 block discarded – undo
621 621
  * @return array
622 622
  */
623 623
 function generate_stream_methods($module) {
624
-    $blocks = filter (
624
+    $blocks = filter(
625 625
         satisfiesAll(['ignore' => equals(false), 'stream' => equals(true)]),
626 626
         $module->blocks
627 627
     );
Please login to merge, or discard this patch.
Braces   +55 added lines, -37 removed lines patch added patch discarded remove patch
@@ -148,14 +148,16 @@  discard block
 block discarded – undo
148 148
 function write_module($module) {
149 149
     if ($module->docs) {
150 150
         $docsDir  = dirname($module->docsPath);
151
-        if (!is_dir($docsDir))
152
-            mkdir($docsDir, 0777, true);
151
+        if (!is_dir($docsDir)) {
152
+                    mkdir($docsDir, 0777, true);
153
+        }
153 154
         file_put_contents($module->docsPath,  $module->docs);
154 155
     }
155 156
     if ($module->tests) {
156 157
         $testsDir = dirname($module->testsPath);
157
-        if (!is_dir($testsDir))
158
-            mkdir($testsDir, 0777, true);
158
+        if (!is_dir($testsDir)) {
159
+                    mkdir($testsDir, 0777, true);
160
+        }
159 161
         file_put_contents($module->testsPath, $module->tests);
160 162
     }
161 163
     if ($module->streamOperations) {
@@ -252,9 +254,15 @@  discard block
 block discarded – undo
252 254
     $tags = groupBy(get('name'), tags_of($doxBlock));
253 255
 
254 256
     $type = 'function';
255
-    if (has('file', $tags)) $type = 'file';
256
-    if (has('class', $tags)) $type = 'class';
257
-    if (has('method', $tags)) $type = 'method';
257
+    if (has('file', $tags)) {
258
+        $type = 'file';
259
+    }
260
+    if (has('class', $tags)) {
261
+        $type = 'class';
262
+    }
263
+    if (has('method', $tags)) {
264
+        $type = 'method';
265
+    }
258 266
 
259 267
     $params = map(function($tag){
260 268
         $parts = split(' ', get('value', $tag));
@@ -266,8 +274,9 @@  discard block
 block discarded – undo
266 274
 
267 275
     $return = getPath(['return', 0, 'value'], $tags);
268 276
     $signatures = get('signature', $tags);
269
-    if ($signatures)
270
-        $signatures = map(get('value'), $signatures);
277
+    if ($signatures) {
278
+            $signatures = map(get('value'), $signatures);
279
+    }
271 280
     return (object) [
272 281
         'type' => $type,
273 282
         'name' => getPath(['ctx', 'name'], $doxBlock),
@@ -291,12 +300,13 @@  discard block
 block discarded – undo
291 300
  * @return array
292 301
  */
293 302
 function tags_of($doxBlock) {
294
-    if ($doxBlock->tags)
295
-        return map(function($tag){
303
+    if ($doxBlock->tags) {
304
+            return map(function($tag){
296 305
             return (object) [
297 306
                 'name'  => $tag->type,
298 307
                 'value' => $tag->string
299 308
             ];
309
+    }
300 310
         }, $doxBlock->tags);
301 311
     return [];
302 312
 }
@@ -310,8 +320,9 @@  discard block
 block discarded – undo
310 320
  */
311 321
 function generate_docs($module) {
312 322
     $module->docs = '';
313
-    if (startsWith('_', $module->name))
314
-        return $module;
323
+    if (startsWith('_', $module->name)) {
324
+            return $module;
325
+    }
315 326
     return apply(process_of([
316 327
         'generate_docs_header',
317 328
         'generate_docs_sommaire',
@@ -388,15 +399,17 @@  discard block
 block discarded – undo
388 399
  * @return string
389 400
  */
390 401
 function generate_docs_contents_item($block) {
391
-    if ($block->type != 'function')
392
-        return '';
402
+    if ($block->type != 'function') {
403
+            return '';
404
+    }
393 405
     $params = join(', ', map(pipe(values(), join(' ')), get('params', $block)));
394 406
     $return = get('return', $block);
395 407
     $prototype = "```php\n{$block->name}({$params}) : {$return}\n```\n\n";
396 408
     $signature = '';
397 409
     $blockSignature = join("\n", $block->signatures);
398
-    if ($blockSignature)
399
-        $signature = "```\n{$blockSignature}\n```\n\n";
410
+    if ($blockSignature) {
411
+            $signature = "```\n{$blockSignature}\n```\n\n";
412
+    }
400 413
     return "# {$block->name}\n\n{$prototype}{$signature}{$block->description}\n\n";
401 414
 }
402 415
 
@@ -427,8 +440,9 @@  discard block
 block discarded – undo
427 440
 function generate_tests_header($module) {
428 441
     $namespace = "Tarsana\UnitTests\Functional";
429 442
     $additionalNamespace = replace("/", "\\", remove(6, dirname($module->testsPath)));
430
-    if ($additionalNamespace)
431
-        $namespace .= "\\" . $additionalNamespace;
443
+    if ($additionalNamespace) {
444
+            $namespace .= "\\" . $additionalNamespace;
445
+    }
432 446
     $name = remove(-4, last(split("/", $module->testsPath)));
433 447
     $module->tests .= "<?php namespace {$namespace};\n\nuse Tarsana\Functional as F;\n\nclass {$name} extends \Tarsana\UnitTests\Functional\UnitTest {\n";
434 448
     return $module;
@@ -449,10 +463,11 @@  discard block
 block discarded – undo
449 463
     $contents = join("\n", map(function($block) use($module) {
450 464
         return generate_tests_contents_item($block, $module);
451 465
     }, $blocks));
452
-    if (trim($contents) != '')
453
-        $module->tests .= $contents;
454
-    else
455
-        $module->tests = '';
466
+    if (trim($contents) != '') {
467
+            $module->tests .= $contents;
468
+    } else {
469
+            $module->tests = '';
470
+    }
456 471
     return $module;
457 472
 }
458 473
 
@@ -465,8 +480,9 @@  discard block
 block discarded – undo
465 480
  * @return string
466 481
  */
467 482
 function generate_tests_contents_item($block, $module) {
468
-    if ($block->type != 'function')
469
-        return '';
483
+    if ($block->type != 'function') {
484
+            return '';
485
+    }
470 486
 
471 487
     $code = apply(pipe(
472 488
         _f('code_from_description'),
@@ -480,8 +496,9 @@  discard block
 block discarded – undo
480 496
         join("\n")
481 497
     ), [$block]);
482 498
 
483
-    if ('' == trim($code))
484
-        return '';
499
+    if ('' == trim($code)) {
500
+            return '';
501
+    }
485 502
     return prepend("\tpublic function test_{$block->name}() {\n",
486 503
         append("\n\t}\n", $code)
487 504
     );
@@ -496,8 +513,9 @@  discard block
 block discarded – undo
496 513
  */
497 514
 function code_from_description($block) {
498 515
     $description = get('description', $block);
499
-    if (!contains('```php', $description))
500
-        return '';
516
+    if (!contains('```php', $description)) {
517
+            return '';
518
+    }
501 519
     $code = remove(7 + indexOf('```php', $description), $description);
502 520
     return remove(-4, trim($code));
503 521
 }
@@ -513,8 +531,7 @@  discard block
 block discarded – undo
513 531
     if (contains('; //=> ', $part)) {
514 532
         $pieces = split('; //=> ', $part);
515 533
         $part = "\$this->assertEquals({$pieces[1]}, {$pieces[0]});";
516
-    }
517
-    elseif (contains('; // throws ', $part)) {
534
+    } elseif (contains('; // throws ', $part)) {
518 535
         $pieces = split('; // throws ', $part);
519 536
         $variables = match('/ \$[0-9a-zA-Z_]+/', $pieces[0]);
520 537
         $use = '';
@@ -523,8 +540,7 @@  discard block
 block discarded – undo
523 540
             $use = "use({$variables}) ";
524 541
         }
525 542
         return "\$this->assertErrorThrown(function() {$use}{\n\t$pieces[0]; \n},\n{$pieces[1]});";
526
-    }
527
-    elseif (startsWith('class ', $part) || startsWith('function ', $part)) {
543
+    } elseif (startsWith('class ', $part) || startsWith('function ', $part)) {
528 544
         $module->testsFooter .= $part . "\n\n";
529 545
         $part = '';
530 546
     }
@@ -539,8 +555,9 @@  discard block
 block discarded – undo
539 555
  * @return object
540 556
  */
541 557
 function generate_tests_footer($module) {
542
-    if ($module->tests)
543
-        $module->tests .= "}\n\n{$module->testsFooter}";
558
+    if ($module->tests) {
559
+            $module->tests .= "}\n\n{$module->testsFooter}";
560
+    }
544 561
     return $module;
545 562
 }
546 563
 
@@ -676,8 +693,9 @@  discard block
 block discarded – undo
676 693
 
677 694
 // Convert Warnings to Exceptions
678 695
 set_error_handler(function($errno, $errstr, $errfile, $errline, array $errcontext) {
679
-    if (0 === error_reporting())
680
-        return false;
696
+    if (0 === error_reporting()) {
697
+            return false;
698
+    }
681 699
     throw new \ErrorException($errstr, 0, $errno, $errfile, $errline);
682 700
 });
683 701
 
Please login to merge, or discard this patch.
src/common.php 3 patches
Doc Comments   -4 removed lines patch added patch discarded remove patch
@@ -26,7 +26,6 @@  discard block
 block discarded – undo
26 26
  * ```
27 27
  *
28 28
  * @signature * -> String
29
- * @param  mixed $data
30 29
  * @return string
31 30
  */
32 31
 function type() {
@@ -73,8 +72,6 @@  discard block
 block discarded – undo
73 72
  *
74 73
  * @stream
75 74
  * @signature String -> * -> Boolean
76
- * @param  string $type
77
- * @param  mixed $data
78 75
  * @return boolean
79 76
  */
80 77
 function is() {
@@ -109,7 +106,6 @@  discard block
 block discarded – undo
109 106
  *
110 107
  * @stream
111 108
  * @signature * -> String
112
- * @param  mixed $something
113 109
  * @return string
114 110
  */
115 111
 function toString () {
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
  * @param  mixed $something
115 115
  * @return string
116 116
  */
117
-function toString () {
117
+function toString() {
118 118
     static $toString = false;
119 119
     $toString = $toString ?: curry(function($something) {
120 120
         switch (type($something)) {
@@ -137,11 +137,11 @@  discard block
 block discarded – undo
137 137
                 return $something->__toString();
138 138
             case 'Object':
139 139
             case 'Array':
140
-                return '{' . join(', ', map(function($pair){
141
-                    return $pair[0].': '. toString($pair[1]);
140
+                return '{' . join(', ', map(function($pair) {
141
+                    return $pair[0] . ': ' . toString($pair[1]);
142 142
                 }, toPairs($something))) . '}';
143 143
             default:
144
-                return '['.type($something).']';
144
+                return '[' . type($something) . ']';
145 145
         }
146 146
     });
147 147
     return _apply($toString, func_get_args());
Please login to merge, or discard this patch.
Braces   +12 added lines, -5 removed lines patch added patch discarded remove patch
@@ -33,9 +33,15 @@  discard block
 block discarded – undo
33 33
 function type() {
34 34
     static $type = false;
35 35
     $type = $type ?: _curry_one(function($data) {
36
-        if ($data instanceof Error) return 'Error';
37
-        if ($data instanceof Stream) return 'Stream';
38
-        if (is_callable($data)) return 'Function';
36
+        if ($data instanceof Error) {
37
+            return 'Error';
38
+        }
39
+        if ($data instanceof Stream) {
40
+            return 'Stream';
41
+        }
42
+        if (is_callable($data)) {
43
+            return 'Function';
44
+        }
39 45
         switch (gettype($data)) {
40 46
             case 'boolean':
41 47
                 return 'Boolean';
@@ -49,8 +55,9 @@  discard block
 block discarded – undo
49 55
             case 'resource':
50 56
                 return 'Resource';
51 57
             case 'array':
52
-                if (allSatisfies('is_numeric', keys($data)))
53
-                    return 'List';
58
+                if (allSatisfies('is_numeric', keys($data))) {
59
+                                    return 'List';
60
+                }
54 61
                 return 'Array';
55 62
             case 'object':
56 63
                 return 'Object';
Please login to merge, or discard this patch.
src/Internal/_stream.php 3 patches
Doc Comments   +1 added lines, -6 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
  * Returns supported types in signatures.
41 41
  *
42 42
  * @signature List
43
- * @return array
43
+ * @return string[]
44 44
  */
45 45
 function _stream_types() {
46 46
     return [
@@ -126,7 +126,6 @@  discard block
 block discarded – undo
126 126
  * @signature String -> String -> Maybe(Function) -> Operation
127 127
  * @param  string $name
128 128
  * @param  string $signature
129
- * @param  callable $fn
130 129
  * @return array
131 130
  */
132 131
 function _stream_operation($name, $signature, $callable = null) {
@@ -190,8 +189,6 @@  discard block
 block discarded – undo
190 189
  * F\_stream_ensure_type('List -> Bar', 'Bar'); // throws "Stream: invalid signature 'List -> Bar' it should follow the syntax 'TypeArg1 -> TypeArg2 -> ... -> ReturnType' and types to use are Boolean, Number, String, Resource, Function, List, Array, Object, Any"
191 190
  * ```
192 191
  * @signature String -> String -> String
193
- * @param  string $signature
194
- * @param  string $type
195 192
  * @return string
196 193
  */
197 194
 function _stream_ensure_type() {
@@ -491,8 +488,6 @@  discard block
 block discarded – undo
491 488
  * ```
492 489
  *
493 490
  * @signature [String] -> Operation -> Boolean
494
- * @param  array $argsTypes
495
- * @param  array $operation
496 491
  * @return bool
497 492
  */
498 493
 function _stream_operation_is_applicable() {
Please login to merge, or discard this patch.
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -131,8 +131,9 @@  discard block
 block discarded – undo
131 131
  */
132 132
 function _stream_operation($name, $signature, $callable = null) {
133 133
     $callable = $callable ?: $name;
134
-    if (!is_callable($callable))
135
-        _stream_throw_error('unknown-callable', $callable);
134
+    if (!is_callable($callable)) {
135
+            _stream_throw_error('unknown-callable', $callable);
136
+    }
136 137
 
137 138
     return [
138 139
         'name' => $name,
@@ -163,8 +164,9 @@  discard block
 block discarded – undo
163 164
     // Assuming $text  = 'Number|List -> Number -> String|Array -> Number'
164 165
     $parts = map(pipe(split('|'), map(pipe('trim', _stream_ensure_type($text)))), split('->', $text));
165 166
     // $parts = [['Number', 'List'], ['Number'], ['String', 'Array'], ['Number']]
166
-    if (length($parts) < 2)
167
-        _stream_throw_error('invalid-signature', $text);
167
+    if (length($parts) < 2) {
168
+            _stream_throw_error('invalid-signature', $text);
169
+    }
168 170
 
169 171
     return reduce(function($result, $part){
170 172
         return chain(function($item) use($result){
@@ -196,8 +198,9 @@  discard block
 block discarded – undo
196 198
  */
197 199
 function _stream_ensure_type() {
198 200
     $ensureType = function($signature, $type) {
199
-        if (! contains($type, _stream_types()))
200
-            _stream_throw_error('invalid-signature', $signature);
201
+        if (! contains($type, _stream_types())) {
202
+                    _stream_throw_error('invalid-signature', $signature);
203
+        }
201 204
         return $type;
202 205
     };
203 206
     return apply(curry($ensureType), func_get_args());
@@ -553,8 +556,9 @@  discard block
 block discarded – undo
553 556
  * @return array
554 557
  */
555 558
 function _stream_resolve($stream) {
556
-    if (get('resolved', $stream))
557
-        return $stream;
559
+    if (get('resolved', $stream)) {
560
+            return $stream;
561
+    }
558 562
     $transformations = get('transformations', $stream);
559 563
     $transformation = head($transformations);
560 564
     if (null === $transformation) {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
     if (length($parts) < 2)
168 168
         _stream_throw_error('invalid-signature', $text);
169 169
 
170
-    return reduce(function($result, $part){
170
+    return reduce(function($result, $part) {
171 171
         return chain(function($item) use($result){
172 172
             return map(append($item), $result);
173 173
         }, $part);
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
  */
198 198
 function _stream_ensure_type() {
199 199
     $ensureType = function($signature, $type) {
200
-        if (! contains($type, _stream_types()))
200
+        if (!contains($type, _stream_types()))
201 201
             _stream_throw_error('invalid-signature', $signature);
202 202
         return $type;
203 203
     };
Please login to merge, or discard this patch.
src/math.php 2 patches
Doc Comments   -23 removed lines patch added patch discarded remove patch
@@ -14,8 +14,6 @@  discard block
 block discarded – undo
14 14
  *
15 15
  * @stream
16 16
  * @signature Number -> Number -> Number
17
- * @param  int|float $x
18
- * @param  int|float $y
19 17
  * @return int|float
20 18
  */
21 19
 function plus() {
@@ -35,8 +33,6 @@  discard block
 block discarded – undo
35 33
  *
36 34
  * @stream
37 35
  * @signature Number -> Number -> Number
38
- * @param  int|float $x
39
- * @param  int|float $y
40 36
  * @return int|float
41 37
  */
42 38
 function minus() {
@@ -57,7 +53,6 @@  discard block
 block discarded – undo
57 53
  *
58 54
  * @stream
59 55
  * @signature Number -> Number
60
- * @param  int|float $x
61 56
  * @return int|float
62 57
  */
63 58
 function negate() {
@@ -78,8 +73,6 @@  discard block
 block discarded – undo
78 73
  *
79 74
  * @stream
80 75
  * @signature Number -> Number -> Number
81
- * @param  int|float $x
82
- * @param  int|float $y
83 76
  * @return int|float
84 77
  */
85 78
 function multiply() {
@@ -99,8 +92,6 @@  discard block
 block discarded – undo
99 92
  *
100 93
  * @stream
101 94
  * @signature Number -> Number -> Number
102
- * @param  int|float $x
103
- * @param  int|float $y
104 95
  * @return int|float
105 96
  */
106 97
 function divide() {
@@ -120,8 +111,6 @@  discard block
 block discarded – undo
120 111
  *
121 112
  * @stream
122 113
  * @signature Number -> Number -> Number
123
- * @param  int|float $x
124
- * @param  int|float $y
125 114
  * @return int|float
126 115
  */
127 116
 function modulo() {
@@ -142,7 +131,6 @@  discard block
 block discarded – undo
142 131
  *
143 132
  * @stream
144 133
  * @signature [Number] -> Number
145
- * @param  array $numbers
146 134
  * @return int|float
147 135
  */
148 136
 function sum() {
@@ -163,7 +151,6 @@  discard block
 block discarded – undo
163 151
  *
164 152
  * @stream
165 153
  * @signature [Number] -> Number
166
- * @param  array $numbers
167 154
  * @return int|float
168 155
  */
169 156
 function product() {
@@ -184,8 +171,6 @@  discard block
 block discarded – undo
184 171
  *
185 172
  * @stream
186 173
  * @signature Number -> Number -> Number
187
- * @param  number $a
188
- * @param  number $b
189 174
  * @return number
190 175
  */
191 176
 function min() {
@@ -206,9 +191,6 @@  discard block
 block discarded – undo
206 191
  *
207 192
  * @stream
208 193
  * @signature (a -> Number) -> a -> a -> a
209
- * @param  callable $fn
210
- * @param  mixed $a
211
- * @param  mixed $b
212 194
  * @return mixed
213 195
  */
214 196
 function minBy() {
@@ -229,8 +211,6 @@  discard block
 block discarded – undo
229 211
  *
230 212
  * @stream
231 213
  * @signature Number -> Number -> Number
232
- * @param  number $a
233
- * @param  number $b
234 214
  * @return number
235 215
  */
236 216
 function max() {
@@ -251,9 +231,6 @@  discard block
 block discarded – undo
251 231
  *
252 232
  * @stream
253 233
  * @signature (a -> Number) -> a -> a -> a
254
- * @param  callable $fn
255
- * @param  mixed $a
256
- * @param  mixed $b
257 234
  * @return mixed
258 235
  */
259 236
 function maxBy() {
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
  */
21 21
 function plus() {
22 22
     static $plus = false;
23
-    $plus = $plus ?: curry(function($x, $y){
23
+    $plus = $plus ?: curry(function($x, $y) {
24 24
         return $x + $y;
25 25
     });
26 26
     return _apply($plus, func_get_args());
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
  */
42 42
 function minus() {
43 43
     static $minus = false;
44
-    $minus = $minus ?: curry(function($x, $y){
44
+    $minus = $minus ?: curry(function($x, $y) {
45 45
         return $x - $y;
46 46
     });
47 47
     return _apply($minus, func_get_args());
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
  */
63 63
 function negate() {
64 64
     static $negate = false;
65
-    $negate = $negate ?: curry(function($x){
66
-        return -$x;
65
+    $negate = $negate ?: curry(function($x) {
66
+        return - $x;
67 67
     });
68 68
     return _apply($negate, func_get_args());
69 69
 }
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
  */
85 85
 function multiply() {
86 86
     static $multiply = false;
87
-    $multiply = $multiply ?: curry(function($x, $y){
87
+    $multiply = $multiply ?: curry(function($x, $y) {
88 88
         return $y * $x;
89 89
     });
90 90
     return _apply($multiply, func_get_args());
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
  */
106 106
 function divide() {
107 107
     static $divide = false;
108
-    $divide = $divide ?: curry(function($x, $y){
108
+    $divide = $divide ?: curry(function($x, $y) {
109 109
         return $x / $y;
110 110
     });
111 111
     return _apply($divide, func_get_args());
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
  */
127 127
 function modulo() {
128 128
     static $modulo = false;
129
-    $modulo = $modulo ?: curry(function($x, $y){
129
+    $modulo = $modulo ?: curry(function($x, $y) {
130 130
         return $x % $y;
131 131
     });
132 132
     return _apply($modulo, func_get_args());
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
  */
187 187
 function min() {
188 188
     static $min = false;
189
-    $min = $min ?: curry(function($a, $b){
189
+    $min = $min ?: curry(function($a, $b) {
190 190
         return $a < $b ? $a : $b;
191 191
     });
192 192
     return _apply($min, func_get_args());
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
  */
210 210
 function minBy() {
211 211
     static $minBy = false;
212
-    $minBy = $minBy ?: curry(function($fn, $a, $b){
212
+    $minBy = $minBy ?: curry(function($fn, $a, $b) {
213 213
         return $fn($a) < $fn($b) ? $a : $b;
214 214
     });
215 215
     return _apply($minBy, func_get_args());
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
  */
232 232
 function max() {
233 233
     static $max = false;
234
-    $max = $max ?: curry(function($a, $b){
234
+    $max = $max ?: curry(function($a, $b) {
235 235
         return $a > $b ? $a : $b;
236 236
     });
237 237
     return _apply($max, func_get_args());
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
  */
255 255
 function maxBy() {
256 256
     static $maxBy = false;
257
-    $maxBy = $maxBy ?: curry(function($fn, $a, $b){
257
+    $maxBy = $maxBy ?: curry(function($fn, $a, $b) {
258 258
         return $fn($a) > $fn($b) ? $a : $b;
259 259
     });
260 260
     return _apply($maxBy, func_get_args());
Please login to merge, or discard this patch.
src/string.php 4 patches
Doc Comments   -28 removed lines patch added patch discarded remove patch
@@ -14,8 +14,6 @@  discard block
 block discarded – undo
14 14
  *
15 15
  * @stream
16 16
  * @signature String -> String -> [String]
17
- * @param string $delimiter
18
- * @param string $string
19 17
  * @return array
20 18
  */
21 19
 function split() {
@@ -34,8 +32,6 @@  discard block
 block discarded – undo
34 32
  *
35 33
  * @stream
36 34
  * @signature String -> [String] -> String
37
- * @param string $glue
38
- * @param array $pieces
39 35
  * @return string
40 36
  */
41 37
 function join() {
@@ -59,9 +55,6 @@  discard block
 block discarded – undo
59 55
  *
60 56
  * @stream
61 57
  * @signature String|[String] -> String|[String] -> String -> String
62
- * @param  string $search
63
- * @param  string $replacement
64
- * @param  string $string
65 58
  * @return string
66 59
  */
67 60
 function replace() {
@@ -81,9 +74,6 @@  discard block
 block discarded – undo
81 74
  *
82 75
  * @stream
83 76
  * @signature String -> String -> String -> String
84
- * @param  string $pattern
85
- * @param  string $replacement
86
- * @param  string $string
87 77
  * @return string
88 78
  */
89 79
 function regReplace() {
@@ -101,7 +91,6 @@  discard block
 block discarded – undo
101 91
  *
102 92
  * @stream
103 93
  * @signature String -> String
104
- * @param  string $string
105 94
  * @return string
106 95
  */
107 96
 function upperCase() {
@@ -119,7 +108,6 @@  discard block
 block discarded – undo
119 108
  *
120 109
  * @stream
121 110
  * @signature String -> String
122
- * @param  string $string
123 111
  * @return string
124 112
  */
125 113
 function lowerCase() {
@@ -137,7 +125,6 @@  discard block
 block discarded – undo
137 125
  *
138 126
  * @stream
139 127
  * @signature String -> String
140
- * @param  string $string
141 128
  * @return string
142 129
  */
143 130
 function camelCase() {
@@ -164,8 +151,6 @@  discard block
 block discarded – undo
164 151
  *
165 152
  * @stream
166 153
  * @signature String -> String -> String
167
- * @param  string $delimiter
168
- * @param  string $string
169 154
  * @return string
170 155
  */
171 156
 function snakeCase() {
@@ -194,8 +179,6 @@  discard block
 block discarded – undo
194 179
  *
195 180
  * @stream
196 181
  * @signature String -> String -> Boolean
197
- * @param  string $token
198
- * @param  string $string
199 182
  * @return bool
200 183
  */
201 184
 function startsWith() {
@@ -220,8 +203,6 @@  discard block
 block discarded – undo
220 203
  *
221 204
  * @stream
222 205
  * @signature String -> String -> Boolean
223
- * @param  string $token
224
- * @param  string $string
225 206
  * @return bool
226 207
  */
227 208
 function endsWith() {
@@ -246,8 +227,6 @@  discard block
 block discarded – undo
246 227
  *
247 228
  * @stream
248 229
  * @signature String -> String -> Boolean
249
- * @param  string $pattern
250
- * @param  string $string
251 230
  * @return bool
252 231
  */
253 232
 function test() {
@@ -270,8 +249,6 @@  discard block
 block discarded – undo
270 249
  *
271 250
  * @stream
272 251
  * @signature String -> String -> [String]
273
- * @param  string $pattern
274
- * @param  string $string
275 252
  * @return array
276 253
  */
277 254
 function match() {
@@ -295,8 +272,6 @@  discard block
 block discarded – undo
295 272
  *
296 273
  * @stream
297 274
  * @signature String -> String -> Number
298
- * @param  string $token
299
- * @param  string $text
300 275
  * @return int
301 276
  */
302 277
 function occurences() {
@@ -322,9 +297,6 @@  discard block
 block discarded – undo
322 297
  *
323 298
  * @stream
324 299
  * @signature String -> String -> String -> [String]
325
- * @param  string $surrounders
326
- * @param  string $separator
327
- * @param  sring $text
328 300
  * @return array
329 301
  */
330 302
 function chunks() {
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -336,10 +336,10 @@
 block discarded – undo
336 336
         // $text = 'foo ("bar baz" alpha) beta'
337 337
         $counters = [
338 338
             'values'   => [], // each item of this array refers to the number
339
-                              // of closings needed for an opening
339
+                                // of closings needed for an opening
340 340
             'openings' => [], // an associative array where the key is an opening
341
-                              // and the value is the index of corresponding cell
342
-                              // in the 'values' field
341
+                                // and the value is the index of corresponding cell
342
+                                // in the 'values' field
343 343
             'closings' => [], // associative array for closings like the previous one
344 344
             'total'    => 0   // the total number of needed closings
345 345
         ];
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
  */
47 47
 function join() {
48 48
     static $join = false;
49
-    $join = $join ?: curry(function($glue, $pieces){
49
+    $join = $join ?: curry(function($glue, $pieces) {
50 50
         return implode($glue, $pieces);
51 51
     });
52 52
     return _apply($join, func_get_args());
Please login to merge, or discard this patch.
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -345,10 +345,11 @@  discard block
 block discarded – undo
345 345
         ];
346 346
         foreach (str_split($surrounders) as $key => $char) {
347 347
             $counters['values'][$key / 2] = 0;
348
-            if ($key % 2 == 0)
349
-                $counters['openings'][$char] = $key / 2;
350
-            else
351
-                $counters['closings'][$char] = $key / 2;
348
+            if ($key % 2 == 0) {
349
+                            $counters['openings'][$char] = $key / 2;
350
+            } else {
351
+                            $counters['closings'][$char] = $key / 2;
352
+            }
352 353
         }
353 354
         // $counters = [
354 355
         //   'values'   => [0, 0, 0],
@@ -394,8 +395,9 @@  discard block
 block discarded – undo
394 395
                 $index ++;
395 396
             }
396 397
         }
397
-        if ($buffer != '')
398
-            $result[] = $buffer;
398
+        if ($buffer != '') {
399
+                    $result[] = $buffer;
400
+        }
399 401
 
400 402
         return $result;
401 403
     });
Please login to merge, or discard this patch.
src/Classes/Error.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
      * @param  Error|null $error
19 19
      * @return Error
20 20
      */
21
-    public static function of ($message, $code = 0, Error $error = null)
21
+    public static function of($message, $code = 0, Error $error = null)
22 22
     {
23 23
         return new Error($message, $code, $error);
24 24
     }
Please login to merge, or discard this patch.
src/Classes/Stream.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@
 block discarded – undo
53 53
      */
54 54
     public static function operation($name, $signatures, $fn = null)
55 55
     {
56
-        if (! is_array($signatures)) {
56
+        if (!is_array($signatures)) {
57 57
             $signatures = [$signatures];
58 58
         }
59 59
         foreach ($signatures as $signature) {
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      * Creates a new Stream.
37 37
      *
38 38
      * @param  mixed $data
39
-     * @return Tarsana\Functional\Stream
39
+     * @return Stream
40 40
      */
41 41
     public static function of($data)
42 42
     {
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
      * Adds a new operation to the Stream class.
48 48
      *
49 49
      * @param  string $name
50
-     * @param  string $signature
50
+     * @param  string $signatures
51 51
      * @param  callable $fn
52 52
      * @return void
53 53
      */
@@ -89,7 +89,6 @@  discard block
 block discarded – undo
89 89
     /**
90 90
      * Creates a new Stream with some data.
91 91
      *
92
-     * @param mixed $data
93 92
      */
94 93
     protected function __construct($stream)
95 94
     {
@@ -122,7 +121,7 @@  discard block
 block discarded – undo
122 121
      *
123 122
      * @param  string $name The name of the operation
124 123
      * @param  array  $args
125
-     * @return Tarsana\Functional\Stream
124
+     * @return Stream
126 125
      */
127 126
     public function __call($name, $args)
128 127
     {
Please login to merge, or discard this patch.
performance/run.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 /**
4 4
  * Returns the list of scripts to compare.
5 5
  *
6
- * @return array
6
+ * @return string[]
7 7
  */
8 8
 function scripts() {
9 9
     return [
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
  * and returns its running time in miliseconds.
102 102
  *
103 103
  * @param  string $path
104
- * @return array
104
+ * @return double
105 105
  */
106 106
 function execute($path, $input) {
107 107
     $start = microtime(true);
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -79,8 +79,8 @@
 block discarded – undo
79 79
  */
80 80
 function averageTime($n, $path, $test) {
81 81
     $s = 0;
82
-    for ($i=0; $i < $n; $i++) {
83
-        $s =+ execute($path, $test->input);
82
+    for ($i = 0; $i < $n; $i ++) {
83
+        $s = + execute($path, $test->input);
84 84
     }
85 85
     return $s / $n;
86 86
 }
Please login to merge, or discard this patch.
src/list.php 3 patches
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
  */
100 100
 function reduce() {
101 101
     static $reduce = false;
102
-    $reduce = $reduce ?: curry(function($fn, $initial, $list){
102
+    $reduce = $reduce ?: curry(function($fn, $initial, $list) {
103 103
         return array_reduce($list, $fn, $initial);
104 104
     });
105 105
     return _apply($reduce, func_get_args());
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
  */
127 127
 function each() {
128 128
     static $each = false;
129
-    $each = $each ?: curry(function($fn, $list){
129
+    $each = $each ?: curry(function($fn, $list) {
130 130
         foreach ($list as $item) {
131 131
             $fn($item);
132 132
         }
@@ -176,10 +176,10 @@  discard block
 block discarded – undo
176 176
  * @param  array|string $list
177 177
  * @return mixed
178 178
  */
179
-function last () {
179
+function last() {
180 180
     static $last = false;
181 181
     $last = $last ?: curry(function($list) {
182
-        if(is_string($list))
182
+        if (is_string($list))
183 183
             return substr($list, -1);
184 184
         $size = count($list);
185 185
         return ($size > 0)
@@ -206,10 +206,10 @@  discard block
 block discarded – undo
206 206
  * @param  array|string $list
207 207
  * @return array
208 208
  */
209
-function init () {
209
+function init() {
210 210
     static $init = false;
211 211
     $init = $init ?: curry(function($list) {
212
-        if(is_string($list)) {
212
+        if (is_string($list)) {
213 213
             $size = strlen($list);
214 214
             return ($size > 1)
215 215
                 ? substr($list, 0, $size - 1)
@@ -240,10 +240,10 @@  discard block
 block discarded – undo
240 240
  * @param  array|string $list
241 241
  * @return array
242 242
  */
243
-function tail () {
243
+function tail() {
244 244
     static $tail = false;
245 245
     $tail = $tail ?: curry(function($list) {
246
-        if(is_string($list))
246
+        if (is_string($list))
247 247
             return (strlen($list) > 1)
248 248
                 ? substr($list, 1)
249 249
                 : '';
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
  * @param  array|string $list
269 269
  * @return array
270 270
  */
271
-function reverse () {
271
+function reverse() {
272 272
     static $reverse = false;
273 273
     $reverse = $reverse ?: curry(function($list) {
274 274
         return is_string($list)
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
     static $allSatisfies = false;
322 322
     $allSatisfies = $allSatisfies ?: curry(function($predicate, $list) {
323 323
         foreach ($list as $item) {
324
-            if (! $predicate($item))
324
+            if (!$predicate($item))
325 325
                 return false;
326 326
         }
327 327
         return true;
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
  */
498 498
 function append() {
499 499
     static $append = false;
500
-    $append = $append ?: curry(function ($item, $list) {
500
+    $append = $append ?: curry(function($item, $list) {
501 501
         return is_string($list)
502 502
             ? $list . $item
503 503
             : array_merge($list, [$item]);
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
  */
524 524
 function prepend() {
525 525
     static $prepend = false;
526
-    $prepend = $prepend ?: curry(function ($item, $list) {
526
+    $prepend = $prepend ?: curry(function($item, $list) {
527 527
         return is_string($list)
528 528
             ? $item . $list
529 529
             : array_merge([$item], $list);
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
         $length = length($list);
559 559
         if ($count > $length || $count < -$length)
560 560
             return $list;
561
-        if(is_string($list)) {
561
+        if (is_string($list)) {
562 562
             return ($count >= 0)
563 563
                 ? substr($list, 0, $count)
564 564
                 : substr($list, $count);
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
         $count = ($count > 0)
710 710
             ? $count - $length
711 711
             : $count + $length;
712
-        if(is_string($list)) {
712
+        if (is_string($list)) {
713 713
             return ($count >= 0)
714 714
                 ? substr($list, 0, $count)
715 715
                 : substr($list, $count);
@@ -1066,7 +1066,7 @@  discard block
 block discarded – undo
1066 1066
     $indexOf = $indexOf ?: curry(function($item, $list) {
1067 1067
         if (is_string($list)) {
1068 1068
             $index = strpos($list, $item);
1069
-            return $index === false ? -1 : $index;
1069
+            return $index === false ? - 1 : $index;
1070 1070
         }
1071 1071
         $list = (array) $list;
1072 1072
         $index = 0;
@@ -1077,7 +1077,7 @@  discard block
 block discarded – undo
1077 1077
                 return $keys[$index];
1078 1078
             $index ++;
1079 1079
         }
1080
-        return -1;
1080
+        return - 1;
1081 1081
     });
1082 1082
     return _apply($indexOf, func_get_args());
1083 1083
 }
@@ -1106,7 +1106,7 @@  discard block
 block discarded – undo
1106 1106
     $lastIndexOf = $lastIndexOf ?: curry(function($item, $list) {
1107 1107
         if (is_string($list)) {
1108 1108
             $index = strrpos($list, $item);
1109
-            return $index === false ? -1 : $index;
1109
+            return $index === false ? - 1 : $index;
1110 1110
         }
1111 1111
         $list = (array) $list;
1112 1112
         $keys = array_keys($list);
@@ -1116,7 +1116,7 @@  discard block
 block discarded – undo
1116 1116
                 return $keys[$index];
1117 1117
             $index --;
1118 1118
         }
1119
-        return -1;
1119
+        return - 1;
1120 1120
     });
1121 1121
     return _apply($lastIndexOf, func_get_args());
1122 1122
 }
@@ -1151,7 +1151,7 @@  discard block
 block discarded – undo
1151 1151
                 }
1152 1152
                 $index ++;
1153 1153
             }
1154
-            if (! $found) {
1154
+            if (!$found) {
1155 1155
                 $result[$size] = $item;
1156 1156
                 $size ++;
1157 1157
             }
@@ -1211,9 +1211,9 @@  discard block
 block discarded – undo
1211 1211
     static $groupBy = false;
1212 1212
     $groupBy = $groupBy ?: curry(function($fn, $list) {
1213 1213
         $result = [];
1214
-        foreach($list as $item) {
1214
+        foreach ($list as $item) {
1215 1215
             $index = $fn($item);
1216
-            if (! isset($result[$index]))
1216
+            if (!isset($result[$index]))
1217 1217
                 $result[$index] = [];
1218 1218
             $result[$index][] = $item;
1219 1219
         }
Please login to merge, or discard this patch.
Doc Comments   -80 removed lines patch added patch discarded remove patch
@@ -15,8 +15,6 @@  discard block
 block discarded – undo
15 15
  * @stream
16 16
  * @signature (a -> b) -> [a] -> [b]
17 17
  * @signature (a -> b) -> {k: a} -> {k: b}
18
- * @param  callable $fn
19
- * @param  array $list
20 18
  * @return array
21 19
  */
22 20
 function map() {
@@ -36,8 +34,6 @@  discard block
 block discarded – undo
36 34
  *
37 35
  * @stream
38 36
  * @signature (a -> [b]) -> [a] -> [b]
39
- * @param  callable $fn
40
- * @param  array $list
41 37
  * @return array
42 38
  */
43 39
 function chain() {
@@ -63,8 +59,6 @@  discard block
 block discarded – undo
63 59
  * ```
64 60
  * @stream
65 61
  * @signature (a -> Boolean) -> [a] -> [a]
66
- * @param  callable $fn
67
- * @param  array $list
68 62
  * @return array
69 63
  */
70 64
 function filter() {
@@ -92,9 +86,6 @@  discard block
 block discarded – undo
92 86
  *
93 87
  * @stream
94 88
  * @signature (* -> a -> *) -> * -> [a] -> *
95
- * @param  callable $fn
96
- * @param  mixed $initial
97
- * @param  array $list
98 89
  * @return array
99 90
  */
100 91
 function reduce() {
@@ -120,8 +111,6 @@  discard block
 block discarded – undo
120 111
  *
121 112
  * @stream
122 113
  * @signature (a -> *) -> [a] -> [a]
123
- * @param  callable $fn
124
- * @param  array $list
125 114
  * @return array
126 115
  */
127 116
 function each() {
@@ -148,7 +137,6 @@  discard block
 block discarded – undo
148 137
  * @stream
149 138
  * @signature [a] -> a
150 139
  * @signature String -> String
151
- * @param  array|string $list
152 140
  * @return mixed
153 141
  */
154 142
 function head() {
@@ -173,7 +161,6 @@  discard block
 block discarded – undo
173 161
  * @stream
174 162
  * @signature [a] -> a
175 163
  * @signature String -> String
176
- * @param  array|string $list
177 164
  * @return mixed
178 165
  */
179 166
 function last () {
@@ -203,7 +190,6 @@  discard block
 block discarded – undo
203 190
  * @stream
204 191
  * @signature [a] -> a
205 192
  * @signature String -> String
206
- * @param  array|string $list
207 193
  * @return array
208 194
  */
209 195
 function init () {
@@ -237,7 +223,6 @@  discard block
 block discarded – undo
237 223
  * @stream
238 224
  * @signature [a] -> a
239 225
  * @signature String -> String
240
- * @param  array|string $list
241 226
  * @return array
242 227
  */
243 228
 function tail () {
@@ -265,7 +250,6 @@  discard block
 block discarded – undo
265 250
  * @stream
266 251
  * @signature [a] -> [a]
267 252
  * @signature String -> String
268
- * @param  array|string $list
269 253
  * @return array
270 254
  */
271 255
 function reverse () {
@@ -289,7 +273,6 @@  discard block
 block discarded – undo
289 273
  * @stream
290 274
  * @signature [a] -> Number
291 275
  * @signature String -> Number
292
- * @param  array|string $list
293 276
  * @return int
294 277
  */
295 278
 function length() {
@@ -313,8 +296,6 @@  discard block
 block discarded – undo
313 296
  *
314 297
  * @stream
315 298
  * @signature (a -> Boolean) -> [a] -> Boolean
316
- * @param  callable $predicate
317
- * @param  array $list
318 299
  * @return bool
319 300
  */
320 301
 function allSatisfies() {
@@ -340,8 +321,6 @@  discard block
 block discarded – undo
340 321
  *
341 322
  * @stream
342 323
  * @signature (a -> Boolean) -> [a] -> Boolean
343
- * @param  callable $predicate
344
- * @param  array $list
345 324
  * @return bool
346 325
  */
347 326
 function anySatisfies() {
@@ -367,8 +346,6 @@  discard block
 block discarded – undo
367 346
  * @stream
368 347
  * @signature [*] -> [*] -> [*]
369 348
  * @signature String -> String -> String
370
- * @param  array $list1
371
- * @param  array $list2
372 349
  * @return array
373 350
  */
374 351
 function concat() {
@@ -391,7 +368,6 @@  discard block
 block discarded – undo
391 368
  *
392 369
  * @stream
393 370
  * @signature [[a]] -> [a]
394
- * @param  array $lists
395 371
  * @return array
396 372
  */
397 373
 function concatAll() {
@@ -426,9 +402,6 @@  discard block
 block discarded – undo
426 402
  * @stream
427 403
  * @signature Number -> a -> [a] -> [a]
428 404
  * @signature Number -> String -> String -> String
429
- * @param  int $position
430
- * @param  mixed $item
431
- * @param  array $list
432 405
  * @return array
433 406
  */
434 407
 function insert() {
@@ -456,9 +429,6 @@  discard block
 block discarded – undo
456 429
  * @stream
457 430
  * @signature Number -> [a] -> [a] -> [a]
458 431
  * @signature Number -> String -> String -> String
459
- * @param  int $position
460
- * @param  mixed $items
461
- * @param  array $list
462 432
  * @return array
463 433
  */
464 434
 function insertAll() {
@@ -491,8 +461,6 @@  discard block
 block discarded – undo
491 461
  * @stream
492 462
  * @signature * -> [*] -> [*]
493 463
  * @signature String -> String -> String
494
- * @param  mixed $item
495
- * @param  array $list
496 464
  * @return array
497 465
  */
498 466
 function append() {
@@ -517,8 +485,6 @@  discard block
 block discarded – undo
517 485
  * @stream
518 486
  * @signature a -> [a] -> [a]
519 487
  * @signature String -> String -> String
520
- * @param  mixed $item
521
- * @param  array $list
522 488
  * @return array
523 489
  */
524 490
 function prepend() {
@@ -548,8 +514,6 @@  discard block
 block discarded – undo
548 514
  * @stream
549 515
  * @signature Number -> [a] -> [a]
550 516
  * @signature Number -> String -> String
551
- * @param  int $count
552
- * @param  array $list
553 517
  * @return array
554 518
  */
555 519
 function take() {
@@ -582,8 +546,6 @@  discard block
 block discarded – undo
582 546
  *
583 547
  * @stream
584 548
  * @signature (a -> Boolean) -> [a] -> [a]
585
- * @param  callable $predicate
586
- * @param  array $list
587 549
  * @return array
588 550
  */
589 551
 function takeWhile() {
@@ -609,8 +571,6 @@  discard block
 block discarded – undo
609 571
  *
610 572
  * @stream
611 573
  * @signature (a -> Boolean) -> [a] -> [a]
612
- * @param  callable $predicate
613
- * @param  array $list
614 574
  * @return array
615 575
  */
616 576
 function takeLastWhile() {
@@ -636,8 +596,6 @@  discard block
 block discarded – undo
636 596
  *
637 597
  * @stream
638 598
  * @signature (a -> Boolean) -> [a] -> [a]
639
- * @param  callable $predicate
640
- * @param  array $list
641 599
  * @return array
642 600
  */
643 601
 function takeUntil() {
@@ -663,8 +621,6 @@  discard block
 block discarded – undo
663 621
  *
664 622
  * @stream
665 623
  * @signature (a -> Boolean) -> [a] -> [a]
666
- * @param  callable $predicate
667
- * @param  array $list
668 624
  * @return array
669 625
  */
670 626
 function takeLastUntil() {
@@ -695,8 +651,6 @@  discard block
 block discarded – undo
695 651
  * @stream
696 652
  * @signature Number -> [a] -> [a]
697 653
  * @signature Number -> String -> String
698
- * @param  int $count
699
- * @param  array $list
700 654
  * @return array
701 655
  */
702 656
 function remove() {
@@ -733,8 +687,6 @@  discard block
 block discarded – undo
733 687
  *
734 688
  * @stream
735 689
  * @signature (a -> Boolean) -> [a] -> [a]
736
- * @param  callable $predicate
737
- * @param  array $list
738 690
  * @return array
739 691
  */
740 692
 function removeWhile() {
@@ -760,8 +712,6 @@  discard block
 block discarded – undo
760 712
  *
761 713
  * @stream
762 714
  * @signature (a -> Boolean) -> [a] -> [a]
763
- * @param  callable $predicate
764
- * @param  array $list
765 715
  * @return array
766 716
  */
767 717
 function removeLastWhile() {
@@ -788,8 +738,6 @@  discard block
 block discarded – undo
788 738
  *
789 739
  * @stream
790 740
  * @signature (a -> Boolean) -> [a] -> [a]
791
- * @param  callable $predicate
792
- * @param  array $list
793 741
  * @return array
794 742
  */
795 743
 function removeUntil() {
@@ -816,8 +764,6 @@  discard block
 block discarded – undo
816 764
  *
817 765
  * @stream
818 766
  * @signature (a -> Boolean) -> [a] -> [a]
819
- * @param  callable $predicate
820
- * @param  array $list
821 767
  * @return array
822 768
  */
823 769
 function removeLastUntil() {
@@ -840,7 +786,6 @@  discard block
 block discarded – undo
840 786
  *
841 787
  * @stream
842 788
  * @signature [(k, v)] -> {k: v}
843
- * @param  array $pairs
844 789
  * @return stdClass
845 790
  */
846 791
 function fromPairs() {
@@ -870,8 +815,6 @@  discard block
 block discarded – undo
870 815
  * @stream
871 816
  * @signature Number -> [a] -> [[a]]
872 817
  * @signature Number -> String -> [String]
873
- * @param  int $size
874
- * @param  array $list
875 818
  * @return array
876 819
  */
877 820
 function slices() {
@@ -905,8 +848,6 @@  discard block
 block discarded – undo
905 848
  * @stream
906 849
  * @signature a -> [a] -> Boolean
907 850
  * @signature String -> String -> Boolean
908
- * @param  mixed $item
909
- * @param  array|string $list
910 851
  * @return bool
911 852
  */
912 853
 function contains() {
@@ -932,8 +873,6 @@  discard block
 block discarded – undo
932 873
  * @stream
933 874
  * @signature (a -> Boolean) -> [a] -> Maybe(Number)
934 875
  * @signature (v -> Boolean) -> {k: v} -> Maybe(k)
935
- * @param  callable $predicate
936
- * @param  array $list
937 876
  * @return mixed
938 877
  */
939 878
 function findIndex() {
@@ -961,8 +900,6 @@  discard block
 block discarded – undo
961 900
  * @stream
962 901
  * @signature (a -> Boolean) -> [a] -> Maybe(Number)
963 902
  * @signature (v -> Boolean) -> {k: v} -> Maybe(k)
964
- * @param  callable $predicate
965
- * @param  array $list
966 903
  * @return mixed
967 904
  */
968 905
 function findLastIndex() {
@@ -991,8 +928,6 @@  discard block
 block discarded – undo
991 928
  *
992 929
  * @stream
993 930
  * @signature (a -> Boolean) -> [a] -> Maybe(a)
994
- * @param  callable $predicate
995
- * @param  array $list
996 931
  * @return mixed
997 932
  */
998 933
 function find() {
@@ -1018,8 +953,6 @@  discard block
 block discarded – undo
1018 953
  *
1019 954
  * @stream
1020 955
  * @signature (a -> Boolean) -> [a] -> Maybe(a)
1021
- * @param  callable $predicate
1022
- * @param  array $list
1023 956
  * @return mixed
1024 957
  */
1025 958
 function findLast() {
@@ -1057,8 +990,6 @@  discard block
 block discarded – undo
1057 990
  * @signature a -> [a] -> Number
1058 991
  * @signature v -> {k: v} -> Maybe(k)
1059 992
  * @signature String -> String -> Number
1060
- * @param  mixed $item
1061
- * @param  array $list
1062 993
  * @return int
1063 994
  */
1064 995
 function indexOf() {
@@ -1097,8 +1028,6 @@  discard block
 block discarded – undo
1097 1028
  * @signature a -> [a] -> Number
1098 1029
  * @signature v -> {k: v} -> Maybe(k)
1099 1030
  * @signature String -> String -> Number
1100
- * @param  mixed $item
1101
- * @param  array $list
1102 1031
  * @return int
1103 1032
  */
1104 1033
 function lastIndexOf() {
@@ -1132,8 +1061,6 @@  discard block
 block discarded – undo
1132 1061
  *
1133 1062
  * @stream
1134 1063
  * @signature (a -> a -> Boolean) -> [a] -> [a]
1135
- * @param  callable $areEqual
1136
- * @param  array $list
1137 1064
  * @return array
1138 1065
  */
1139 1066
 function uniqueBy() {
@@ -1170,7 +1097,6 @@  discard block
 block discarded – undo
1170 1097
  *
1171 1098
  * @stream
1172 1099
  * @signature [a] -> [a]
1173
- * @param  array $list
1174 1100
  * @return array
1175 1101
  */
1176 1102
 function unique() {
@@ -1203,8 +1129,6 @@  discard block
 block discarded – undo
1203 1129
  *
1204 1130
  * @stream
1205 1131
  * @signature (a -> String) -> [a] -> {String: a}
1206
- * @param  callable $fn
1207
- * @param  array $list
1208 1132
  * @return array
1209 1133
  */
1210 1134
 function groupBy() {
@@ -1234,8 +1158,6 @@  discard block
 block discarded – undo
1234 1158
  *
1235 1159
  * @stream
1236 1160
  * @signature [a] -> [b] -> [[a,b]]
1237
- * @param  array $list1
1238
- * @param  array $list2
1239 1161
  * @return array
1240 1162
  */
1241 1163
 function pairsFrom() {
@@ -1280,8 +1202,6 @@  discard block
 block discarded – undo
1280 1202
  *
1281 1203
  * @stream
1282 1204
  * @signature (a -> a -> Boolean) -> [a] -> [a]
1283
- * @param  callable $compare
1284
- * @param  array $list
1285 1205
  * @return array
1286 1206
  */
1287 1207
 function sort() {
Please login to merge, or discard this patch.
Braces   +93 added lines, -61 removed lines patch added patch discarded remove patch
@@ -72,8 +72,9 @@  discard block
 block discarded – undo
72 72
     $filter = $filter ?: curry(function($fn, $list) {
73 73
         $result = [];
74 74
         foreach ($list as $item) {
75
-            if ($fn($item))
76
-                $result[] = $item;
75
+            if ($fn($item)) {
76
+                            $result[] = $item;
77
+            }
77 78
         }
78 79
         return $result;
79 80
     });
@@ -154,7 +155,9 @@  discard block
 block discarded – undo
154 155
 function head() {
155 156
     static $head = false;
156 157
     $head = $head ?: curry(function($list) {
157
-        if (isset($list[0])) return $list[0];
158
+        if (isset($list[0])) {
159
+            return $list[0];
160
+        }
158 161
         return is_string($list) ? '' : null;
159 162
     });
160 163
     return _apply($head, func_get_args());
@@ -179,8 +182,9 @@  discard block
 block discarded – undo
179 182
 function last () {
180 183
     static $last = false;
181 184
     $last = $last ?: curry(function($list) {
182
-        if(is_string($list))
183
-            return substr($list, -1);
185
+        if(is_string($list)) {
186
+                    return substr($list, -1);
187
+        }
184 188
         $size = count($list);
185 189
         return ($size > 0)
186 190
             ? $list[$size - 1]
@@ -243,10 +247,11 @@  discard block
 block discarded – undo
243 247
 function tail () {
244 248
     static $tail = false;
245 249
     $tail = $tail ?: curry(function($list) {
246
-        if(is_string($list))
247
-            return (strlen($list) > 1)
250
+        if(is_string($list)) {
251
+                    return (strlen($list) > 1)
248 252
                 ? substr($list, 1)
249 253
                 : '';
254
+        }
250 255
         return (count($list) > 1)
251 256
             ? array_slice($list, 1)
252 257
             : [];
@@ -321,8 +326,9 @@  discard block
 block discarded – undo
321 326
     static $allSatisfies = false;
322 327
     $allSatisfies = $allSatisfies ?: curry(function($predicate, $list) {
323 328
         foreach ($list as $item) {
324
-            if (! $predicate($item))
325
-                return false;
329
+            if (! $predicate($item)) {
330
+                            return false;
331
+            }
326 332
         }
327 333
         return true;
328 334
     });
@@ -348,8 +354,9 @@  discard block
 block discarded – undo
348 354
     static $anySatisfies = false;
349 355
     $anySatisfies = $anySatisfies ?: curry(function($predicate, $list) {
350 356
         foreach ($list as $item) {
351
-            if ($predicate($item))
352
-                return true;
357
+            if ($predicate($item)) {
358
+                            return true;
359
+            }
353 360
         }
354 361
         return false;
355 362
     });
@@ -374,8 +381,9 @@  discard block
 block discarded – undo
374 381
 function concat() {
375 382
     static $concat = false;
376 383
     $concat = $concat ?: curry(function($list1, $list2) {
377
-        if (is_string($list1) && is_string($list2))
378
-            return $list1 . $list2;
384
+        if (is_string($list1) && is_string($list2)) {
385
+                    return $list1 . $list2;
386
+        }
379 387
         return array_merge($list1, $list2);
380 388
     });
381 389
     return _apply($concat, func_get_args());
@@ -397,10 +405,12 @@  discard block
 block discarded – undo
397 405
 function concatAll() {
398 406
     static $concatAll = false;
399 407
     $concatAll = $concatAll ?: curry(function($lists) {
400
-        if (count($lists) == 0)
401
-            return [];
402
-        if (is_string($lists[0]))
403
-            return implode('', $lists);
408
+        if (count($lists) == 0) {
409
+                    return [];
410
+        }
411
+        if (is_string($lists[0])) {
412
+                    return implode('', $lists);
413
+        }
404 414
         return _apply('array_merge', $lists);
405 415
     });
406 416
     return _apply($concatAll, func_get_args());
@@ -465,14 +475,17 @@  discard block
 block discarded – undo
465 475
     static $insertAll = false;
466 476
     $insertAll = $insertAll ?: curry(function($position, $items, $list) {
467 477
         $size = length($list);
468
-        if ($position < 0)
469
-            $position = $size + $position;
470
-        if ($position < 0)
471
-            $position = 0;
472
-        if (is_string($list))
473
-            return ($position >= $size)
478
+        if ($position < 0) {
479
+                    $position = $size + $position;
480
+        }
481
+        if ($position < 0) {
482
+                    $position = 0;
483
+        }
484
+        if (is_string($list)) {
485
+                    return ($position >= $size)
474 486
                 ? $list . $items
475 487
                 : substr($list, 0, $position) . $items . substr($list, $position);
488
+        }
476 489
         return ($position >= $size)
477 490
             ? array_merge($list, $items)
478 491
             : array_merge(array_slice($list, 0, $position), $items, array_slice($list, $position));
@@ -556,8 +569,9 @@  discard block
 block discarded – undo
556 569
     static $take = false;
557 570
     $take = $take ?: curry(function($count, $list) {
558 571
         $length = length($list);
559
-        if ($count > $length || $count < -$length)
560
-            return $list;
572
+        if ($count > $length || $count < -$length) {
573
+                    return $list;
574
+        }
561 575
         if(is_string($list)) {
562 576
             return ($count >= 0)
563 577
                 ? substr($list, 0, $count)
@@ -591,8 +605,9 @@  discard block
 block discarded – undo
591 605
     $takeWhile = $takeWhile ?: curry(function($predicate, $list) {
592 606
         $index = 0;
593 607
         $size = length($list);
594
-        while ($index < $size && $predicate($list[$index]))
595
-            $index ++;
608
+        while ($index < $size && $predicate($list[$index])) {
609
+                    $index ++;
610
+        }
596 611
         return array_slice($list, 0, $index);
597 612
     });
598 613
     return _apply($takeWhile, func_get_args());
@@ -617,8 +632,9 @@  discard block
 block discarded – undo
617 632
     static $takeLastWhile = false;
618 633
     $takeLastWhile = $takeLastWhile ?: curry(function($predicate, $list) {
619 634
         $index = length($list) - 1;
620
-        while ($index >= 0 && $predicate($list[$index]))
621
-            $index --;
635
+        while ($index >= 0 && $predicate($list[$index])) {
636
+                    $index --;
637
+        }
622 638
         return array_slice($list, $index + 1);
623 639
     });
624 640
     return _apply($takeLastWhile, func_get_args());
@@ -645,8 +661,9 @@  discard block
 block discarded – undo
645 661
     $takeUntil = $takeUntil ?: curry(function($predicate, $list) {
646 662
         $index = 0;
647 663
         $size = length($list);
648
-        while ($index < $size && !$predicate($list[$index]))
649
-            $index ++;
664
+        while ($index < $size && !$predicate($list[$index])) {
665
+                    $index ++;
666
+        }
650 667
         return array_slice($list, 0, $index);
651 668
     });
652 669
     return _apply($takeUntil, func_get_args());
@@ -671,8 +688,9 @@  discard block
 block discarded – undo
671 688
     static $takeLastUntil = false;
672 689
     $takeLastUntil = $takeLastUntil ?: curry(function($predicate, $list) {
673 690
         $index = length($list) - 1;
674
-        while ($index >= 0 && !$predicate($list[$index]))
675
-            $index --;
691
+        while ($index >= 0 && !$predicate($list[$index])) {
692
+                    $index --;
693
+        }
676 694
         return array_slice($list, $index + 1);
677 695
     });
678 696
     return _apply($takeLastUntil, func_get_args());
@@ -704,8 +722,9 @@  discard block
 block discarded – undo
704 722
     static $remove = false;
705 723
     $remove = $remove ?: curry(function($count, $list) {
706 724
         $length = length($list);
707
-        if ($count > $length || $count < -$length)
708
-            return is_string($list) ? '' : [];
725
+        if ($count > $length || $count < -$length) {
726
+                    return is_string($list) ? '' : [];
727
+        }
709 728
         $count = ($count > 0)
710 729
             ? $count - $length
711 730
             : $count + $length;
@@ -742,8 +761,9 @@  discard block
 block discarded – undo
742 761
     $removeWhile = $removeWhile ?: curry(function($predicate, $list) {
743 762
         $index = 0;
744 763
         $size = length($list);
745
-        while ($index < $size && $predicate($list[$index]))
746
-            $index ++;
764
+        while ($index < $size && $predicate($list[$index])) {
765
+                    $index ++;
766
+        }
747 767
         return array_slice($list, $index);
748 768
     });
749 769
     return _apply($removeWhile, func_get_args());
@@ -768,8 +788,9 @@  discard block
 block discarded – undo
768 788
     static $removeLastWhile = false;
769 789
     $removeLastWhile = $removeLastWhile ?: curry(function($predicate, $list) {
770 790
         $index = length($list) - 1;
771
-        while ($index >= 0 && $predicate($list[$index]))
772
-            $index --;
791
+        while ($index >= 0 && $predicate($list[$index])) {
792
+                    $index --;
793
+        }
773 794
         return array_slice($list, 0, $index + 1);
774 795
     });
775 796
     return _apply($removeLastWhile, func_get_args());
@@ -797,8 +818,9 @@  discard block
 block discarded – undo
797 818
     $removeUntil = $removeUntil ?: curry(function($predicate, $list) {
798 819
         $index = 0;
799 820
         $size = length($list);
800
-        while ($index < $size && !$predicate($list[$index]))
801
-            $index ++;
821
+        while ($index < $size && !$predicate($list[$index])) {
822
+                    $index ++;
823
+        }
802 824
         return array_slice($list, $index);
803 825
     });
804 826
     return _apply($removeUntil, func_get_args());
@@ -824,8 +846,9 @@  discard block
 block discarded – undo
824 846
     static $removeLastUntil = false;
825 847
     $removeLastUntil = $removeLastUntil ?: curry(function($predicate, $list) {
826 848
         $index = length($list) - 1;
827
-        while ($index >= 0 && !$predicate($list[$index]))
828
-            $index --;
849
+        while ($index >= 0 && !$predicate($list[$index])) {
850
+                    $index --;
851
+        }
829 852
         return array_slice($list, 0, $index + 1);
830 853
     });
831 854
     return _apply($removeLastUntil, func_get_args());
@@ -878,8 +901,9 @@  discard block
 block discarded – undo
878 901
     static $slices = false;
879 902
     $slices = $slices ?: curry(function($size, &$list) {
880 903
         $length = length($list);
881
-        if ($length == 0)
882
-            return is_string($list) ? [''] : [];
904
+        if ($length == 0) {
905
+                    return is_string($list) ? [''] : [];
906
+        }
883 907
         $start = 0;
884 908
         $result = [];
885 909
         $slicer = is_string($list) ? 'substr' : 'array_slice';
@@ -940,8 +964,9 @@  discard block
 block discarded – undo
940 964
     static $findIndex = false;
941 965
     $findIndex = $findIndex ?: curry(function($predicate, $list) {
942 966
         foreach ($list as $key => &$value) {
943
-            if ($predicate($value))
944
-                return $key;
967
+            if ($predicate($value)) {
968
+                            return $key;
969
+            }
945 970
         }
946 971
         return null;
947 972
     });
@@ -971,8 +996,9 @@  discard block
 block discarded – undo
971 996
         $keys = array_keys($list);
972 997
         $index = count($keys) - 1;
973 998
         while ($index >= 0) {
974
-            if ($predicate($list[$keys[$index]]))
975
-                return $keys[$index];
999
+            if ($predicate($list[$keys[$index]])) {
1000
+                            return $keys[$index];
1001
+            }
976 1002
             $index --;
977 1003
         }
978 1004
         return null;
@@ -999,8 +1025,9 @@  discard block
 block discarded – undo
999 1025
     static $find = false;
1000 1026
     $find = $find ?: curry(function($predicate, $list) {
1001 1027
         foreach ($list as $key => &$value) {
1002
-            if ($predicate($value))
1003
-                return $value;
1028
+            if ($predicate($value)) {
1029
+                            return $value;
1030
+            }
1004 1031
         }
1005 1032
         return null;
1006 1033
     });
@@ -1028,8 +1055,9 @@  discard block
 block discarded – undo
1028 1055
         $keys = array_keys($list);
1029 1056
         $index = count($keys) - 1;
1030 1057
         while ($index >= 0) {
1031
-            if ($predicate($list[$keys[$index]]))
1032
-                return $list[$keys[$index]];
1058
+            if ($predicate($list[$keys[$index]])) {
1059
+                            return $list[$keys[$index]];
1060
+            }
1033 1061
             $index --;
1034 1062
         }
1035 1063
         return null;
@@ -1073,8 +1101,9 @@  discard block
 block discarded – undo
1073 1101
         $keys = array_keys($list);
1074 1102
         $length = count($keys);
1075 1103
         while ($index < $length) {
1076
-            if (_equals($item, $list[$keys[$index]]))
1077
-                return $keys[$index];
1104
+            if (_equals($item, $list[$keys[$index]])) {
1105
+                            return $keys[$index];
1106
+            }
1078 1107
             $index ++;
1079 1108
         }
1080 1109
         return -1;
@@ -1112,8 +1141,9 @@  discard block
 block discarded – undo
1112 1141
         $keys = array_keys($list);
1113 1142
         $index = count($list) - 1;
1114 1143
         while ($index >= 0) {
1115
-            if (_equals($list[$keys[$index]], $item))
1116
-                return $keys[$index];
1144
+            if (_equals($list[$keys[$index]], $item)) {
1145
+                            return $keys[$index];
1146
+            }
1117 1147
             $index --;
1118 1148
         }
1119 1149
         return -1;
@@ -1213,8 +1243,9 @@  discard block
 block discarded – undo
1213 1243
         $result = [];
1214 1244
         foreach($list as $item) {
1215 1245
             $index = $fn($item);
1216
-            if (! isset($result[$index]))
1217
-                $result[$index] = [];
1246
+            if (! isset($result[$index])) {
1247
+                            $result[$index] = [];
1248
+            }
1218 1249
             $result[$index][] = $item;
1219 1250
         }
1220 1251
         return $result;
@@ -1243,8 +1274,9 @@  discard block
 block discarded – undo
1243 1274
     $pairsFrom = $pairsFrom ?: curry(function($list1, $list2) {
1244 1275
         $length1 = count($list1);
1245 1276
         $length2 = count($list2);
1246
-        if (0 == $length1 || 0 == $length2)
1247
-            return [];
1277
+        if (0 == $length1 || 0 == $length2) {
1278
+                    return [];
1279
+        }
1248 1280
         $result = [];
1249 1281
         $index = 0;
1250 1282
         $length = min($length1, $length2);
Please login to merge, or discard this patch.