Completed
Push — master ( 095ad5...549151 )
by Lars
01:40
created
src/Arrayy.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
 
472 472
                     $this->callAtPath(
473 473
                         $containerPath,
474
-                        static function ($container) use ($lastOffset, &$offsetExists) {
474
+                        static function($container) use ($lastOffset, &$offsetExists) {
475 475
                             $offsetExists = \array_key_exists($lastOffset, $container);
476 476
                         }
477 477
                     );
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 
558 558
                 $this->callAtPath(
559 559
                     \implode($this->pathSeparator, $path),
560
-                    static function (&$offset) use ($pathToUnset) {
560
+                    static function(&$offset) use ($pathToUnset) {
561 561
                         unset($offset[$pathToUnset]);
562 562
                     }
563 563
                 );
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
         }
604 604
 
605 605
         if (\strpos($iteratorClass, '\\') === 0) {
606
-            $iteratorClass = '\\' . $iteratorClass;
606
+            $iteratorClass = '\\'.$iteratorClass;
607 607
             if (\class_exists($iteratorClass)) {
608 608
                 $this->iteratorClass = $iteratorClass;
609 609
 
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
             }
612 612
         }
613 613
 
614
-        throw new \InvalidArgumentException('The iterator class does not exist: ' . $iteratorClass);
614
+        throw new \InvalidArgumentException('The iterator class does not exist: '.$iteratorClass);
615 615
     }
616 616
 
617 617
     /**
@@ -721,13 +721,13 @@  discard block
 block discarded – undo
721 721
 
722 722
         foreach ($this->getGenerator() as $key => $item) {
723 723
             if ($item instanceof self) {
724
-                $result[$prefix . $key] = $item->appendToEachKey($prefix);
724
+                $result[$prefix.$key] = $item->appendToEachKey($prefix);
725 725
             } elseif (\is_array($item) === true) {
726
-                $result[$prefix . $key] = self::create($item, $this->iteratorClass, false)
726
+                $result[$prefix.$key] = self::create($item, $this->iteratorClass, false)
727 727
                     ->appendToEachKey($prefix)
728 728
                     ->toArray();
729 729
             } else {
730
-                $result[$prefix . $key] = $item;
730
+                $result[$prefix.$key] = $item;
731 731
             }
732 732
         }
733 733
 
@@ -755,7 +755,7 @@  discard block
 block discarded – undo
755 755
             } elseif (\is_object($item) === true) {
756 756
                 $result[$key] = $item;
757 757
             } else {
758
-                $result[$key] = $prefix . $item;
758
+                $result[$key] = $prefix.$item;
759 759
             }
760 760
         }
761 761
 
@@ -904,7 +904,7 @@  discard block
 block discarded – undo
904 904
     public function clean(): self
905 905
     {
906 906
         return $this->filter(
907
-            static function ($value) {
907
+            static function($value) {
908 908
                 return (bool) $value;
909 909
             }
910 910
         );
@@ -1263,7 +1263,7 @@  discard block
 block discarded – undo
1263 1263
         // trim all string in the array
1264 1264
         \array_walk(
1265 1265
             $array,
1266
-            static function (&$val) {
1266
+            static function(&$val) {
1267 1267
                 if ((string) $val === $val) {
1268 1268
                     $val = \trim($val);
1269 1269
                 }
@@ -1670,40 +1670,40 @@  discard block
 block discarded – undo
1670 1670
         }
1671 1671
 
1672 1672
         $ops = [
1673
-            'eq' => static function ($item, $prop, $value): bool {
1673
+            'eq' => static function($item, $prop, $value): bool {
1674 1674
                 return $item[$prop] === $value;
1675 1675
             },
1676
-            'gt' => static function ($item, $prop, $value): bool {
1676
+            'gt' => static function($item, $prop, $value): bool {
1677 1677
                 return $item[$prop] > $value;
1678 1678
             },
1679
-            'ge' => static function ($item, $prop, $value): bool {
1679
+            'ge' => static function($item, $prop, $value): bool {
1680 1680
                 return $item[$prop] >= $value;
1681 1681
             },
1682
-            'gte' => static function ($item, $prop, $value): bool {
1682
+            'gte' => static function($item, $prop, $value): bool {
1683 1683
                 return $item[$prop] >= $value;
1684 1684
             },
1685
-            'lt' => static function ($item, $prop, $value): bool {
1685
+            'lt' => static function($item, $prop, $value): bool {
1686 1686
                 return $item[$prop] < $value;
1687 1687
             },
1688
-            'le' => static function ($item, $prop, $value): bool {
1688
+            'le' => static function($item, $prop, $value): bool {
1689 1689
                 return $item[$prop] <= $value;
1690 1690
             },
1691
-            'lte' => static function ($item, $prop, $value): bool {
1691
+            'lte' => static function($item, $prop, $value): bool {
1692 1692
                 return $item[$prop] <= $value;
1693 1693
             },
1694
-            'ne' => static function ($item, $prop, $value): bool {
1694
+            'ne' => static function($item, $prop, $value): bool {
1695 1695
                 return $item[$prop] !== $value;
1696 1696
             },
1697
-            'contains' => static function ($item, $prop, $value): bool {
1697
+            'contains' => static function($item, $prop, $value): bool {
1698 1698
                 return \in_array($item[$prop], (array) $value, true);
1699 1699
             },
1700
-            'notContains' => static function ($item, $prop, $value): bool {
1700
+            'notContains' => static function($item, $prop, $value): bool {
1701 1701
                 return !\in_array($item[$prop], (array) $value, true);
1702 1702
             },
1703
-            'newer' => static function ($item, $prop, $value): bool {
1703
+            'newer' => static function($item, $prop, $value): bool {
1704 1704
                 return \strtotime($item[$prop]) > \strtotime($value);
1705 1705
             },
1706
-            'older' => static function ($item, $prop, $value): bool {
1706
+            'older' => static function($item, $prop, $value): bool {
1707 1707
                 return \strtotime($item[$prop]) < \strtotime($value);
1708 1708
             },
1709 1709
         ];
@@ -1711,7 +1711,7 @@  discard block
 block discarded – undo
1711 1711
         $result = \array_values(
1712 1712
             \array_filter(
1713 1713
                 $this->getArray(),
1714
-                static function ($item) use (
1714
+                static function($item) use (
1715 1715
                     $property,
1716 1716
                     $value,
1717 1717
                     $ops,
@@ -2370,7 +2370,7 @@  discard block
 block discarded – undo
2370 2370
                 \array_uintersect(
2371 2371
                     $this->getArray(),
2372 2372
                     $search,
2373
-                    static function ($a, $b) {
2373
+                    static function($a, $b) {
2374 2374
                         return $a === $b ? 0 : -1;
2375 2375
                     }
2376 2376
                 ),
@@ -2645,13 +2645,13 @@  discard block
 block discarded – undo
2645 2645
         // non recursive
2646 2646
 
2647 2647
         if ($search_values === null) {
2648
-            $arrayFunction = function (): \Generator {
2648
+            $arrayFunction = function(): \Generator {
2649 2649
                 foreach ($this->getGenerator() as $key => $value) {
2650 2650
                     yield $key;
2651 2651
                 }
2652 2652
             };
2653 2653
         } else {
2654
-            $arrayFunction = function () use ($search_values, $strict): \Generator {
2654
+            $arrayFunction = function() use ($search_values, $strict): \Generator {
2655 2655
                 $is_array_tmp = \is_array($search_values);
2656 2656
 
2657 2657
                 foreach ($this->getGenerator() as $key => $value) {
@@ -2851,7 +2851,7 @@  discard block
 block discarded – undo
2851 2851
         $useArguments = \func_num_args() > 2;
2852 2852
 
2853 2853
         return static::create(
2854
-            function () use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) {
2854
+            function() use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) {
2855 2855
                 foreach ($this->getGenerator() as $key => $value) {
2856 2856
                     if ($useArguments) {
2857 2857
                         if ($useKeyAsSecondParameter) {
@@ -3231,7 +3231,7 @@  discard block
 block discarded – undo
3231 3231
      */
3232 3232
     public function nth(int $step, int $offset = 0): self
3233 3233
     {
3234
-        $arrayFunction = function () use ($step, $offset): \Generator {
3234
+        $arrayFunction = function() use ($step, $offset): \Generator {
3235 3235
             $position = 0;
3236 3236
             foreach ($this->getGenerator() as $key => $value) {
3237 3237
                 if ($position++ % $step !== $offset) {
@@ -3378,7 +3378,7 @@  discard block
 block discarded – undo
3378 3378
                 )->prependToEachKey($suffix)
3379 3379
                     ->toArray();
3380 3380
             } else {
3381
-                $result[$key . $suffix] = $item;
3381
+                $result[$key.$suffix] = $item;
3382 3382
             }
3383 3383
         }
3384 3384
 
@@ -3415,7 +3415,7 @@  discard block
 block discarded – undo
3415 3415
             } elseif (\is_object($item) === true) {
3416 3416
                 $result[$key] = $item;
3417 3417
             } else {
3418
-                $result[$key] = $item . $suffix;
3418
+                $result[$key] = $item.$suffix;
3419 3419
             }
3420 3420
         }
3421 3421
 
@@ -4029,7 +4029,7 @@  discard block
 block discarded – undo
4029 4029
     public function replaceValues($search, $replacement = ''): self
4030 4030
     {
4031 4031
         return $this->each(
4032
-            static function ($value) use ($search, $replacement) {
4032
+            static function($value) use ($search, $replacement) {
4033 4033
                 return \str_replace($search, $replacement, $value);
4034 4034
             }
4035 4035
         );
@@ -4527,7 +4527,7 @@  discard block
 block discarded – undo
4527 4527
             );
4528 4528
 
4529 4529
             $results = $arrayy->each(
4530
-                function ($value) use ($sorter) {
4530
+                function($value) use ($sorter) {
4531 4531
                     if (\is_callable($sorter) === true) {
4532 4532
                         return $sorter($value);
4533 4533
                     }
@@ -4615,7 +4615,7 @@  discard block
 block discarded – undo
4615 4615
     public function stripEmpty(): self
4616 4616
     {
4617 4617
         return $this->filter(
4618
-            static function ($item) {
4618
+            static function($item) {
4619 4619
                 if ($item === null) {
4620 4620
                     return false;
4621 4621
                 }
@@ -4744,7 +4744,7 @@  discard block
 block discarded – undo
4744 4744
         // INFO: \array_unique() can't handle e.g. "stdClass"-values in an array
4745 4745
 
4746 4746
         $this->array = $this->reduce(
4747
-            static function ($resultArray, $value) {
4747
+            static function($resultArray, $value) {
4748 4748
                 if (!\in_array($value, $resultArray, true)) {
4749 4749
                     $resultArray[] = $value;
4750 4750
                 }
@@ -4773,7 +4773,7 @@  discard block
 block discarded – undo
4773 4773
 
4774 4774
         $this->array = \array_reduce(
4775 4775
             \array_keys($array),
4776
-            static function ($resultArray, $key) use ($array) {
4776
+            static function($resultArray, $key) use ($array) {
4777 4777
                 if (!\in_array($array[$key], $resultArray, true)) {
4778 4778
                     $resultArray[$key] = $array[$key];
4779 4779
                 }
@@ -4851,7 +4851,7 @@  discard block
 block discarded – undo
4851 4851
     public function values(): self
4852 4852
     {
4853 4853
         return static::create(
4854
-            function () {
4854
+            function() {
4855 4855
                 /** @noinspection YieldFromCanBeUsedInspection */
4856 4856
                 foreach ($this->getGenerator() as $value) {
4857 4857
                     yield $value;
@@ -4899,7 +4899,7 @@  discard block
 block discarded – undo
4899 4899
     public function where(string $keyOrPropertyOrMethod, $value): self
4900 4900
     {
4901 4901
         return $this->filter(
4902
-            function ($item) use ($keyOrPropertyOrMethod, $value) {
4902
+            function($item) use ($keyOrPropertyOrMethod, $value) {
4903 4903
                 $accessorValue = $this->extractValue(
4904 4904
                     $item,
4905 4905
                     $keyOrPropertyOrMethod
@@ -5169,7 +5169,7 @@  discard block
 block discarded – undo
5169 5169
     protected function getPropertiesFromPhpDoc()
5170 5170
     {
5171 5171
         static $PROPERTY_CACHE = [];
5172
-        $cacheKey = 'Class::' . static::class;
5172
+        $cacheKey = 'Class::'.static::class;
5173 5173
 
5174 5174
         if (isset($PROPERTY_CACHE[$cacheKey])) {
5175 5175
             return $PROPERTY_CACHE[$cacheKey];
@@ -5484,7 +5484,7 @@  discard block
 block discarded – undo
5484 5484
                 &&
5485 5485
                 \count(\array_diff_key($this->properties, $data)) > 0
5486 5486
             ) {
5487
-                throw new \TypeError('Property mismatch - input: ' . \print_r(\array_keys($data), true) . ' | expected: ' . \print_r(\array_keys($this->properties), true));
5487
+                throw new \TypeError('Property mismatch - input: '.\print_r(\array_keys($data), true).' | expected: '.\print_r(\array_keys($this->properties), true));
5488 5488
             }
5489 5489
 
5490 5490
             foreach ($data as $key => &$valueInner) {
@@ -5583,7 +5583,7 @@  discard block
 block discarded – undo
5583 5583
             &&
5584 5584
             $this->checkPropertiesMismatch === true
5585 5585
         ) {
5586
-            throw new \TypeError('The key ' . $key . ' does not exists in "properties". Maybe because @property was not used for the class (' . \get_class($this) . ').');
5586
+            throw new \TypeError('The key '.$key.' does not exists in "properties". Maybe because @property was not used for the class ('.\get_class($this).').');
5587 5587
         }
5588 5588
 
5589 5589
         if (isset($this->properties[self::ARRAYY_HELPER_TYPES_FOR_ALL_PROPERTIES])) {
Please login to merge, or discard this patch.