Completed
Push — master ( 980f70...0e453d )
by Lars
02:20
created
src/Arrayy.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -638,7 +638,7 @@  discard block
 block discarded – undo
638 638
                  */
639 639
                 $this->callAtPath(
640 640
                     $containerPath,
641
-                    static function ($container) use ($lastOffset, &$offsetExists) {
641
+                    static function($container) use ($lastOffset, &$offsetExists) {
642 642
                         $offsetExists = \array_key_exists($lastOffset, $container);
643 643
                     }
644 644
                 );
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
                  */
735 735
                 $this->callAtPath(
736 736
                     \implode($this->pathSeparator, $path),
737
-                    static function (&$offset) use ($pathToUnset) {
737
+                    static function(&$offset) use ($pathToUnset) {
738 738
                         if (\is_array($offset)) {
739 739
                             unset($offset[$pathToUnset]);
740 740
                         } else {
@@ -784,7 +784,7 @@  discard block
 block discarded – undo
784 784
         }
785 785
 
786 786
         if (\strpos($iteratorClass, '\\') === 0) {
787
-            $iteratorClass = '\\' . $iteratorClass;
787
+            $iteratorClass = '\\'.$iteratorClass;
788 788
             if (\class_exists($iteratorClass)) {
789 789
                 /**
790 790
                  * @psalm-suppress PropertyTypeCoercion
@@ -795,7 +795,7 @@  discard block
 block discarded – undo
795 795
             }
796 796
         }
797 797
 
798
-        throw new \InvalidArgumentException('The iterator class does not exist: ' . $iteratorClass);
798
+        throw new \InvalidArgumentException('The iterator class does not exist: '.$iteratorClass);
799 799
     }
800 800
 
801 801
     /**
@@ -961,13 +961,13 @@  discard block
 block discarded – undo
961 961
 
962 962
         foreach ($this->getGenerator() as $key => $item) {
963 963
             if ($item instanceof self) {
964
-                $result[$prefix . $key] = $item->appendToEachKey($prefix);
964
+                $result[$prefix.$key] = $item->appendToEachKey($prefix);
965 965
             } elseif (\is_array($item) === true) {
966
-                $result[$prefix . $key] = self::create($item, $this->iteratorClass, false)
966
+                $result[$prefix.$key] = self::create($item, $this->iteratorClass, false)
967 967
                     ->appendToEachKey($prefix)
968 968
                     ->toArray();
969 969
             } else {
970
-                $result[$prefix . $key] = $item;
970
+                $result[$prefix.$key] = $item;
971 971
             }
972 972
         }
973 973
 
@@ -998,7 +998,7 @@  discard block
 block discarded – undo
998 998
             } elseif (\is_object($item) === true) {
999 999
                 $result[$key] = $item;
1000 1000
             } else {
1001
-                $result[$key] = $prefix . $item;
1001
+                $result[$key] = $prefix.$item;
1002 1002
             }
1003 1003
         }
1004 1004
 
@@ -1186,7 +1186,7 @@  discard block
 block discarded – undo
1186 1186
     public function clean(): self
1187 1187
     {
1188 1188
         return $this->filter(
1189
-            static function ($value) {
1189
+            static function($value) {
1190 1190
                 return (bool) $value;
1191 1191
             }
1192 1192
         );
@@ -1481,9 +1481,9 @@  discard block
 block discarded – undo
1481 1481
 
1482 1482
         foreach ($items as $key => $value) {
1483 1483
             if (\is_array($value) && !empty($value)) {
1484
-                $flatten[] = $this->flatten($delimiter, $prepend . $key . $delimiter, $value);
1484
+                $flatten[] = $this->flatten($delimiter, $prepend.$key.$delimiter, $value);
1485 1485
             } else {
1486
-                $flatten[] = [$prepend . $key => $value];
1486
+                $flatten[] = [$prepend.$key => $value];
1487 1487
             }
1488 1488
         }
1489 1489
 
@@ -1661,7 +1661,7 @@  discard block
 block discarded – undo
1661 1661
          */
1662 1662
         \array_walk(
1663 1663
             $array,
1664
-            static function (&$val) {
1664
+            static function(&$val) {
1665 1665
                 if ((string) $val === $val) {
1666 1666
                     $val = \trim($val);
1667 1667
                 }
@@ -2173,40 +2173,40 @@  discard block
 block discarded – undo
2173 2173
         }
2174 2174
 
2175 2175
         $ops = [
2176
-            'eq' => static function ($item, $prop, $value): bool {
2176
+            'eq' => static function($item, $prop, $value): bool {
2177 2177
                 return $item[$prop] === $value;
2178 2178
             },
2179
-            'gt' => static function ($item, $prop, $value): bool {
2179
+            'gt' => static function($item, $prop, $value): bool {
2180 2180
                 return $item[$prop] > $value;
2181 2181
             },
2182
-            'ge' => static function ($item, $prop, $value): bool {
2182
+            'ge' => static function($item, $prop, $value): bool {
2183 2183
                 return $item[$prop] >= $value;
2184 2184
             },
2185
-            'gte' => static function ($item, $prop, $value): bool {
2185
+            'gte' => static function($item, $prop, $value): bool {
2186 2186
                 return $item[$prop] >= $value;
2187 2187
             },
2188
-            'lt' => static function ($item, $prop, $value): bool {
2188
+            'lt' => static function($item, $prop, $value): bool {
2189 2189
                 return $item[$prop] < $value;
2190 2190
             },
2191
-            'le' => static function ($item, $prop, $value): bool {
2191
+            'le' => static function($item, $prop, $value): bool {
2192 2192
                 return $item[$prop] <= $value;
2193 2193
             },
2194
-            'lte' => static function ($item, $prop, $value): bool {
2194
+            'lte' => static function($item, $prop, $value): bool {
2195 2195
                 return $item[$prop] <= $value;
2196 2196
             },
2197
-            'ne' => static function ($item, $prop, $value): bool {
2197
+            'ne' => static function($item, $prop, $value): bool {
2198 2198
                 return $item[$prop] !== $value;
2199 2199
             },
2200
-            'contains' => static function ($item, $prop, $value): bool {
2200
+            'contains' => static function($item, $prop, $value): bool {
2201 2201
                 return \in_array($item[$prop], (array) $value, true);
2202 2202
             },
2203
-            'notContains' => static function ($item, $prop, $value): bool {
2203
+            'notContains' => static function($item, $prop, $value): bool {
2204 2204
                 return !\in_array($item[$prop], (array) $value, true);
2205 2205
             },
2206
-            'newer' => static function ($item, $prop, $value): bool {
2206
+            'newer' => static function($item, $prop, $value): bool {
2207 2207
                 return \strtotime($item[$prop]) > \strtotime($value);
2208 2208
             },
2209
-            'older' => static function ($item, $prop, $value): bool {
2209
+            'older' => static function($item, $prop, $value): bool {
2210 2210
                 return \strtotime($item[$prop]) < \strtotime($value);
2211 2211
             },
2212 2212
         ];
@@ -2214,7 +2214,7 @@  discard block
 block discarded – undo
2214 2214
         $result = \array_values(
2215 2215
             \array_filter(
2216 2216
                 $this->toArray(false, true),
2217
-                static function ($item) use (
2217
+                static function($item) use (
2218 2218
                     $property,
2219 2219
                     $value,
2220 2220
                     $ops,
@@ -2996,7 +2996,7 @@  discard block
 block discarded – undo
2996 2996
                 \array_uintersect(
2997 2997
                     $this->toArray(),
2998 2998
                     $search,
2999
-                    static function ($a, $b) {
2999
+                    static function($a, $b) {
3000 3000
                         return $a === $b ? 0 : -1;
3001 3001
                     }
3002 3002
                 ),
@@ -3291,13 +3291,13 @@  discard block
 block discarded – undo
3291 3291
         // non recursive
3292 3292
 
3293 3293
         if ($search_values === null) {
3294
-            $arrayFunction = function (): \Generator {
3294
+            $arrayFunction = function(): \Generator {
3295 3295
                 foreach ($this->getGenerator() as $key => $value) {
3296 3296
                     yield $key;
3297 3297
                 }
3298 3298
             };
3299 3299
         } else {
3300
-            $arrayFunction = function () use ($search_values, $strict): \Generator {
3300
+            $arrayFunction = function() use ($search_values, $strict): \Generator {
3301 3301
                 $is_array_tmp = \is_array($search_values);
3302 3302
 
3303 3303
                 foreach ($this->getGeneratorByReference() as $key => &$value) {
@@ -3543,7 +3543,7 @@  discard block
 block discarded – undo
3543 3543
         $useArguments = \func_num_args() > 2;
3544 3544
 
3545 3545
         return static::create(
3546
-            function () use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) {
3546
+            function() use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) {
3547 3547
                 foreach ($this->getGenerator() as $key => $value) {
3548 3548
                     if ($useArguments) {
3549 3549
                         if ($useKeyAsSecondParameter) {
@@ -3963,7 +3963,7 @@  discard block
 block discarded – undo
3963 3963
      */
3964 3964
     public function nth(int $step, int $offset = 0): self
3965 3965
     {
3966
-        $arrayFunction = function () use ($step, $offset): \Generator {
3966
+        $arrayFunction = function() use ($step, $offset): \Generator {
3967 3967
             $position = 0;
3968 3968
             foreach ($this->getGenerator() as $key => $value) {
3969 3969
                 if ($position++ % $step !== $offset) {
@@ -4123,7 +4123,7 @@  discard block
 block discarded – undo
4123 4123
                 )->prependToEachKey($suffix)
4124 4124
                     ->toArray();
4125 4125
             } else {
4126
-                $result[$key . $suffix] = $item;
4126
+                $result[$key.$suffix] = $item;
4127 4127
             }
4128 4128
         }
4129 4129
 
@@ -4163,7 +4163,7 @@  discard block
 block discarded – undo
4163 4163
             } elseif (\is_object($item) === true) {
4164 4164
                 $result[$key] = $item;
4165 4165
             } else {
4166
-                $result[$key] = $item . $suffix;
4166
+                $result[$key] = $item.$suffix;
4167 4167
             }
4168 4168
         }
4169 4169
 
@@ -4855,7 +4855,7 @@  discard block
 block discarded – undo
4855 4855
          * @psalm-suppress MissingClosureParamType
4856 4856
          */
4857 4857
         return $this->each(
4858
-            static function ($value) use ($search, $replacement) {
4858
+            static function($value) use ($search, $replacement) {
4859 4859
                 return \str_replace($search, $replacement, $value);
4860 4860
             }
4861 4861
         );
@@ -5481,7 +5481,7 @@  discard block
 block discarded – undo
5481 5481
              * @psalm-suppress MissingClosureParamType
5482 5482
              */
5483 5483
             $results = $arrayy->each(
5484
-                function ($value) use ($sorter) {
5484
+                function($value) use ($sorter) {
5485 5485
                     if (\is_callable($sorter) === true) {
5486 5486
                         return $sorter($value);
5487 5487
                     }
@@ -5579,7 +5579,7 @@  discard block
 block discarded – undo
5579 5579
     public function stripEmpty(): self
5580 5580
     {
5581 5581
         return $this->filter(
5582
-            static function ($item) {
5582
+            static function($item) {
5583 5583
                 if ($item === null) {
5584 5584
                     return false;
5585 5585
                 }
@@ -5768,7 +5768,7 @@  discard block
 block discarded – undo
5768 5768
          * @psalm-suppress MissingClosureParamType
5769 5769
          */
5770 5770
         $this->array = $this->reduce(
5771
-            static function ($resultArray, $value) {
5771
+            static function($resultArray, $value) {
5772 5772
                 if (!\in_array($value, $resultArray, true)) {
5773 5773
                     $resultArray[] = $value;
5774 5774
                 }
@@ -5803,7 +5803,7 @@  discard block
 block discarded – undo
5803 5803
          */
5804 5804
         $this->array = \array_reduce(
5805 5805
             \array_keys($array),
5806
-            static function ($resultArray, $key) use ($array) {
5806
+            static function($resultArray, $key) use ($array) {
5807 5807
                 if (!\in_array($array[$key], $resultArray, true)) {
5808 5808
                     $resultArray[$key] = $array[$key];
5809 5809
                 }
@@ -5883,7 +5883,7 @@  discard block
 block discarded – undo
5883 5883
     public function values(): self
5884 5884
     {
5885 5885
         return static::create(
5886
-            function () {
5886
+            function() {
5887 5887
                 /** @noinspection YieldFromCanBeUsedInspection */
5888 5888
                 foreach ($this->getGenerator() as $value) {
5889 5889
                     yield $value;
@@ -5936,7 +5936,7 @@  discard block
 block discarded – undo
5936 5936
     public function where(string $keyOrPropertyOrMethod, $value): self
5937 5937
     {
5938 5938
         return $this->filter(
5939
-            function ($item) use ($keyOrPropertyOrMethod, $value) {
5939
+            function($item) use ($keyOrPropertyOrMethod, $value) {
5940 5940
                 $accessorValue = $this->extractValue(
5941 5941
                     $item,
5942 5942
                     $keyOrPropertyOrMethod
@@ -6226,7 +6226,7 @@  discard block
 block discarded – undo
6226 6226
     protected function getPropertiesFromPhpDoc()
6227 6227
     {
6228 6228
         static $PROPERTY_CACHE = [];
6229
-        $cacheKey = 'Class::' . static::class;
6229
+        $cacheKey = 'Class::'.static::class;
6230 6230
 
6231 6231
         if (isset($PROPERTY_CACHE[$cacheKey])) {
6232 6232
             return $PROPERTY_CACHE[$cacheKey];
@@ -6508,7 +6508,7 @@  discard block
 block discarded – undo
6508 6508
         if ($array === null) {
6509 6509
             $array = [];
6510 6510
         } elseif (!\is_array($array)) {
6511
-            throw new \RuntimeException('Can not set value at this path "' . $key . '" because (' . \gettype($array) . ')"' . \print_r($array, true) . '" is not an array.');
6511
+            throw new \RuntimeException('Can not set value at this path "'.$key.'" because ('.\gettype($array).')"'.\print_r($array, true).'" is not an array.');
6512 6512
         }
6513 6513
 
6514 6514
         $array[$key] = $value;
@@ -6580,7 +6580,7 @@  discard block
 block discarded – undo
6580 6580
                 &&
6581 6581
                 \count(\array_diff_key($properties, $data)) > 0
6582 6582
             ) {
6583
-                throw new \TypeError('Property mismatch - input: ' . \print_r(\array_keys($data), true) . ' | expected: ' . \print_r(\array_keys($properties), true));
6583
+                throw new \TypeError('Property mismatch - input: '.\print_r(\array_keys($data), true).' | expected: '.\print_r(\array_keys($properties), true));
6584 6584
             }
6585 6585
 
6586 6586
             foreach ($data as $key => &$valueInner) {
@@ -6693,7 +6693,7 @@  discard block
 block discarded – undo
6693 6693
              *
6694 6694
              * @return void
6695 6695
              */
6696
-            static function (&$item) {
6696
+            static function(&$item) {
6697 6697
                 if ($item instanceof self) {
6698 6698
                     $item = $item->getArray();
6699 6699
                 }
@@ -6718,7 +6718,7 @@  discard block
 block discarded – undo
6718 6718
             &&
6719 6719
             $this->checkPropertiesMismatch === true
6720 6720
         ) {
6721
-            throw new \TypeError('The key ' . $key . ' does not exists in "properties". Maybe because @property was not used for the class (' . \get_class($this) . ').');
6721
+            throw new \TypeError('The key '.$key.' does not exists in "properties". Maybe because @property was not used for the class ('.\get_class($this).').');
6722 6722
         }
6723 6723
 
6724 6724
         if (isset($this->properties[self::ARRAYY_HELPER_TYPES_FOR_ALL_PROPERTIES])) {
Please login to merge, or discard this patch.