@@ -644,7 +644,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | |
@@ -3099,7 +3099,7 @@ discard block |
||
3099 | 3099 | */ |
3100 | 3100 | public function implode(string $glue = '', string $prefix = ''): string |
3101 | 3101 | { |
3102 | - return $prefix . $this->implode_recursive($glue, $this->toArray(), false); |
|
3102 | + return $prefix.$this->implode_recursive($glue, $this->toArray(), false); |
|
3103 | 3103 | } |
3104 | 3104 | |
3105 | 3105 | /** |
@@ -3200,7 +3200,7 @@ discard block |
||
3200 | 3200 | \array_uintersect( |
3201 | 3201 | $this->toArray(), |
3202 | 3202 | $search, |
3203 | - static function ($a, $b) { |
|
3203 | + static function($a, $b) { |
|
3204 | 3204 | return $a === $b ? 0 : -1; |
3205 | 3205 | } |
3206 | 3206 | ), |
@@ -3497,13 +3497,13 @@ discard block |
||
3497 | 3497 | // non recursive |
3498 | 3498 | |
3499 | 3499 | if ($search_values === null) { |
3500 | - $arrayFunction = function (): \Generator { |
|
3500 | + $arrayFunction = function(): \Generator { |
|
3501 | 3501 | foreach ($this->getGenerator() as $key => $value) { |
3502 | 3502 | yield $key; |
3503 | 3503 | } |
3504 | 3504 | }; |
3505 | 3505 | } else { |
3506 | - $arrayFunction = function () use ($search_values, $strict): \Generator { |
|
3506 | + $arrayFunction = function() use ($search_values, $strict): \Generator { |
|
3507 | 3507 | $is_array_tmp = \is_array($search_values); |
3508 | 3508 | |
3509 | 3509 | /** @noinspection PhpParameterByRefIsNotUsedAsReferenceInspection */ |
@@ -3748,7 +3748,7 @@ discard block |
||
3748 | 3748 | $useArguments = \func_num_args() > 2; |
3749 | 3749 | |
3750 | 3750 | return static::create( |
3751 | - function () use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
3751 | + function() use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
3752 | 3752 | foreach ($this->getGenerator() as $key => $value) { |
3753 | 3753 | if ($useArguments) { |
3754 | 3754 | if ($useKeyAsSecondParameter) { |
@@ -4170,7 +4170,7 @@ discard block |
||
4170 | 4170 | */ |
4171 | 4171 | public function nth(int $step, int $offset = 0): self |
4172 | 4172 | { |
4173 | - $arrayFunction = function () use ($step, $offset): \Generator { |
|
4173 | + $arrayFunction = function() use ($step, $offset): \Generator { |
|
4174 | 4174 | $position = 0; |
4175 | 4175 | foreach ($this->getGenerator() as $key => $value) { |
4176 | 4176 | if ($position++ % $step !== $offset) { |
@@ -4204,7 +4204,7 @@ discard block |
||
4204 | 4204 | { |
4205 | 4205 | $keys = \array_flip($keys); |
4206 | 4206 | |
4207 | - $generator = function () use ($keys): \Generator { |
|
4207 | + $generator = function() use ($keys): \Generator { |
|
4208 | 4208 | foreach ($this->getGenerator() as $key => $value) { |
4209 | 4209 | if (isset($keys[$key])) { |
4210 | 4210 | yield $key => $value; |
@@ -4343,7 +4343,7 @@ discard block |
||
4343 | 4343 | )->prependToEachKey($suffix) |
4344 | 4344 | ->toArray(); |
4345 | 4345 | } else { |
4346 | - $result[$key . $suffix] = $item; |
|
4346 | + $result[$key.$suffix] = $item; |
|
4347 | 4347 | } |
4348 | 4348 | } |
4349 | 4349 | |
@@ -4383,7 +4383,7 @@ discard block |
||
4383 | 4383 | } elseif (\is_object($item) === true) { |
4384 | 4384 | $result[$key] = $item; |
4385 | 4385 | } else { |
4386 | - $result[$key] = $item . $suffix; |
|
4386 | + $result[$key] = $item.$suffix; |
|
4387 | 4387 | } |
4388 | 4388 | } |
4389 | 4389 | |
@@ -5075,7 +5075,7 @@ discard block |
||
5075 | 5075 | * @psalm-suppress MissingClosureParamType |
5076 | 5076 | */ |
5077 | 5077 | return $this->each( |
5078 | - static function ($value) use ($search, $replacement) { |
|
5078 | + static function($value) use ($search, $replacement) { |
|
5079 | 5079 | return \str_replace($search, $replacement, $value); |
5080 | 5080 | } |
5081 | 5081 | ); |
@@ -5702,7 +5702,7 @@ discard block |
||
5702 | 5702 | * @psalm-suppress MissingClosureParamType |
5703 | 5703 | */ |
5704 | 5704 | $results = $arrayy->each( |
5705 | - function ($value) use ($sorter) { |
|
5705 | + function($value) use ($sorter) { |
|
5706 | 5706 | if (\is_callable($sorter) === true) { |
5707 | 5707 | return $sorter($value); |
5708 | 5708 | } |
@@ -5800,7 +5800,7 @@ discard block |
||
5800 | 5800 | public function stripEmpty(): self |
5801 | 5801 | { |
5802 | 5802 | return $this->filter( |
5803 | - static function ($item) { |
|
5803 | + static function($item) { |
|
5804 | 5804 | if ($item === null) { |
5805 | 5805 | return false; |
5806 | 5806 | } |
@@ -5989,7 +5989,7 @@ discard block |
||
5989 | 5989 | * @psalm-suppress MissingClosureParamType |
5990 | 5990 | */ |
5991 | 5991 | $this->array = $this->reduce( |
5992 | - static function ($resultArray, $value) { |
|
5992 | + static function($resultArray, $value) { |
|
5993 | 5993 | if (!\in_array($value, $resultArray, true)) { |
5994 | 5994 | $resultArray[] = $value; |
5995 | 5995 | } |
@@ -6024,7 +6024,7 @@ discard block |
||
6024 | 6024 | */ |
6025 | 6025 | $this->array = \array_reduce( |
6026 | 6026 | \array_keys($array), |
6027 | - static function ($resultArray, $key) use ($array) { |
|
6027 | + static function($resultArray, $key) use ($array) { |
|
6028 | 6028 | if (!\in_array($array[$key], $resultArray, true)) { |
6029 | 6029 | $resultArray[$key] = $array[$key]; |
6030 | 6030 | } |
@@ -6104,7 +6104,7 @@ discard block |
||
6104 | 6104 | public function values(): self |
6105 | 6105 | { |
6106 | 6106 | return static::create( |
6107 | - function () { |
|
6107 | + function() { |
|
6108 | 6108 | /** @noinspection YieldFromCanBeUsedInspection */ |
6109 | 6109 | foreach ($this->getGenerator() as $value) { |
6110 | 6110 | yield $value; |
@@ -6170,7 +6170,7 @@ discard block |
||
6170 | 6170 | public function where(string $keyOrPropertyOrMethod, $value): self |
6171 | 6171 | { |
6172 | 6172 | return $this->filter( |
6173 | - function ($item) use ($keyOrPropertyOrMethod, $value) { |
|
6173 | + function($item) use ($keyOrPropertyOrMethod, $value) { |
|
6174 | 6174 | $accessorValue = $this->extractValue( |
6175 | 6175 | $item, |
6176 | 6176 | $keyOrPropertyOrMethod |
@@ -6460,7 +6460,7 @@ discard block |
||
6460 | 6460 | protected function getPropertiesFromPhpDoc() |
6461 | 6461 | { |
6462 | 6462 | static $PROPERTY_CACHE = []; |
6463 | - $cacheKey = 'Class::' . static::class; |
|
6463 | + $cacheKey = 'Class::'.static::class; |
|
6464 | 6464 | |
6465 | 6465 | if (isset($PROPERTY_CACHE[$cacheKey])) { |
6466 | 6466 | return $PROPERTY_CACHE[$cacheKey]; |
@@ -6743,7 +6743,7 @@ discard block |
||
6743 | 6743 | if ($array === null) { |
6744 | 6744 | $array = []; |
6745 | 6745 | } elseif (!\is_array($array)) { |
6746 | - throw new \RuntimeException('Can not set value at this path "' . $key . '" because (' . \gettype($array) . ')"' . \print_r($array, true) . '" is not an array.'); |
|
6746 | + throw new \RuntimeException('Can not set value at this path "'.$key.'" because ('.\gettype($array).')"'.\print_r($array, true).'" is not an array.'); |
|
6747 | 6747 | } |
6748 | 6748 | |
6749 | 6749 | $array[$key] = $value; |
@@ -6815,7 +6815,7 @@ discard block |
||
6815 | 6815 | && |
6816 | 6816 | \count(\array_diff_key($properties, $data)) > 0 |
6817 | 6817 | ) { |
6818 | - throw new \TypeError('Property mismatch - input: ' . \print_r(\array_keys($data), true) . ' | expected: ' . \print_r(\array_keys($properties), true)); |
|
6818 | + throw new \TypeError('Property mismatch - input: '.\print_r(\array_keys($data), true).' | expected: '.\print_r(\array_keys($properties), true)); |
|
6819 | 6819 | } |
6820 | 6820 | |
6821 | 6821 | foreach ($data as $key => &$valueInner) { |
@@ -6928,7 +6928,7 @@ discard block |
||
6928 | 6928 | * |
6929 | 6929 | * @return void |
6930 | 6930 | */ |
6931 | - static function (&$item) { |
|
6931 | + static function(&$item) { |
|
6932 | 6932 | if ($item instanceof self) { |
6933 | 6933 | $item = $item->getArray(); |
6934 | 6934 | } |
@@ -6953,7 +6953,7 @@ discard block |
||
6953 | 6953 | && |
6954 | 6954 | $this->checkPropertiesMismatch === true |
6955 | 6955 | ) { |
6956 | - throw new \TypeError('The key ' . $key . ' does not exists in "properties". Maybe because @property was not used for the class (' . \get_class($this) . ').'); |
|
6956 | + throw new \TypeError('The key '.$key.' does not exists in "properties". Maybe because @property was not used for the class ('.\get_class($this).').'); |
|
6957 | 6957 | } |
6958 | 6958 | |
6959 | 6959 | if (isset($this->properties[self::ARRAYY_HELPER_TYPES_FOR_ALL_PROPERTIES])) { |