Completed
Push — master ( 3bd5ac...d91a6c )
by Lars
01:37
created
src/Arrayy.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
 
465 465
                     $this->callAtPath(
466 466
                         $containerPath,
467
-                        static function ($container) use ($lastOffset, &$offsetExists) {
467
+                        static function($container) use ($lastOffset, &$offsetExists) {
468 468
                             $offsetExists = \array_key_exists($lastOffset, $container);
469 469
                         }
470 470
                     );
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
 
551 551
                 $this->callAtPath(
552 552
                     \implode($this->pathSeparator, $path),
553
-                    static function (&$offset) use ($pathToUnset) {
553
+                    static function(&$offset) use ($pathToUnset) {
554 554
                         unset($offset[$pathToUnset]);
555 555
                     }
556 556
                 );
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
         }
597 597
 
598 598
         if (\strpos($iteratorClass, '\\') === 0) {
599
-            $iteratorClass = '\\' . $iteratorClass;
599
+            $iteratorClass = '\\'.$iteratorClass;
600 600
             if (\class_exists($iteratorClass)) {
601 601
                 $this->iteratorClass = $iteratorClass;
602 602
 
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
             }
605 605
         }
606 606
 
607
-        throw new \InvalidArgumentException('The iterator class does not exist: ' . $iteratorClass);
607
+        throw new \InvalidArgumentException('The iterator class does not exist: '.$iteratorClass);
608 608
     }
609 609
 
610 610
     /**
@@ -714,13 +714,13 @@  discard block
 block discarded – undo
714 714
 
715 715
         foreach ($this->getGenerator() as $key => $item) {
716 716
             if ($item instanceof self) {
717
-                $result[$prefix . $key] = $item->appendToEachKey($prefix);
717
+                $result[$prefix.$key] = $item->appendToEachKey($prefix);
718 718
             } elseif (\is_array($item) === true) {
719
-                $result[$prefix . $key] = self::create($item, $this->iteratorClass, false)
719
+                $result[$prefix.$key] = self::create($item, $this->iteratorClass, false)
720 720
                     ->appendToEachKey($prefix)
721 721
                     ->toArray();
722 722
             } else {
723
-                $result[$prefix . $key] = $item;
723
+                $result[$prefix.$key] = $item;
724 724
             }
725 725
         }
726 726
 
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
             } elseif (\is_object($item) === true) {
749 749
                 $result[$key] = $item;
750 750
             } else {
751
-                $result[$key] = $prefix . $item;
751
+                $result[$key] = $prefix.$item;
752 752
             }
753 753
         }
754 754
 
@@ -897,7 +897,7 @@  discard block
 block discarded – undo
897 897
     public function clean(): self
898 898
     {
899 899
         return $this->filter(
900
-            static function ($value) {
900
+            static function($value) {
901 901
                 return (bool) $value;
902 902
             }
903 903
         );
@@ -1256,7 +1256,7 @@  discard block
 block discarded – undo
1256 1256
         // trim all string in the array
1257 1257
         \array_walk(
1258 1258
             $array,
1259
-            static function (&$val) {
1259
+            static function(&$val) {
1260 1260
                 if ((string) $val === $val) {
1261 1261
                     $val = \trim($val);
1262 1262
                 }
@@ -1663,40 +1663,40 @@  discard block
 block discarded – undo
1663 1663
         }
1664 1664
 
1665 1665
         $ops = [
1666
-            'eq' => static function ($item, $prop, $value): bool {
1666
+            'eq' => static function($item, $prop, $value): bool {
1667 1667
                 return $item[$prop] === $value;
1668 1668
             },
1669
-            'gt' => static function ($item, $prop, $value): bool {
1669
+            'gt' => static function($item, $prop, $value): bool {
1670 1670
                 return $item[$prop] > $value;
1671 1671
             },
1672
-            'ge' => static function ($item, $prop, $value): bool {
1672
+            'ge' => static function($item, $prop, $value): bool {
1673 1673
                 return $item[$prop] >= $value;
1674 1674
             },
1675
-            'gte' => static function ($item, $prop, $value): bool {
1675
+            'gte' => static function($item, $prop, $value): bool {
1676 1676
                 return $item[$prop] >= $value;
1677 1677
             },
1678
-            'lt' => static function ($item, $prop, $value): bool {
1678
+            'lt' => static function($item, $prop, $value): bool {
1679 1679
                 return $item[$prop] < $value;
1680 1680
             },
1681
-            'le' => static function ($item, $prop, $value): bool {
1681
+            'le' => static function($item, $prop, $value): bool {
1682 1682
                 return $item[$prop] <= $value;
1683 1683
             },
1684
-            'lte' => static function ($item, $prop, $value): bool {
1684
+            'lte' => static function($item, $prop, $value): bool {
1685 1685
                 return $item[$prop] <= $value;
1686 1686
             },
1687
-            'ne' => static function ($item, $prop, $value): bool {
1687
+            'ne' => static function($item, $prop, $value): bool {
1688 1688
                 return $item[$prop] !== $value;
1689 1689
             },
1690
-            'contains' => static function ($item, $prop, $value): bool {
1690
+            'contains' => static function($item, $prop, $value): bool {
1691 1691
                 return \in_array($item[$prop], (array) $value, true);
1692 1692
             },
1693
-            'notContains' => static function ($item, $prop, $value): bool {
1693
+            'notContains' => static function($item, $prop, $value): bool {
1694 1694
                 return !\in_array($item[$prop], (array) $value, true);
1695 1695
             },
1696
-            'newer' => static function ($item, $prop, $value): bool {
1696
+            'newer' => static function($item, $prop, $value): bool {
1697 1697
                 return \strtotime($item[$prop]) > \strtotime($value);
1698 1698
             },
1699
-            'older' => static function ($item, $prop, $value): bool {
1699
+            'older' => static function($item, $prop, $value): bool {
1700 1700
                 return \strtotime($item[$prop]) < \strtotime($value);
1701 1701
             },
1702 1702
         ];
@@ -1704,7 +1704,7 @@  discard block
 block discarded – undo
1704 1704
         $result = \array_values(
1705 1705
             \array_filter(
1706 1706
                 $this->getArray(),
1707
-                static function ($item) use (
1707
+                static function($item) use (
1708 1708
                     $property,
1709 1709
                     $value,
1710 1710
                     $ops,
@@ -2382,7 +2382,7 @@  discard block
 block discarded – undo
2382 2382
                 \array_uintersect(
2383 2383
                     $this->array,
2384 2384
                     $search,
2385
-                    static function ($a, $b) {
2385
+                    static function($a, $b) {
2386 2386
                         return $a === $b ? 0 : -1;
2387 2387
                     }
2388 2388
                 ),
@@ -2657,13 +2657,13 @@  discard block
 block discarded – undo
2657 2657
         // non recursive
2658 2658
 
2659 2659
         if ($search_values === null) {
2660
-            $arrayFunction = function (): \Generator {
2660
+            $arrayFunction = function(): \Generator {
2661 2661
                 foreach ($this->getGenerator() as $key => $value) {
2662 2662
                     yield $key;
2663 2663
                 }
2664 2664
             };
2665 2665
         } else {
2666
-            $arrayFunction = function () use ($search_values, $strict): \Generator {
2666
+            $arrayFunction = function() use ($search_values, $strict): \Generator {
2667 2667
                 $is_array_tmp = \is_array($search_values);
2668 2668
 
2669 2669
                 foreach ($this->getGenerator() as $key => $value) {
@@ -2863,7 +2863,7 @@  discard block
 block discarded – undo
2863 2863
         $useArguments = \func_num_args() > 2;
2864 2864
 
2865 2865
         return static::create(
2866
-            function () use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) {
2866
+            function() use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) {
2867 2867
                 foreach ($this->getGenerator() as $key => $value) {
2868 2868
                     if ($useArguments) {
2869 2869
                         if ($useKeyAsSecondParameter) {
@@ -3340,7 +3340,7 @@  discard block
 block discarded – undo
3340 3340
                 )->prependToEachKey($suffix)
3341 3341
                     ->toArray();
3342 3342
             } else {
3343
-                $result[$key . $suffix] = $item;
3343
+                $result[$key.$suffix] = $item;
3344 3344
             }
3345 3345
         }
3346 3346
 
@@ -3377,7 +3377,7 @@  discard block
 block discarded – undo
3377 3377
             } elseif (\is_object($item) === true) {
3378 3378
                 $result[$key] = $item;
3379 3379
             } else {
3380
-                $result[$key] = $item . $suffix;
3380
+                $result[$key] = $item.$suffix;
3381 3381
             }
3382 3382
         }
3383 3383
 
@@ -3987,7 +3987,7 @@  discard block
 block discarded – undo
3987 3987
     public function replaceValues($search, $replacement = ''): self
3988 3988
     {
3989 3989
         return $this->each(
3990
-            static function ($value) use ($search, $replacement) {
3990
+            static function($value) use ($search, $replacement) {
3991 3991
                 return \str_replace($search, $replacement, $value);
3992 3992
             }
3993 3993
         );
@@ -4485,7 +4485,7 @@  discard block
 block discarded – undo
4485 4485
             );
4486 4486
 
4487 4487
             $results = $arrayy->each(
4488
-                function ($value) use ($sorter) {
4488
+                function($value) use ($sorter) {
4489 4489
                     if (\is_callable($sorter) === true) {
4490 4490
                         return $sorter($value);
4491 4491
                     }
@@ -4568,7 +4568,7 @@  discard block
 block discarded – undo
4568 4568
     public function stripEmpty(): self
4569 4569
     {
4570 4570
         return $this->filter(
4571
-            static function ($item) {
4571
+            static function($item) {
4572 4572
                 if ($item === null) {
4573 4573
                     return false;
4574 4574
                 }
@@ -4656,7 +4656,7 @@  discard block
 block discarded – undo
4656 4656
         // INFO: \array_unique() can't handle e.g. "stdClass"-values in an array
4657 4657
 
4658 4658
         $this->array = $this->reduce(
4659
-            static function ($resultArray, $value) {
4659
+            static function($resultArray, $value) {
4660 4660
                 if (!\in_array($value, $resultArray, true)) {
4661 4661
                     $resultArray[] = $value;
4662 4662
                 }
@@ -4685,7 +4685,7 @@  discard block
 block discarded – undo
4685 4685
 
4686 4686
         $this->array = \array_reduce(
4687 4687
             \array_keys($array),
4688
-            static function ($resultArray, $key) use ($array) {
4688
+            static function($resultArray, $key) use ($array) {
4689 4689
                 if (!\in_array($array[$key], $resultArray, true)) {
4690 4690
                     $resultArray[$key] = $array[$key];
4691 4691
                 }
@@ -4744,7 +4744,7 @@  discard block
 block discarded – undo
4744 4744
     public function values(): self
4745 4745
     {
4746 4746
         return static::create(
4747
-            function () {
4747
+            function() {
4748 4748
                 /** @noinspection YieldFromCanBeUsedInspection */
4749 4749
                 foreach ($this->getGenerator() as $value) {
4750 4750
                     yield $value;
@@ -5001,7 +5001,7 @@  discard block
 block discarded – undo
5001 5001
     protected function getPropertiesFromPhpDoc()
5002 5002
     {
5003 5003
         static $PROPERTY_CACHE = [];
5004
-        $cacheKey = 'Class::' . static::class;
5004
+        $cacheKey = 'Class::'.static::class;
5005 5005
 
5006 5006
         if (isset($PROPERTY_CACHE[$cacheKey])) {
5007 5007
             return $PROPERTY_CACHE[$cacheKey];
@@ -5316,7 +5316,7 @@  discard block
 block discarded – undo
5316 5316
                 &&
5317 5317
                 \count(\array_diff_key($this->properties, $data)) > 0
5318 5318
             ) {
5319
-                throw new \TypeError('Property mismatch - input: ' . \print_r(\array_keys($data), true) . ' | expected: ' . \print_r(\array_keys($this->properties), true));
5319
+                throw new \TypeError('Property mismatch - input: '.\print_r(\array_keys($data), true).' | expected: '.\print_r(\array_keys($this->properties), true));
5320 5320
             }
5321 5321
 
5322 5322
             foreach ($data as $key => &$valueInner) {
@@ -5415,7 +5415,7 @@  discard block
 block discarded – undo
5415 5415
             &&
5416 5416
             $this->checkPropertiesMismatch === true
5417 5417
         ) {
5418
-            throw new \TypeError('The key ' . $key . ' does not exists in "properties". Maybe because @property was not used for the class (' . \get_class($this) . ').');
5418
+            throw new \TypeError('The key '.$key.' does not exists in "properties". Maybe because @property was not used for the class ('.\get_class($this).').');
5419 5419
         }
5420 5420
 
5421 5421
         if (isset($this->properties[self::ARRAYY_HELPER_TYPES_FOR_ALL_PROPERTIES])) {
Please login to merge, or discard this patch.