Completed
Push — master ( 2444e2...58ff94 )
by Lars
01:53 queued 13s
created
src/Arrayy.php 1 patch
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
                  */
645 645
                 $this->callAtPath(
646 646
                     $containerPath,
647
-                    static function ($container) use ($lastOffset, &$offsetExists) {
647
+                    static function($container) use ($lastOffset, &$offsetExists) {
648 648
                         $offsetExists = \array_key_exists($lastOffset, $container);
649 649
                     }
650 650
                 );
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
                  */
748 748
                 $this->callAtPath(
749 749
                     \implode($this->pathSeparator, $path),
750
-                    static function (&$offset) use ($pathToUnset) {
750
+                    static function(&$offset) use ($pathToUnset) {
751 751
                         if (\is_array($offset)) {
752 752
                             unset($offset[$pathToUnset]);
753 753
                         } else {
@@ -797,7 +797,7 @@  discard block
 block discarded – undo
797 797
         }
798 798
 
799 799
         if (\strpos($iteratorClass, '\\') === 0) {
800
-            $iteratorClass = '\\' . $iteratorClass;
800
+            $iteratorClass = '\\'.$iteratorClass;
801 801
             if (\class_exists($iteratorClass)) {
802 802
                 /**
803 803
                  * @psalm-suppress PropertyTypeCoercion
@@ -808,7 +808,7 @@  discard block
 block discarded – undo
808 808
             }
809 809
         }
810 810
 
811
-        throw new \InvalidArgumentException('The iterator class does not exist: ' . $iteratorClass);
811
+        throw new \InvalidArgumentException('The iterator class does not exist: '.$iteratorClass);
812 812
     }
813 813
 
814 814
     /**
@@ -978,13 +978,13 @@  discard block
 block discarded – undo
978 978
 
979 979
         foreach ($this->getGenerator() as $key => $item) {
980 980
             if ($item instanceof self) {
981
-                $result[$prefix . $key] = $item->appendToEachKey($prefix);
981
+                $result[$prefix.$key] = $item->appendToEachKey($prefix);
982 982
             } elseif (\is_array($item) === true) {
983
-                $result[$prefix . $key] = self::create($item, $this->iteratorClass, false)
983
+                $result[$prefix.$key] = self::create($item, $this->iteratorClass, false)
984 984
                     ->appendToEachKey($prefix)
985 985
                     ->toArray();
986 986
             } else {
987
-                $result[$prefix . $key] = $item;
987
+                $result[$prefix.$key] = $item;
988 988
             }
989 989
         }
990 990
 
@@ -1015,7 +1015,7 @@  discard block
 block discarded – undo
1015 1015
             } elseif (\is_object($item) === true) {
1016 1016
                 $result[$key] = $item;
1017 1017
             } else {
1018
-                $result[$key] = $prefix . $item;
1018
+                $result[$key] = $prefix.$item;
1019 1019
             }
1020 1020
         }
1021 1021
 
@@ -1223,7 +1223,7 @@  discard block
 block discarded – undo
1223 1223
     public function clean(): self
1224 1224
     {
1225 1225
         return $this->filter(
1226
-            static function ($value) {
1226
+            static function($value) {
1227 1227
                 return (bool) $value;
1228 1228
             }
1229 1229
         );
@@ -1545,9 +1545,9 @@  discard block
 block discarded – undo
1545 1545
 
1546 1546
         foreach ($items as $key => $value) {
1547 1547
             if (\is_array($value) && !empty($value)) {
1548
-                $flatten[] = $this->flatten($delimiter, $prepend . $key . $delimiter, $value);
1548
+                $flatten[] = $this->flatten($delimiter, $prepend.$key.$delimiter, $value);
1549 1549
             } else {
1550
-                $flatten[] = [$prepend . $key => $value];
1550
+                $flatten[] = [$prepend.$key => $value];
1551 1551
             }
1552 1552
         }
1553 1553
 
@@ -1725,7 +1725,7 @@  discard block
 block discarded – undo
1725 1725
          */
1726 1726
         \array_walk(
1727 1727
             $array,
1728
-            static function (&$val) {
1728
+            static function(&$val) {
1729 1729
                 if ((string) $val === $val) {
1730 1730
                     $val = \trim($val);
1731 1731
                 }
@@ -2263,40 +2263,40 @@  discard block
 block discarded – undo
2263 2263
         }
2264 2264
 
2265 2265
         $ops = [
2266
-            'eq' => static function ($item, $prop, $value): bool {
2266
+            'eq' => static function($item, $prop, $value): bool {
2267 2267
                 return $item[$prop] === $value;
2268 2268
             },
2269
-            'gt' => static function ($item, $prop, $value): bool {
2269
+            'gt' => static function($item, $prop, $value): bool {
2270 2270
                 return $item[$prop] > $value;
2271 2271
             },
2272
-            'ge' => static function ($item, $prop, $value): bool {
2272
+            'ge' => static function($item, $prop, $value): bool {
2273 2273
                 return $item[$prop] >= $value;
2274 2274
             },
2275
-            'gte' => static function ($item, $prop, $value): bool {
2275
+            'gte' => static function($item, $prop, $value): bool {
2276 2276
                 return $item[$prop] >= $value;
2277 2277
             },
2278
-            'lt' => static function ($item, $prop, $value): bool {
2278
+            'lt' => static function($item, $prop, $value): bool {
2279 2279
                 return $item[$prop] < $value;
2280 2280
             },
2281
-            'le' => static function ($item, $prop, $value): bool {
2281
+            'le' => static function($item, $prop, $value): bool {
2282 2282
                 return $item[$prop] <= $value;
2283 2283
             },
2284
-            'lte' => static function ($item, $prop, $value): bool {
2284
+            'lte' => static function($item, $prop, $value): bool {
2285 2285
                 return $item[$prop] <= $value;
2286 2286
             },
2287
-            'ne' => static function ($item, $prop, $value): bool {
2287
+            'ne' => static function($item, $prop, $value): bool {
2288 2288
                 return $item[$prop] !== $value;
2289 2289
             },
2290
-            'contains' => static function ($item, $prop, $value): bool {
2290
+            'contains' => static function($item, $prop, $value): bool {
2291 2291
                 return \in_array($item[$prop], (array) $value, true);
2292 2292
             },
2293
-            'notContains' => static function ($item, $prop, $value): bool {
2293
+            'notContains' => static function($item, $prop, $value): bool {
2294 2294
                 return !\in_array($item[$prop], (array) $value, true);
2295 2295
             },
2296
-            'newer' => static function ($item, $prop, $value): bool {
2296
+            'newer' => static function($item, $prop, $value): bool {
2297 2297
                 return \strtotime($item[$prop]) > \strtotime($value);
2298 2298
             },
2299
-            'older' => static function ($item, $prop, $value): bool {
2299
+            'older' => static function($item, $prop, $value): bool {
2300 2300
                 return \strtotime($item[$prop]) < \strtotime($value);
2301 2301
             },
2302 2302
         ];
@@ -2304,7 +2304,7 @@  discard block
 block discarded – undo
2304 2304
         $result = \array_values(
2305 2305
             \array_filter(
2306 2306
                 $this->toArray(false, true),
2307
-                static function ($item) use (
2307
+                static function($item) use (
2308 2308
                     $property,
2309 2309
                     $value,
2310 2310
                     $ops,
@@ -2487,9 +2487,9 @@  discard block
 block discarded – undo
2487 2487
      */
2488 2488
     public function flip(): self
2489 2489
     {
2490
-        $generator = function (): \Generator {
2490
+        $generator = function(): \Generator {
2491 2491
             foreach ($this->getGenerator() as $key => $value) {
2492
-                yield (string)$value => $key;
2492
+                yield (string) $value => $key;
2493 2493
             }
2494 2494
         };
2495 2495
 
@@ -2736,9 +2736,9 @@  discard block
 block discarded – undo
2736 2736
         $jsonObject = \json_decode($json, false);
2737 2737
 
2738 2738
         $mapper = new \Arrayy\Mapper\Json();
2739
-        $mapper->undefinedPropertyHandler = static function ($object, $key, $jsonValue) use ($class) {
2739
+        $mapper->undefinedPropertyHandler = static function($object, $key, $jsonValue) use ($class) {
2740 2740
             if ($class->checkPropertiesMismatchInConstructor) {
2741
-                throw new \TypeError('Property mismatch - input: ' . \print_r(['key' => $key, 'jsonValue' => $jsonValue], true) . ' for object: ' . \get_class($object));
2741
+                throw new \TypeError('Property mismatch - input: '.\print_r(['key' => $key, 'jsonValue' => $jsonValue], true).' for object: '.\get_class($object));
2742 2742
             }
2743 2743
         };
2744 2744
 
@@ -3199,7 +3199,7 @@  discard block
 block discarded – undo
3199 3199
                 \array_uintersect(
3200 3200
                     $this->toArray(),
3201 3201
                     $search,
3202
-                    static function ($a, $b) {
3202
+                    static function($a, $b) {
3203 3203
                         return $a === $b ? 0 : -1;
3204 3204
                     }
3205 3205
                 ),
@@ -3496,13 +3496,13 @@  discard block
 block discarded – undo
3496 3496
         // non recursive
3497 3497
 
3498 3498
         if ($search_values === null) {
3499
-            $arrayFunction = function (): \Generator {
3499
+            $arrayFunction = function(): \Generator {
3500 3500
                 foreach ($this->getGenerator() as $key => $value) {
3501 3501
                     yield $key;
3502 3502
                 }
3503 3503
             };
3504 3504
         } else {
3505
-            $arrayFunction = function () use ($search_values, $strict): \Generator {
3505
+            $arrayFunction = function() use ($search_values, $strict): \Generator {
3506 3506
                 $is_array_tmp = \is_array($search_values);
3507 3507
 
3508 3508
                 /** @noinspection PhpParameterByRefIsNotUsedAsReferenceInspection */
@@ -3747,7 +3747,7 @@  discard block
 block discarded – undo
3747 3747
         $useArguments = \func_num_args() > 2;
3748 3748
 
3749 3749
         return static::create(
3750
-            function () use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) {
3750
+            function() use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) {
3751 3751
                 foreach ($this->getGenerator() as $key => $value) {
3752 3752
                     if ($useArguments) {
3753 3753
                         if ($useKeyAsSecondParameter) {
@@ -4169,7 +4169,7 @@  discard block
 block discarded – undo
4169 4169
      */
4170 4170
     public function nth(int $step, int $offset = 0): self
4171 4171
     {
4172
-        $arrayFunction = function () use ($step, $offset): \Generator {
4172
+        $arrayFunction = function() use ($step, $offset): \Generator {
4173 4173
             $position = 0;
4174 4174
             foreach ($this->getGenerator() as $key => $value) {
4175 4175
                 if ($position++ % $step !== $offset) {
@@ -4203,7 +4203,7 @@  discard block
 block discarded – undo
4203 4203
     {
4204 4204
         $keys = \array_flip($keys);
4205 4205
 
4206
-        $generator = function () use ($keys): \Generator {
4206
+        $generator = function() use ($keys): \Generator {
4207 4207
             foreach ($this->getGenerator() as $key => $value) {
4208 4208
                 if (isset($keys[$key])) {
4209 4209
                     yield $key => $value;
@@ -4342,7 +4342,7 @@  discard block
 block discarded – undo
4342 4342
                 )->prependToEachKey($suffix)
4343 4343
                     ->toArray();
4344 4344
             } else {
4345
-                $result[$key . $suffix] = $item;
4345
+                $result[$key.$suffix] = $item;
4346 4346
             }
4347 4347
         }
4348 4348
 
@@ -4382,7 +4382,7 @@  discard block
 block discarded – undo
4382 4382
             } elseif (\is_object($item) === true) {
4383 4383
                 $result[$key] = $item;
4384 4384
             } else {
4385
-                $result[$key] = $item . $suffix;
4385
+                $result[$key] = $item.$suffix;
4386 4386
             }
4387 4387
         }
4388 4388
 
@@ -5074,7 +5074,7 @@  discard block
 block discarded – undo
5074 5074
          * @psalm-suppress MissingClosureParamType
5075 5075
          */
5076 5076
         return $this->each(
5077
-            static function ($value) use ($search, $replacement) {
5077
+            static function($value) use ($search, $replacement) {
5078 5078
                 return \str_replace($search, $replacement, $value);
5079 5079
             }
5080 5080
         );
@@ -5701,7 +5701,7 @@  discard block
 block discarded – undo
5701 5701
              * @psalm-suppress MissingClosureParamType
5702 5702
              */
5703 5703
             $results = $arrayy->each(
5704
-                function ($value) use ($sorter) {
5704
+                function($value) use ($sorter) {
5705 5705
                     if (\is_callable($sorter) === true) {
5706 5706
                         return $sorter($value);
5707 5707
                     }
@@ -5799,7 +5799,7 @@  discard block
 block discarded – undo
5799 5799
     public function stripEmpty(): self
5800 5800
     {
5801 5801
         return $this->filter(
5802
-            static function ($item) {
5802
+            static function($item) {
5803 5803
                 if ($item === null) {
5804 5804
                     return false;
5805 5805
                 }
@@ -5988,7 +5988,7 @@  discard block
 block discarded – undo
5988 5988
          * @psalm-suppress MissingClosureParamType
5989 5989
          */
5990 5990
         $this->array = $this->reduce(
5991
-            static function ($resultArray, $value) {
5991
+            static function($resultArray, $value) {
5992 5992
                 if (!\in_array($value, $resultArray, true)) {
5993 5993
                     $resultArray[] = $value;
5994 5994
                 }
@@ -6023,7 +6023,7 @@  discard block
 block discarded – undo
6023 6023
          */
6024 6024
         $this->array = \array_reduce(
6025 6025
             \array_keys($array),
6026
-            static function ($resultArray, $key) use ($array) {
6026
+            static function($resultArray, $key) use ($array) {
6027 6027
                 if (!\in_array($array[$key], $resultArray, true)) {
6028 6028
                     $resultArray[$key] = $array[$key];
6029 6029
                 }
@@ -6103,7 +6103,7 @@  discard block
 block discarded – undo
6103 6103
     public function values(): self
6104 6104
     {
6105 6105
         return static::create(
6106
-            function () {
6106
+            function() {
6107 6107
                 /** @noinspection YieldFromCanBeUsedInspection */
6108 6108
                 foreach ($this->getGenerator() as $value) {
6109 6109
                     yield $value;
@@ -6169,7 +6169,7 @@  discard block
 block discarded – undo
6169 6169
     public function where(string $keyOrPropertyOrMethod, $value): self
6170 6170
     {
6171 6171
         return $this->filter(
6172
-            function ($item) use ($keyOrPropertyOrMethod, $value) {
6172
+            function($item) use ($keyOrPropertyOrMethod, $value) {
6173 6173
                 $accessorValue = $this->extractValue(
6174 6174
                     $item,
6175 6175
                     $keyOrPropertyOrMethod
@@ -6459,7 +6459,7 @@  discard block
 block discarded – undo
6459 6459
     protected function getPropertiesFromPhpDoc()
6460 6460
     {
6461 6461
         static $PROPERTY_CACHE = [];
6462
-        $cacheKey = 'Class::' . static::class;
6462
+        $cacheKey = 'Class::'.static::class;
6463 6463
 
6464 6464
         if (isset($PROPERTY_CACHE[$cacheKey])) {
6465 6465
             return $PROPERTY_CACHE[$cacheKey];
@@ -6742,7 +6742,7 @@  discard block
 block discarded – undo
6742 6742
         if ($array === null) {
6743 6743
             $array = [];
6744 6744
         } elseif (!\is_array($array)) {
6745
-            throw new \RuntimeException('Can not set value at this path "' . $key . '" because (' . \gettype($array) . ')"' . \print_r($array, true) . '" is not an array.');
6745
+            throw new \RuntimeException('Can not set value at this path "'.$key.'" because ('.\gettype($array).')"'.\print_r($array, true).'" is not an array.');
6746 6746
         }
6747 6747
 
6748 6748
         $array[$key] = $value;
@@ -6814,7 +6814,7 @@  discard block
 block discarded – undo
6814 6814
                 &&
6815 6815
                 \count(\array_diff_key($properties, $data)) > 0
6816 6816
             ) {
6817
-                throw new \TypeError('Property mismatch - input: ' . \print_r(\array_keys($data), true) . ' | expected: ' . \print_r(\array_keys($properties), true));
6817
+                throw new \TypeError('Property mismatch - input: '.\print_r(\array_keys($data), true).' | expected: '.\print_r(\array_keys($properties), true));
6818 6818
             }
6819 6819
 
6820 6820
             foreach ($data as $key => &$valueInner) {
@@ -6927,7 +6927,7 @@  discard block
 block discarded – undo
6927 6927
              *
6928 6928
              * @return void
6929 6929
              */
6930
-            static function (&$item) {
6930
+            static function(&$item) {
6931 6931
                 if ($item instanceof self) {
6932 6932
                     $item = $item->getArray();
6933 6933
                 }
@@ -6952,7 +6952,7 @@  discard block
 block discarded – undo
6952 6952
             &&
6953 6953
             $this->checkPropertiesMismatch === true
6954 6954
         ) {
6955
-            throw new \TypeError('The key ' . $key . ' does not exists in "properties". Maybe because @property was not used for the class (' . \get_class($this) . ').');
6955
+            throw new \TypeError('The key '.$key.' does not exists in "properties". Maybe because @property was not used for the class ('.\get_class($this).').');
6956 6956
         }
6957 6957
 
6958 6958
         if (isset($this->properties[self::ARRAYY_HELPER_TYPES_FOR_ALL_PROPERTIES])) {
Please login to merge, or discard this patch.