Completed
Push — master ( 679ccf...e6ba9d )
by Lars
02:10
created
src/Arrayy.php 2 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -3641,7 +3641,7 @@  discard block
 block discarded – undo
3641 3641
     /**
3642 3642
      * Apply the given function to every element in the array, discarding the results.
3643 3643
      *
3644
-     * @param \callable $callable
3644
+     * @param \Closure $callable
3645 3645
      * @param bool      $recursive <p>Whether array will be walked recursively or no</p>
3646 3646
      *
3647 3647
      * @return static
@@ -3733,8 +3733,8 @@  discard block
 block discarded – undo
3733 3733
     }
3734 3734
 
3735 3735
     /**
3736
-     * @param mixed      $path
3737
-     * @param \callable  $callable
3736
+     * @param string      $path
3737
+     * @param \Closure  $callable
3738 3738
      * @param array|null $currentOffset
3739 3739
      */
3740 3740
     protected function callAtPath($path, $callable, &$currentOffset = null)
@@ -3878,7 +3878,7 @@  discard block
 block discarded – undo
3878 3878
     }
3879 3879
 
3880 3880
     /**
3881
-     * @param mixed               $glue
3881
+     * @param string               $glue
3882 3882
      * @param array|static|string $pieces
3883 3883
      * @param bool                $useKeys
3884 3884
      *
Please login to merge, or discard this patch.
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -96,12 +96,12 @@  discard block
 block discarded – undo
96 96
             &&
97 97
             \count(\array_diff_key($this->properties, $array)) > 0
98 98
         ) {
99
-            throw new \InvalidArgumentException('Property mismatch - input: ' . \print_r(\array_keys($array), true) . ' | expected: ' . \print_r(\array_keys($this->properties), true));
99
+            throw new \InvalidArgumentException('Property mismatch - input: '.\print_r(\array_keys($array), true).' | expected: '.\print_r(\array_keys($this->properties), true));
100 100
         }
101 101
 
102 102
         \array_walk(
103 103
             $array,
104
-            function (&$value, &$key) {
104
+            function(&$value, &$key) {
105 105
                 $this->internalSet($key, $value);
106 106
             }
107 107
         );
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
 
426 426
             $this->callAtPath(
427 427
                 $containerPath,
428
-                static function ($container) use ($lastOffset, &$offsetExists) {
428
+                static function($container) use ($lastOffset, &$offsetExists) {
429 429
                     $offsetExists = \array_key_exists($lastOffset, $container);
430 430
                 }
431 431
             );
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
 
486 486
             $this->callAtPath(
487 487
                 \implode($this->pathSeparator, $path),
488
-                static function (&$offset) use ($pathToUnset) {
488
+                static function(&$offset) use ($pathToUnset) {
489 489
                     unset($offset[$pathToUnset]);
490 490
                 }
491 491
             );
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
         }
521 521
 
522 522
         if (\strpos($class, '\\') === 0) {
523
-            $class = '\\' . $class;
523
+            $class = '\\'.$class;
524 524
             if (\class_exists($class)) {
525 525
                 $this->iteratorClass = $class;
526 526
 
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
             }
529 529
         }
530 530
 
531
-        throw new \InvalidArgumentException('The iterator class does not exist: ' . $class);
531
+        throw new \InvalidArgumentException('The iterator class does not exist: '.$class);
532 532
     }
533 533
 
534 534
     /**
@@ -632,13 +632,13 @@  discard block
 block discarded – undo
632 632
 
633 633
         foreach ($this->getGenerator() as $key => $item) {
634 634
             if ($item instanceof self) {
635
-                $result[$prefix . $key] = $item->appendToEachKey($prefix);
635
+                $result[$prefix.$key] = $item->appendToEachKey($prefix);
636 636
             } elseif (\is_array($item)) {
637
-                $result[$prefix . $key] = self::create($item, $this->iteratorClass, false)
637
+                $result[$prefix.$key] = self::create($item, $this->iteratorClass, false)
638 638
                     ->appendToEachKey($prefix)
639 639
                     ->toArray();
640 640
             } else {
641
-                $result[$prefix . $key] = $item;
641
+                $result[$prefix.$key] = $item;
642 642
             }
643 643
         }
644 644
 
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
             } elseif (\is_object($item)) {
667 667
                 $result[$key] = $item;
668 668
             } else {
669
-                $result[$key] = $prefix . $item;
669
+                $result[$key] = $prefix.$item;
670 670
             }
671 671
         }
672 672
 
@@ -815,7 +815,7 @@  discard block
 block discarded – undo
815 815
     public function clean()
816 816
     {
817 817
         return $this->filter(
818
-            static function ($value) {
818
+            static function($value) {
819 819
                 return (bool) $value;
820 820
             }
821 821
         );
@@ -867,7 +867,7 @@  discard block
 block discarded – undo
867 867
             return $this->in_array_recursive(
868 868
                 \mb_strtoupper((string) $value),
869 869
                 $this->walk(
870
-                    static function (&$val) {
870
+                    static function(&$val) {
871 871
                         /** @noinspection PhpComposerExtensionStubsInspection */
872 872
                         $val = \mb_strtoupper((string) $val);
873 873
                     },
@@ -881,7 +881,7 @@  discard block
 block discarded – undo
881 881
         return \in_array(
882 882
             \mb_strtoupper((string) $value),
883 883
             $this->walk(
884
-                static function (&$val) {
884
+                static function(&$val) {
885 885
                     /** @noinspection PhpComposerExtensionStubsInspection */
886 886
                     $val = \mb_strtoupper((string) $val);
887 887
                 },
@@ -1142,7 +1142,7 @@  discard block
 block discarded – undo
1142 1142
         // trim all string in the array
1143 1143
         \array_walk(
1144 1144
             $array,
1145
-            static function (&$val) {
1145
+            static function(&$val) {
1146 1146
                 /** @noinspection ReferenceMismatchInspection */
1147 1147
                 if (\is_string($val)) {
1148 1148
                     $val = \trim($val);
@@ -1451,40 +1451,40 @@  discard block
 block discarded – undo
1451 1451
         }
1452 1452
 
1453 1453
         $ops = [
1454
-            'eq' => static function ($item, $prop, $value) {
1454
+            'eq' => static function($item, $prop, $value) {
1455 1455
                 return $item[$prop] === $value;
1456 1456
             },
1457
-            'gt' => static function ($item, $prop, $value) {
1457
+            'gt' => static function($item, $prop, $value) {
1458 1458
                 return $item[$prop] > $value;
1459 1459
             },
1460
-            'ge' => static function ($item, $prop, $value) {
1460
+            'ge' => static function($item, $prop, $value) {
1461 1461
                 return $item[$prop] >= $value;
1462 1462
             },
1463
-            'gte' => static function ($item, $prop, $value) {
1463
+            'gte' => static function($item, $prop, $value) {
1464 1464
                 return $item[$prop] >= $value;
1465 1465
             },
1466
-            'lt' => static function ($item, $prop, $value) {
1466
+            'lt' => static function($item, $prop, $value) {
1467 1467
                 return $item[$prop] < $value;
1468 1468
             },
1469
-            'le' => static function ($item, $prop, $value) {
1469
+            'le' => static function($item, $prop, $value) {
1470 1470
                 return $item[$prop] <= $value;
1471 1471
             },
1472
-            'lte' => static function ($item, $prop, $value) {
1472
+            'lte' => static function($item, $prop, $value) {
1473 1473
                 return $item[$prop] <= $value;
1474 1474
             },
1475
-            'ne' => static function ($item, $prop, $value) {
1475
+            'ne' => static function($item, $prop, $value) {
1476 1476
                 return $item[$prop] !== $value;
1477 1477
             },
1478
-            'contains' => static function ($item, $prop, $value) {
1478
+            'contains' => static function($item, $prop, $value) {
1479 1479
                 return \in_array($item[$prop], (array) $value, true);
1480 1480
             },
1481
-            'notContains' => static function ($item, $prop, $value) {
1481
+            'notContains' => static function($item, $prop, $value) {
1482 1482
                 return !\in_array($item[$prop], (array) $value, true);
1483 1483
             },
1484
-            'newer' => static function ($item, $prop, $value) {
1484
+            'newer' => static function($item, $prop, $value) {
1485 1485
                 return \strtotime($item[$prop]) > \strtotime($value);
1486 1486
             },
1487
-            'older' => static function ($item, $prop, $value) {
1487
+            'older' => static function($item, $prop, $value) {
1488 1488
                 return \strtotime($item[$prop]) < \strtotime($value);
1489 1489
             },
1490 1490
         ];
@@ -1492,7 +1492,7 @@  discard block
 block discarded – undo
1492 1492
         $result = \array_values(
1493 1493
             \array_filter(
1494 1494
                 (array) $this->array,
1495
-                static function ($item) use (
1495
+                static function($item) use (
1496 1496
                     $property,
1497 1497
                     $value,
1498 1498
                     $ops,
@@ -2590,7 +2590,7 @@  discard block
 block discarded – undo
2590 2590
             } elseif (\is_array($item)) {
2591 2591
                 $result[$key] = self::create($item, $this->iteratorClass, false)->prependToEachKey($suffix)->toArray();
2592 2592
             } else {
2593
-                $result[$key . $suffix] = $item;
2593
+                $result[$key.$suffix] = $item;
2594 2594
             }
2595 2595
         }
2596 2596
 
@@ -2620,7 +2620,7 @@  discard block
 block discarded – undo
2620 2620
             } elseif (\is_object($item)) {
2621 2621
                 $result[$key] = $item;
2622 2622
             } else {
2623
-                $result[$key] = $item . $suffix;
2623
+                $result[$key] = $item.$suffix;
2624 2624
             }
2625 2625
         }
2626 2626
 
@@ -3060,7 +3060,7 @@  discard block
 block discarded – undo
3060 3060
     public function replaceValues($search, $replacement = '')
3061 3061
     {
3062 3062
         $array = $this->each(
3063
-            static function ($value) use ($search, $replacement) {
3063
+            static function($value) use ($search, $replacement) {
3064 3064
                 return \str_replace($search, $replacement, $value);
3065 3065
             }
3066 3066
         );
@@ -3416,7 +3416,7 @@  discard block
 block discarded – undo
3416 3416
 
3417 3417
             $that = $this;
3418 3418
             $results = $arrayy->each(
3419
-                static function ($value) use ($sorter, $that) {
3419
+                static function($value) use ($sorter, $that) {
3420 3420
                     return \is_callable($sorter) ? $sorter($value) : $that->get($sorter, null, $value);
3421 3421
                 }
3422 3422
             );
@@ -3464,7 +3464,7 @@  discard block
 block discarded – undo
3464 3464
     public function stripEmpty()
3465 3465
     {
3466 3466
         return $this->filter(
3467
-            static function ($item) {
3467
+            static function($item) {
3468 3468
                 if ($item === null) {
3469 3469
                     return false;
3470 3470
                 }
@@ -3541,7 +3541,7 @@  discard block
 block discarded – undo
3541 3541
 
3542 3542
         $this->array = \array_reduce(
3543 3543
             $this->array,
3544
-            static function ($resultArray, $value) {
3544
+            static function($resultArray, $value) {
3545 3545
                 if (!\in_array($value, $resultArray, true)) {
3546 3546
                     $resultArray[] = $value;
3547 3547
                 }
@@ -3575,7 +3575,7 @@  discard block
 block discarded – undo
3575 3575
 
3576 3576
         $this->array = \array_reduce(
3577 3577
             \array_keys($array),
3578
-            static function ($resultArray, $key) use ($array) {
3578
+            static function($resultArray, $key) use ($array) {
3579 3579
                 if (!\in_array($array[$key], $resultArray, true)) {
3580 3580
                     $resultArray[$key] = $array[$key];
3581 3581
                 }
@@ -3857,7 +3857,7 @@  discard block
 block discarded – undo
3857 3857
     protected function getPublicProperties(): array
3858 3858
     {
3859 3859
         static $PROPERTY_CACHE = [];
3860
-        $cacheKey = 'Class::' . static::class;
3860
+        $cacheKey = 'Class::'.static::class;
3861 3861
 
3862 3862
         if (isset($PROPERTY_CACHE[$cacheKey])) {
3863 3863
             return $PROPERTY_CACHE[$cacheKey];
@@ -4018,7 +4018,7 @@  discard block
 block discarded – undo
4018 4018
     {
4019 4019
         if ($this->checkPropertyTypes === true) {
4020 4020
             if (isset($this->properties[$key]) === false) {
4021
-                throw new \InvalidArgumentException('The key ' . $key . ' does not exists as @property in the class (' . \get_class($this) . ').');
4021
+                throw new \InvalidArgumentException('The key '.$key.' does not exists as @property in the class ('.\get_class($this).').');
4022 4022
             }
4023 4023
 
4024 4024
             $this->properties[$key]->checkType($value);
Please login to merge, or discard this patch.