Completed
Push — master ( cfbff3...bc22cd )
by Lars
01:31
created
src/Arrayy.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
                  */
626 626
                 $this->callAtPath(
627 627
                     $containerPath,
628
-                    static function ($container) use ($lastOffset, &$offsetExists) {
628
+                    static function($container) use ($lastOffset, &$offsetExists) {
629 629
                         $offsetExists = \array_key_exists($lastOffset, $container);
630 630
                     }
631 631
                 );
@@ -721,7 +721,7 @@  discard block
 block discarded – undo
721 721
                  */
722 722
                 $this->callAtPath(
723 723
                     \implode($this->pathSeparator, $path),
724
-                    static function (&$offset) use ($pathToUnset) {
724
+                    static function(&$offset) use ($pathToUnset) {
725 725
                         if (\is_array($offset)) {
726 726
                             unset($offset[$pathToUnset]);
727 727
                         } else {
@@ -771,7 +771,7 @@  discard block
 block discarded – undo
771 771
         }
772 772
 
773 773
         if (\strpos($iteratorClass, '\\') === 0) {
774
-            $iteratorClass = '\\' . $iteratorClass;
774
+            $iteratorClass = '\\'.$iteratorClass;
775 775
             if (\class_exists($iteratorClass)) {
776 776
                 /**
777 777
                  * @psalm-suppress PropertyTypeCoercion
@@ -782,7 +782,7 @@  discard block
 block discarded – undo
782 782
             }
783 783
         }
784 784
 
785
-        throw new \InvalidArgumentException('The iterator class does not exist: ' . $iteratorClass);
785
+        throw new \InvalidArgumentException('The iterator class does not exist: '.$iteratorClass);
786 786
     }
787 787
 
788 788
     /**
@@ -948,13 +948,13 @@  discard block
 block discarded – undo
948 948
 
949 949
         foreach ($this->getGenerator() as $key => $item) {
950 950
             if ($item instanceof self) {
951
-                $result[$prefix . $key] = $item->appendToEachKey($prefix);
951
+                $result[$prefix.$key] = $item->appendToEachKey($prefix);
952 952
             } elseif (\is_array($item) === true) {
953
-                $result[$prefix . $key] = self::create($item, $this->iteratorClass, false)
953
+                $result[$prefix.$key] = self::create($item, $this->iteratorClass, false)
954 954
                     ->appendToEachKey($prefix)
955 955
                     ->toArray();
956 956
             } else {
957
-                $result[$prefix . $key] = $item;
957
+                $result[$prefix.$key] = $item;
958 958
             }
959 959
         }
960 960
 
@@ -985,7 +985,7 @@  discard block
 block discarded – undo
985 985
             } elseif (\is_object($item) === true) {
986 986
                 $result[$key] = $item;
987 987
             } else {
988
-                $result[$key] = $prefix . $item;
988
+                $result[$key] = $prefix.$item;
989 989
             }
990 990
         }
991 991
 
@@ -1171,7 +1171,7 @@  discard block
 block discarded – undo
1171 1171
     public function clean(): self
1172 1172
     {
1173 1173
         return $this->filter(
1174
-            static function ($value) {
1174
+            static function($value) {
1175 1175
                 return (bool) $value;
1176 1176
             }
1177 1177
         );
@@ -1466,9 +1466,9 @@  discard block
 block discarded – undo
1466 1466
 
1467 1467
         foreach ($items as $key => $value) {
1468 1468
             if (\is_array($value) && !empty($value)) {
1469
-                $flatten[] = $this->flatten($delimiter, $prepend . $key . $delimiter, $value);
1469
+                $flatten[] = $this->flatten($delimiter, $prepend.$key.$delimiter, $value);
1470 1470
             } else {
1471
-                $flatten[] = [$prepend . $key => $value];
1471
+                $flatten[] = [$prepend.$key => $value];
1472 1472
             }
1473 1473
         }
1474 1474
 
@@ -1646,7 +1646,7 @@  discard block
 block discarded – undo
1646 1646
          */
1647 1647
         \array_walk(
1648 1648
             $array,
1649
-            static function (&$val) {
1649
+            static function(&$val) {
1650 1650
                 if ((string) $val === $val) {
1651 1651
                     $val = \trim($val);
1652 1652
                 }
@@ -2158,40 +2158,40 @@  discard block
 block discarded – undo
2158 2158
         }
2159 2159
 
2160 2160
         $ops = [
2161
-            'eq' => static function ($item, $prop, $value): bool {
2161
+            'eq' => static function($item, $prop, $value): bool {
2162 2162
                 return $item[$prop] === $value;
2163 2163
             },
2164
-            'gt' => static function ($item, $prop, $value): bool {
2164
+            'gt' => static function($item, $prop, $value): bool {
2165 2165
                 return $item[$prop] > $value;
2166 2166
             },
2167
-            'ge' => static function ($item, $prop, $value): bool {
2167
+            'ge' => static function($item, $prop, $value): bool {
2168 2168
                 return $item[$prop] >= $value;
2169 2169
             },
2170
-            'gte' => static function ($item, $prop, $value): bool {
2170
+            'gte' => static function($item, $prop, $value): bool {
2171 2171
                 return $item[$prop] >= $value;
2172 2172
             },
2173
-            'lt' => static function ($item, $prop, $value): bool {
2173
+            'lt' => static function($item, $prop, $value): bool {
2174 2174
                 return $item[$prop] < $value;
2175 2175
             },
2176
-            'le' => static function ($item, $prop, $value): bool {
2176
+            'le' => static function($item, $prop, $value): bool {
2177 2177
                 return $item[$prop] <= $value;
2178 2178
             },
2179
-            'lte' => static function ($item, $prop, $value): bool {
2179
+            'lte' => static function($item, $prop, $value): bool {
2180 2180
                 return $item[$prop] <= $value;
2181 2181
             },
2182
-            'ne' => static function ($item, $prop, $value): bool {
2182
+            'ne' => static function($item, $prop, $value): bool {
2183 2183
                 return $item[$prop] !== $value;
2184 2184
             },
2185
-            'contains' => static function ($item, $prop, $value): bool {
2185
+            'contains' => static function($item, $prop, $value): bool {
2186 2186
                 return \in_array($item[$prop], (array) $value, true);
2187 2187
             },
2188
-            'notContains' => static function ($item, $prop, $value): bool {
2188
+            'notContains' => static function($item, $prop, $value): bool {
2189 2189
                 return !\in_array($item[$prop], (array) $value, true);
2190 2190
             },
2191
-            'newer' => static function ($item, $prop, $value): bool {
2191
+            'newer' => static function($item, $prop, $value): bool {
2192 2192
                 return \strtotime($item[$prop]) > \strtotime($value);
2193 2193
             },
2194
-            'older' => static function ($item, $prop, $value): bool {
2194
+            'older' => static function($item, $prop, $value): bool {
2195 2195
                 return \strtotime($item[$prop]) < \strtotime($value);
2196 2196
             },
2197 2197
         ];
@@ -2199,7 +2199,7 @@  discard block
 block discarded – undo
2199 2199
         $result = \array_values(
2200 2200
             \array_filter(
2201 2201
                 $this->toArray(false, true),
2202
-                static function ($item) use (
2202
+                static function($item) use (
2203 2203
                     $property,
2204 2204
                     $value,
2205 2205
                     $ops,
@@ -2953,7 +2953,7 @@  discard block
 block discarded – undo
2953 2953
                 \array_uintersect(
2954 2954
                     $this->toArray(),
2955 2955
                     $search,
2956
-                    static function ($a, $b) {
2956
+                    static function($a, $b) {
2957 2957
                         return $a === $b ? 0 : -1;
2958 2958
                     }
2959 2959
                 ),
@@ -3248,13 +3248,13 @@  discard block
 block discarded – undo
3248 3248
         // non recursive
3249 3249
 
3250 3250
         if ($search_values === null) {
3251
-            $arrayFunction = function (): \Generator {
3251
+            $arrayFunction = function(): \Generator {
3252 3252
                 foreach ($this->getGenerator() as $key => $value) {
3253 3253
                     yield $key;
3254 3254
                 }
3255 3255
             };
3256 3256
         } else {
3257
-            $arrayFunction = function () use ($search_values, $strict): \Generator {
3257
+            $arrayFunction = function() use ($search_values, $strict): \Generator {
3258 3258
                 $is_array_tmp = \is_array($search_values);
3259 3259
 
3260 3260
                 foreach ($this->getGenerator() as $key => $value) {
@@ -3500,7 +3500,7 @@  discard block
 block discarded – undo
3500 3500
         $useArguments = \func_num_args() > 2;
3501 3501
 
3502 3502
         return static::create(
3503
-            function () use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) {
3503
+            function() use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) {
3504 3504
                 foreach ($this->getGenerator() as $key => $value) {
3505 3505
                     if ($useArguments) {
3506 3506
                         if ($useKeyAsSecondParameter) {
@@ -3920,7 +3920,7 @@  discard block
 block discarded – undo
3920 3920
      */
3921 3921
     public function nth(int $step, int $offset = 0): self
3922 3922
     {
3923
-        $arrayFunction = function () use ($step, $offset): \Generator {
3923
+        $arrayFunction = function() use ($step, $offset): \Generator {
3924 3924
             $position = 0;
3925 3925
             foreach ($this->getGenerator() as $key => $value) {
3926 3926
                 if ($position++ % $step !== $offset) {
@@ -4080,7 +4080,7 @@  discard block
 block discarded – undo
4080 4080
                 )->prependToEachKey($suffix)
4081 4081
                     ->toArray();
4082 4082
             } else {
4083
-                $result[$key . $suffix] = $item;
4083
+                $result[$key.$suffix] = $item;
4084 4084
             }
4085 4085
         }
4086 4086
 
@@ -4120,7 +4120,7 @@  discard block
 block discarded – undo
4120 4120
             } elseif (\is_object($item) === true) {
4121 4121
                 $result[$key] = $item;
4122 4122
             } else {
4123
-                $result[$key] = $item . $suffix;
4123
+                $result[$key] = $item.$suffix;
4124 4124
             }
4125 4125
         }
4126 4126
 
@@ -4812,7 +4812,7 @@  discard block
 block discarded – undo
4812 4812
          * @psalm-suppress MissingClosureParamType
4813 4813
          */
4814 4814
         return $this->each(
4815
-            static function ($value) use ($search, $replacement) {
4815
+            static function($value) use ($search, $replacement) {
4816 4816
                 return \str_replace($search, $replacement, $value);
4817 4817
             }
4818 4818
         );
@@ -5437,7 +5437,7 @@  discard block
 block discarded – undo
5437 5437
              * @psalm-suppress MissingClosureParamType
5438 5438
              */
5439 5439
             $results = $arrayy->each(
5440
-                function ($value) use ($sorter) {
5440
+                function($value) use ($sorter) {
5441 5441
                     if (\is_callable($sorter) === true) {
5442 5442
                         return $sorter($value);
5443 5443
                     }
@@ -5535,7 +5535,7 @@  discard block
 block discarded – undo
5535 5535
     public function stripEmpty(): self
5536 5536
     {
5537 5537
         return $this->filter(
5538
-            static function ($item) {
5538
+            static function($item) {
5539 5539
                 if ($item === null) {
5540 5540
                     return false;
5541 5541
                 }
@@ -5724,7 +5724,7 @@  discard block
 block discarded – undo
5724 5724
          * @psalm-suppress MissingClosureParamType
5725 5725
          */
5726 5726
         $this->array = $this->reduce(
5727
-            static function ($resultArray, $value) {
5727
+            static function($resultArray, $value) {
5728 5728
                 if (!\in_array($value, $resultArray, true)) {
5729 5729
                     $resultArray[] = $value;
5730 5730
                 }
@@ -5759,7 +5759,7 @@  discard block
 block discarded – undo
5759 5759
          */
5760 5760
         $this->array = \array_reduce(
5761 5761
             \array_keys($array),
5762
-            static function ($resultArray, $key) use ($array) {
5762
+            static function($resultArray, $key) use ($array) {
5763 5763
                 if (!\in_array($array[$key], $resultArray, true)) {
5764 5764
                     $resultArray[$key] = $array[$key];
5765 5765
                 }
@@ -5839,7 +5839,7 @@  discard block
 block discarded – undo
5839 5839
     public function values(): self
5840 5840
     {
5841 5841
         return static::create(
5842
-            function () {
5842
+            function() {
5843 5843
                 /** @noinspection YieldFromCanBeUsedInspection */
5844 5844
                 foreach ($this->getGenerator() as $value) {
5845 5845
                     yield $value;
@@ -5892,7 +5892,7 @@  discard block
 block discarded – undo
5892 5892
     public function where(string $keyOrPropertyOrMethod, $value): self
5893 5893
     {
5894 5894
         return $this->filter(
5895
-            function ($item) use ($keyOrPropertyOrMethod, $value) {
5895
+            function($item) use ($keyOrPropertyOrMethod, $value) {
5896 5896
                 $accessorValue = $this->extractValue(
5897 5897
                     $item,
5898 5898
                     $keyOrPropertyOrMethod
@@ -6182,7 +6182,7 @@  discard block
 block discarded – undo
6182 6182
     protected function getPropertiesFromPhpDoc()
6183 6183
     {
6184 6184
         static $PROPERTY_CACHE = [];
6185
-        $cacheKey = 'Class::' . static::class;
6185
+        $cacheKey = 'Class::'.static::class;
6186 6186
 
6187 6187
         if (isset($PROPERTY_CACHE[$cacheKey])) {
6188 6188
             return $PROPERTY_CACHE[$cacheKey];
@@ -6524,7 +6524,7 @@  discard block
 block discarded – undo
6524 6524
                 &&
6525 6525
                 \count(\array_diff_key($properties, $data)) > 0
6526 6526
             ) {
6527
-                throw new \TypeError('Property mismatch - input: ' . \print_r(\array_keys($data), true) . ' | expected: ' . \print_r(\array_keys($properties), true));
6527
+                throw new \TypeError('Property mismatch - input: '.\print_r(\array_keys($data), true).' | expected: '.\print_r(\array_keys($properties), true));
6528 6528
             }
6529 6529
 
6530 6530
             foreach ($data as $key => &$valueInner) {
@@ -6637,7 +6637,7 @@  discard block
 block discarded – undo
6637 6637
              *
6638 6638
              * @return void
6639 6639
              */
6640
-            static function (&$item) {
6640
+            static function(&$item) {
6641 6641
                 if ($item instanceof self) {
6642 6642
                     $item = $item->getArray();
6643 6643
                 }
@@ -6662,7 +6662,7 @@  discard block
 block discarded – undo
6662 6662
             &&
6663 6663
             $this->checkPropertiesMismatch === true
6664 6664
         ) {
6665
-            throw new \TypeError('The key ' . $key . ' does not exists in "properties". Maybe because @property was not used for the class (' . \get_class($this) . ').');
6665
+            throw new \TypeError('The key '.$key.' does not exists in "properties". Maybe because @property was not used for the class ('.\get_class($this).').');
6666 6666
         }
6667 6667
 
6668 6668
         if (isset($this->properties[self::ARRAYY_HELPER_TYPES_FOR_ALL_PROPERTIES])) {
Please login to merge, or discard this patch.