Completed
Push — master ( 55c956...cdcbe6 )
by Lars
02:11 queued 15s
created
src/Arrayy.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1525,11 +1525,11 @@  discard block
 block discarded – undo
1525 1525
             ),
1526 1526
             \COUNT_NORMAL
1527 1527
         )
1528
-               ===
1529
-               \count(
1530
-                   $needles,
1531
-                   \COUNT_NORMAL
1532
-               );
1528
+                ===
1529
+                \count(
1530
+                    $needles,
1531
+                    \COUNT_NORMAL
1532
+                );
1533 1533
     }
1534 1534
 
1535 1535
     /**
@@ -3459,15 +3459,15 @@  discard block
 block discarded – undo
3459 3459
 
3460 3460
         if ($recursive === true) {
3461 3461
             return $this->array_keys_recursive($this->toArray())
3462
-                   ===
3463
-                   \range(0, \count($this->toArray(), \COUNT_RECURSIVE) - 1);
3462
+                    ===
3463
+                    \range(0, \count($this->toArray(), \COUNT_RECURSIVE) - 1);
3464 3464
         }
3465 3465
 
3466 3466
         // non recursive
3467 3467
 
3468 3468
         return \array_keys($this->toArray())
3469
-               ===
3470
-               \range(0, \count($this->toArray(), \COUNT_NORMAL) - 1);
3469
+                ===
3470
+                \range(0, \count($this->toArray(), \COUNT_NORMAL) - 1);
3471 3471
     }
3472 3472
 
3473 3473
     /**
Please login to merge, or discard this patch.
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
      */
308 308
     public function appendImmutable($value, $key = null): self
309 309
     {
310
-        $generator = function () use ($key, $value): \Generator {
310
+        $generator = function() use ($key, $value): \Generator {
311 311
             if ($this->properties !== []) {
312 312
                 $this->checkType($key, $value);
313 313
             }
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
                  */
689 689
                 $this->callAtPath(
690 690
                     $containerPath,
691
-                    static function ($container) use ($lastOffset, &$offsetExists) {
691
+                    static function($container) use ($lastOffset, &$offsetExists) {
692 692
                         $offsetExists = \array_key_exists($lastOffset, $container);
693 693
                     }
694 694
                 );
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
                  */
792 792
                 $this->callAtPath(
793 793
                     \implode($this->pathSeparator, $path),
794
-                    static function (&$offset) use ($pathToUnset) {
794
+                    static function(&$offset) use ($pathToUnset) {
795 795
                         if (\is_array($offset)) {
796 796
                             unset($offset[$pathToUnset]);
797 797
                         } else {
@@ -841,7 +841,7 @@  discard block
 block discarded – undo
841 841
         }
842 842
 
843 843
         if (\strpos($iteratorClass, '\\') === 0) {
844
-            $iteratorClass = '\\' . $iteratorClass;
844
+            $iteratorClass = '\\'.$iteratorClass;
845 845
             if (\class_exists($iteratorClass)) {
846 846
                 /**
847 847
                  * @psalm-suppress PropertyTypeCoercion
@@ -852,7 +852,7 @@  discard block
 block discarded – undo
852 852
             }
853 853
         }
854 854
 
855
-        throw new \InvalidArgumentException('The iterator class does not exist: ' . $iteratorClass);
855
+        throw new \InvalidArgumentException('The iterator class does not exist: '.$iteratorClass);
856 856
     }
857 857
 
858 858
     /**
@@ -1022,13 +1022,13 @@  discard block
 block discarded – undo
1022 1022
 
1023 1023
         foreach ($this->getGenerator() as $key => $item) {
1024 1024
             if ($item instanceof self) {
1025
-                $result[$prefix . $key] = $item->appendToEachKey($prefix);
1025
+                $result[$prefix.$key] = $item->appendToEachKey($prefix);
1026 1026
             } elseif (\is_array($item) === true) {
1027
-                $result[$prefix . $key] = self::create($item, $this->iteratorClass, false)
1027
+                $result[$prefix.$key] = self::create($item, $this->iteratorClass, false)
1028 1028
                     ->appendToEachKey($prefix)
1029 1029
                     ->toArray();
1030 1030
             } else {
1031
-                $result[$prefix . $key] = $item;
1031
+                $result[$prefix.$key] = $item;
1032 1032
             }
1033 1033
         }
1034 1034
 
@@ -1059,7 +1059,7 @@  discard block
 block discarded – undo
1059 1059
             } elseif (\is_object($item) === true) {
1060 1060
                 $result[$key] = $item;
1061 1061
             } else {
1062
-                $result[$key] = $prefix . $item;
1062
+                $result[$key] = $prefix.$item;
1063 1063
             }
1064 1064
         }
1065 1065
 
@@ -1267,7 +1267,7 @@  discard block
 block discarded – undo
1267 1267
     public function clean(): self
1268 1268
     {
1269 1269
         return $this->filter(
1270
-            static function ($value) {
1270
+            static function($value) {
1271 1271
                 return (bool) $value;
1272 1272
             }
1273 1273
         );
@@ -1598,9 +1598,9 @@  discard block
 block discarded – undo
1598 1598
 
1599 1599
         foreach ($items as $key => $value) {
1600 1600
             if (\is_array($value) && !empty($value)) {
1601
-                $flatten[] = $this->flatten($delimiter, $prepend . $key . $delimiter, $value);
1601
+                $flatten[] = $this->flatten($delimiter, $prepend.$key.$delimiter, $value);
1602 1602
             } else {
1603
-                $flatten[] = [$prepend . $key => $value];
1603
+                $flatten[] = [$prepend.$key => $value];
1604 1604
             }
1605 1605
         }
1606 1606
 
@@ -1778,7 +1778,7 @@  discard block
 block discarded – undo
1778 1778
          */
1779 1779
         \array_walk(
1780 1780
             $array,
1781
-            static function (&$val) {
1781
+            static function(&$val) {
1782 1782
                 if ((string) $val === $val) {
1783 1783
                     $val = \trim($val);
1784 1784
                 }
@@ -2316,40 +2316,40 @@  discard block
 block discarded – undo
2316 2316
         }
2317 2317
 
2318 2318
         $ops = [
2319
-            'eq' => static function ($item, $prop, $value): bool {
2319
+            'eq' => static function($item, $prop, $value): bool {
2320 2320
                 return $item[$prop] === $value;
2321 2321
             },
2322
-            'gt' => static function ($item, $prop, $value): bool {
2322
+            'gt' => static function($item, $prop, $value): bool {
2323 2323
                 return $item[$prop] > $value;
2324 2324
             },
2325
-            'ge' => static function ($item, $prop, $value): bool {
2325
+            'ge' => static function($item, $prop, $value): bool {
2326 2326
                 return $item[$prop] >= $value;
2327 2327
             },
2328
-            'gte' => static function ($item, $prop, $value): bool {
2328
+            'gte' => static function($item, $prop, $value): bool {
2329 2329
                 return $item[$prop] >= $value;
2330 2330
             },
2331
-            'lt' => static function ($item, $prop, $value): bool {
2331
+            'lt' => static function($item, $prop, $value): bool {
2332 2332
                 return $item[$prop] < $value;
2333 2333
             },
2334
-            'le' => static function ($item, $prop, $value): bool {
2334
+            'le' => static function($item, $prop, $value): bool {
2335 2335
                 return $item[$prop] <= $value;
2336 2336
             },
2337
-            'lte' => static function ($item, $prop, $value): bool {
2337
+            'lte' => static function($item, $prop, $value): bool {
2338 2338
                 return $item[$prop] <= $value;
2339 2339
             },
2340
-            'ne' => static function ($item, $prop, $value): bool {
2340
+            'ne' => static function($item, $prop, $value): bool {
2341 2341
                 return $item[$prop] !== $value;
2342 2342
             },
2343
-            'contains' => static function ($item, $prop, $value): bool {
2343
+            'contains' => static function($item, $prop, $value): bool {
2344 2344
                 return \in_array($item[$prop], (array) $value, true);
2345 2345
             },
2346
-            'notContains' => static function ($item, $prop, $value): bool {
2346
+            'notContains' => static function($item, $prop, $value): bool {
2347 2347
                 return !\in_array($item[$prop], (array) $value, true);
2348 2348
             },
2349
-            'newer' => static function ($item, $prop, $value): bool {
2349
+            'newer' => static function($item, $prop, $value): bool {
2350 2350
                 return \strtotime($item[$prop]) > \strtotime($value);
2351 2351
             },
2352
-            'older' => static function ($item, $prop, $value): bool {
2352
+            'older' => static function($item, $prop, $value): bool {
2353 2353
                 return \strtotime($item[$prop]) < \strtotime($value);
2354 2354
             },
2355 2355
         ];
@@ -2357,7 +2357,7 @@  discard block
 block discarded – undo
2357 2357
         $result = \array_values(
2358 2358
             \array_filter(
2359 2359
                 $this->toArray(false, true),
2360
-                static function ($item) use (
2360
+                static function($item) use (
2361 2361
                     $property,
2362 2362
                     $value,
2363 2363
                     $ops,
@@ -2540,7 +2540,7 @@  discard block
 block discarded – undo
2540 2540
      */
2541 2541
     public function flip(): self
2542 2542
     {
2543
-        $generator = function (): \Generator {
2543
+        $generator = function(): \Generator {
2544 2544
             foreach ($this->getGenerator() as $key => $value) {
2545 2545
                 yield (string) $value => $key;
2546 2546
             }
@@ -2789,9 +2789,9 @@  discard block
 block discarded – undo
2789 2789
         $jsonObject = \json_decode($json, false);
2790 2790
 
2791 2791
         $mapper = new \Arrayy\Mapper\Json();
2792
-        $mapper->undefinedPropertyHandler = static function ($object, $key, $jsonValue) use ($class) {
2792
+        $mapper->undefinedPropertyHandler = static function($object, $key, $jsonValue) use ($class) {
2793 2793
             if ($class->checkPropertiesMismatchInConstructor) {
2794
-                throw new \TypeError('Property mismatch - input: ' . \print_r(['key' => $key, 'jsonValue' => $jsonValue], true) . ' for object: ' . \get_class($object));
2794
+                throw new \TypeError('Property mismatch - input: '.\print_r(['key' => $key, 'jsonValue' => $jsonValue], true).' for object: '.\get_class($object));
2795 2795
             }
2796 2796
         };
2797 2797
 
@@ -3152,7 +3152,7 @@  discard block
 block discarded – undo
3152 3152
      */
3153 3153
     public function implode(string $glue = '', string $prefix = ''): string
3154 3154
     {
3155
-        return $prefix . $this->implode_recursive($glue, $this->toArray(), false);
3155
+        return $prefix.$this->implode_recursive($glue, $this->toArray(), false);
3156 3156
     }
3157 3157
 
3158 3158
     /**
@@ -3253,7 +3253,7 @@  discard block
 block discarded – undo
3253 3253
                 \array_uintersect(
3254 3254
                     $this->toArray(),
3255 3255
                     $search,
3256
-                    static function ($a, $b) {
3256
+                    static function($a, $b) {
3257 3257
                         return $a === $b ? 0 : -1;
3258 3258
                     }
3259 3259
                 ),
@@ -3550,13 +3550,13 @@  discard block
 block discarded – undo
3550 3550
         // non recursive
3551 3551
 
3552 3552
         if ($search_values === null) {
3553
-            $arrayFunction = function (): \Generator {
3553
+            $arrayFunction = function(): \Generator {
3554 3554
                 foreach ($this->getGenerator() as $key => $value) {
3555 3555
                     yield $key;
3556 3556
                 }
3557 3557
             };
3558 3558
         } else {
3559
-            $arrayFunction = function () use ($search_values, $strict): \Generator {
3559
+            $arrayFunction = function() use ($search_values, $strict): \Generator {
3560 3560
                 $is_array_tmp = \is_array($search_values);
3561 3561
 
3562 3562
                 /** @noinspection PhpParameterByRefIsNotUsedAsReferenceInspection */
@@ -3801,7 +3801,7 @@  discard block
 block discarded – undo
3801 3801
         $useArguments = \func_num_args() > 2;
3802 3802
 
3803 3803
         return static::create(
3804
-            function () use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) {
3804
+            function() use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) {
3805 3805
                 foreach ($this->getGenerator() as $key => $value) {
3806 3806
                     if ($useArguments) {
3807 3807
                         if ($useKeyAsSecondParameter) {
@@ -4223,7 +4223,7 @@  discard block
 block discarded – undo
4223 4223
      */
4224 4224
     public function nth(int $step, int $offset = 0): self
4225 4225
     {
4226
-        $arrayFunction = function () use ($step, $offset): \Generator {
4226
+        $arrayFunction = function() use ($step, $offset): \Generator {
4227 4227
             $position = 0;
4228 4228
             foreach ($this->getGenerator() as $key => $value) {
4229 4229
                 if ($position++ % $step !== $offset) {
@@ -4257,7 +4257,7 @@  discard block
 block discarded – undo
4257 4257
     {
4258 4258
         $keys = \array_flip($keys);
4259 4259
 
4260
-        $generator = function () use ($keys): \Generator {
4260
+        $generator = function() use ($keys): \Generator {
4261 4261
             foreach ($this->getGenerator() as $key => $value) {
4262 4262
                 if (isset($keys[$key])) {
4263 4263
                     yield $key => $value;
@@ -4387,7 +4387,7 @@  discard block
 block discarded – undo
4387 4387
      */
4388 4388
     public function prependImmutable($value, $key = null)
4389 4389
     {
4390
-        $generator = function () use ($key, $value): \Generator {
4390
+        $generator = function() use ($key, $value): \Generator {
4391 4391
             if ($this->properties !== []) {
4392 4392
                 $this->checkType($key, $value);
4393 4393
             }
@@ -4438,7 +4438,7 @@  discard block
 block discarded – undo
4438 4438
                 )->prependToEachKey($suffix)
4439 4439
                     ->toArray();
4440 4440
             } else {
4441
-                $result[$key . $suffix] = $item;
4441
+                $result[$key.$suffix] = $item;
4442 4442
             }
4443 4443
         }
4444 4444
 
@@ -4478,7 +4478,7 @@  discard block
 block discarded – undo
4478 4478
             } elseif (\is_object($item) === true) {
4479 4479
                 $result[$key] = $item;
4480 4480
             } else {
4481
-                $result[$key] = $item . $suffix;
4481
+                $result[$key] = $item.$suffix;
4482 4482
             }
4483 4483
         }
4484 4484
 
@@ -5170,7 +5170,7 @@  discard block
 block discarded – undo
5170 5170
          * @psalm-suppress MissingClosureParamType
5171 5171
          */
5172 5172
         return $this->each(
5173
-            static function ($value) use ($search, $replacement) {
5173
+            static function($value) use ($search, $replacement) {
5174 5174
                 return \str_replace($search, $replacement, $value);
5175 5175
             }
5176 5176
         );
@@ -5797,7 +5797,7 @@  discard block
 block discarded – undo
5797 5797
              * @psalm-suppress MissingClosureParamType
5798 5798
              */
5799 5799
             $results = $arrayy->each(
5800
-                function ($value) use ($sorter) {
5800
+                function($value) use ($sorter) {
5801 5801
                     if (\is_callable($sorter) === true) {
5802 5802
                         return $sorter($value);
5803 5803
                     }
@@ -5895,7 +5895,7 @@  discard block
 block discarded – undo
5895 5895
     public function stripEmpty(): self
5896 5896
     {
5897 5897
         return $this->filter(
5898
-            static function ($item) {
5898
+            static function($item) {
5899 5899
                 if ($item === null) {
5900 5900
                     return false;
5901 5901
                 }
@@ -6087,7 +6087,7 @@  discard block
 block discarded – undo
6087 6087
          * @psalm-suppress MissingClosureParamType
6088 6088
          */
6089 6089
         $this->array = $this->reduce(
6090
-            static function ($resultArray, $value) {
6090
+            static function($resultArray, $value) {
6091 6091
                 if (!\in_array($value, $resultArray, true)) {
6092 6092
                     $resultArray[] = $value;
6093 6093
                 }
@@ -6122,7 +6122,7 @@  discard block
 block discarded – undo
6122 6122
          */
6123 6123
         $this->array = \array_reduce(
6124 6124
             \array_keys($array),
6125
-            static function ($resultArray, $key) use ($array) {
6125
+            static function($resultArray, $key) use ($array) {
6126 6126
                 if (!\in_array($array[$key], $resultArray, true)) {
6127 6127
                     $resultArray[$key] = $array[$key];
6128 6128
                 }
@@ -6202,7 +6202,7 @@  discard block
 block discarded – undo
6202 6202
     public function values(): self
6203 6203
     {
6204 6204
         return static::create(
6205
-            function () {
6205
+            function() {
6206 6206
                 /** @noinspection YieldFromCanBeUsedInspection */
6207 6207
                 foreach ($this->getGenerator() as $value) {
6208 6208
                     yield $value;
@@ -6268,7 +6268,7 @@  discard block
 block discarded – undo
6268 6268
     public function where(string $keyOrPropertyOrMethod, $value): self
6269 6269
     {
6270 6270
         return $this->filter(
6271
-            function ($item) use ($keyOrPropertyOrMethod, $value) {
6271
+            function($item) use ($keyOrPropertyOrMethod, $value) {
6272 6272
                 $accessorValue = $this->extractValue(
6273 6273
                     $item,
6274 6274
                     $keyOrPropertyOrMethod
@@ -6558,7 +6558,7 @@  discard block
 block discarded – undo
6558 6558
     protected function getPropertiesFromPhpDoc()
6559 6559
     {
6560 6560
         static $PROPERTY_CACHE = [];
6561
-        $cacheKey = 'Class::' . static::class;
6561
+        $cacheKey = 'Class::'.static::class;
6562 6562
 
6563 6563
         if (isset($PROPERTY_CACHE[$cacheKey])) {
6564 6564
             return $PROPERTY_CACHE[$cacheKey];
@@ -6841,7 +6841,7 @@  discard block
 block discarded – undo
6841 6841
         if ($array === null) {
6842 6842
             $array = [];
6843 6843
         } elseif (!\is_array($array)) {
6844
-            throw new \RuntimeException('Can not set value at this path "' . $key . '" because (' . \gettype($array) . ')"' . \print_r($array, true) . '" is not an array.');
6844
+            throw new \RuntimeException('Can not set value at this path "'.$key.'" because ('.\gettype($array).')"'.\print_r($array, true).'" is not an array.');
6845 6845
         }
6846 6846
 
6847 6847
         $array[$key] = $value;
@@ -6913,7 +6913,7 @@  discard block
 block discarded – undo
6913 6913
                 &&
6914 6914
                 \count(\array_diff_key($properties, $data)) > 0
6915 6915
             ) {
6916
-                throw new \TypeError('Property mismatch - input: ' . \print_r(\array_keys($data), true) . ' | expected: ' . \print_r(\array_keys($properties), true));
6916
+                throw new \TypeError('Property mismatch - input: '.\print_r(\array_keys($data), true).' | expected: '.\print_r(\array_keys($properties), true));
6917 6917
             }
6918 6918
 
6919 6919
             foreach ($data as $key => &$valueInner) {
@@ -7026,7 +7026,7 @@  discard block
 block discarded – undo
7026 7026
              *
7027 7027
              * @return void
7028 7028
              */
7029
-            static function (&$item) {
7029
+            static function(&$item) {
7030 7030
                 if ($item instanceof self) {
7031 7031
                     $item = $item->getArray();
7032 7032
                 }
@@ -7051,7 +7051,7 @@  discard block
 block discarded – undo
7051 7051
             &&
7052 7052
             $this->checkPropertiesMismatch === true
7053 7053
         ) {
7054
-            throw new \TypeError('The key ' . $key . ' does not exists in "properties". Maybe because @property was not used for the class (' . \get_class($this) . ').');
7054
+            throw new \TypeError('The key '.$key.' does not exists in "properties". Maybe because @property was not used for the class ('.\get_class($this).').');
7055 7055
         }
7056 7056
 
7057 7057
         if (isset($this->properties[self::ARRAYY_HELPER_TYPES_FOR_ALL_PROPERTIES])) {
Please login to merge, or discard this patch.