@@ -1542,11 +1542,11 @@ |
||
1542 | 1542 | ), |
1543 | 1543 | \COUNT_NORMAL |
1544 | 1544 | ) |
1545 | - === |
|
1546 | - \count( |
|
1547 | - $needles, |
|
1548 | - \COUNT_NORMAL |
|
1549 | - ); |
|
1545 | + === |
|
1546 | + \count( |
|
1547 | + $needles, |
|
1548 | + \COUNT_NORMAL |
|
1549 | + ); |
|
1550 | 1550 | } |
1551 | 1551 | |
1552 | 1552 | /** |
@@ -307,7 +307,7 @@ discard block |
||
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 | } |
@@ -696,7 +696,7 @@ discard block |
||
696 | 696 | */ |
697 | 697 | $this->callAtPath( |
698 | 698 | $containerPath, |
699 | - static function ($container) use ($lastOffset, &$offsetExists) { |
|
699 | + static function($container) use ($lastOffset, &$offsetExists) { |
|
700 | 700 | $offsetExists = \array_key_exists($lastOffset, $container); |
701 | 701 | } |
702 | 702 | ); |
@@ -799,7 +799,7 @@ discard block |
||
799 | 799 | */ |
800 | 800 | $this->callAtPath( |
801 | 801 | \implode($this->pathSeparator, $path), |
802 | - static function (&$offset) use ($pathToUnset) { |
|
802 | + static function(&$offset) use ($pathToUnset) { |
|
803 | 803 | if (\is_array($offset)) { |
804 | 804 | unset($offset[$pathToUnset]); |
805 | 805 | } else { |
@@ -853,7 +853,7 @@ discard block |
||
853 | 853 | } |
854 | 854 | |
855 | 855 | if (\strpos($iteratorClass, '\\') === 0) { |
856 | - $iteratorClass = '\\' . $iteratorClass; |
|
856 | + $iteratorClass = '\\'.$iteratorClass; |
|
857 | 857 | if (\class_exists($iteratorClass)) { |
858 | 858 | /** |
859 | 859 | * @psalm-suppress PropertyTypeCoercion |
@@ -864,7 +864,7 @@ discard block |
||
864 | 864 | } |
865 | 865 | } |
866 | 866 | |
867 | - throw new \InvalidArgumentException('The iterator class does not exist: ' . $iteratorClass); |
|
867 | + throw new \InvalidArgumentException('The iterator class does not exist: '.$iteratorClass); |
|
868 | 868 | } |
869 | 869 | |
870 | 870 | /** |
@@ -1039,13 +1039,13 @@ discard block |
||
1039 | 1039 | |
1040 | 1040 | foreach ($this->getGenerator() as $key => $item) { |
1041 | 1041 | if ($item instanceof self) { |
1042 | - $result[$prefix . $key] = $item->appendToEachKey($prefix); |
|
1042 | + $result[$prefix.$key] = $item->appendToEachKey($prefix); |
|
1043 | 1043 | } elseif (\is_array($item)) { |
1044 | - $result[$prefix . $key] = self::create($item, $this->iteratorClass, false) |
|
1044 | + $result[$prefix.$key] = self::create($item, $this->iteratorClass, false) |
|
1045 | 1045 | ->appendToEachKey($prefix) |
1046 | 1046 | ->toArray(); |
1047 | 1047 | } else { |
1048 | - $result[$prefix . $key] = $item; |
|
1048 | + $result[$prefix.$key] = $item; |
|
1049 | 1049 | } |
1050 | 1050 | } |
1051 | 1051 | |
@@ -1076,7 +1076,7 @@ discard block |
||
1076 | 1076 | } elseif (\is_object($item) === true) { |
1077 | 1077 | $result[$key] = $item; |
1078 | 1078 | } else { |
1079 | - $result[$key] = $prefix . $item; |
|
1079 | + $result[$key] = $prefix.$item; |
|
1080 | 1080 | } |
1081 | 1081 | } |
1082 | 1082 | |
@@ -1284,7 +1284,7 @@ discard block |
||
1284 | 1284 | public function clean(): self |
1285 | 1285 | { |
1286 | 1286 | return $this->filter( |
1287 | - static function ($value) { |
|
1287 | + static function($value) { |
|
1288 | 1288 | return (bool) $value; |
1289 | 1289 | } |
1290 | 1290 | ); |
@@ -1615,9 +1615,9 @@ discard block |
||
1615 | 1615 | |
1616 | 1616 | foreach ($items as $key => $value) { |
1617 | 1617 | if (\is_array($value) && !empty($value)) { |
1618 | - $flatten[] = $this->flatten($delimiter, $prepend . $key . $delimiter, $value); |
|
1618 | + $flatten[] = $this->flatten($delimiter, $prepend.$key.$delimiter, $value); |
|
1619 | 1619 | } else { |
1620 | - $flatten[] = [$prepend . $key => $value]; |
|
1620 | + $flatten[] = [$prepend.$key => $value]; |
|
1621 | 1621 | } |
1622 | 1622 | } |
1623 | 1623 | |
@@ -1795,7 +1795,7 @@ discard block |
||
1795 | 1795 | */ |
1796 | 1796 | \array_walk( |
1797 | 1797 | $array, |
1798 | - static function (&$val) { |
|
1798 | + static function(&$val) { |
|
1799 | 1799 | if ((string) $val === $val) { |
1800 | 1800 | $val = \trim($val); |
1801 | 1801 | } |
@@ -2327,7 +2327,7 @@ discard block |
||
2327 | 2327 | } |
2328 | 2328 | |
2329 | 2329 | if ($flag === \ARRAY_FILTER_USE_KEY) { |
2330 | - $generator = function () use ($closure) { |
|
2330 | + $generator = function() use ($closure) { |
|
2331 | 2331 | foreach ($this->getGenerator() as $key => $value) { |
2332 | 2332 | if ($closure($key) === true) { |
2333 | 2333 | yield $key => $value; |
@@ -2335,7 +2335,7 @@ discard block |
||
2335 | 2335 | } |
2336 | 2336 | }; |
2337 | 2337 | } elseif ($flag === \ARRAY_FILTER_USE_BOTH) { |
2338 | - $generator = function () use ($closure) { |
|
2338 | + $generator = function() use ($closure) { |
|
2339 | 2339 | foreach ($this->getGenerator() as $key => $value) { |
2340 | 2340 | if ($closure($value, $key) === true) { |
2341 | 2341 | yield $key => $value; |
@@ -2343,7 +2343,7 @@ discard block |
||
2343 | 2343 | } |
2344 | 2344 | }; |
2345 | 2345 | } else { |
2346 | - $generator = function () use ($closure) { |
|
2346 | + $generator = function() use ($closure) { |
|
2347 | 2347 | foreach ($this->getGenerator() as $key => $value) { |
2348 | 2348 | if ($closure($value) === true) { |
2349 | 2349 | yield $key => $value; |
@@ -2398,40 +2398,40 @@ discard block |
||
2398 | 2398 | } |
2399 | 2399 | |
2400 | 2400 | $ops = [ |
2401 | - 'eq' => static function ($item, $prop, $value): bool { |
|
2401 | + 'eq' => static function($item, $prop, $value): bool { |
|
2402 | 2402 | return $item[$prop] === $value; |
2403 | 2403 | }, |
2404 | - 'gt' => static function ($item, $prop, $value): bool { |
|
2404 | + 'gt' => static function($item, $prop, $value): bool { |
|
2405 | 2405 | return $item[$prop] > $value; |
2406 | 2406 | }, |
2407 | - 'ge' => static function ($item, $prop, $value): bool { |
|
2407 | + 'ge' => static function($item, $prop, $value): bool { |
|
2408 | 2408 | return $item[$prop] >= $value; |
2409 | 2409 | }, |
2410 | - 'gte' => static function ($item, $prop, $value): bool { |
|
2410 | + 'gte' => static function($item, $prop, $value): bool { |
|
2411 | 2411 | return $item[$prop] >= $value; |
2412 | 2412 | }, |
2413 | - 'lt' => static function ($item, $prop, $value): bool { |
|
2413 | + 'lt' => static function($item, $prop, $value): bool { |
|
2414 | 2414 | return $item[$prop] < $value; |
2415 | 2415 | }, |
2416 | - 'le' => static function ($item, $prop, $value): bool { |
|
2416 | + 'le' => static function($item, $prop, $value): bool { |
|
2417 | 2417 | return $item[$prop] <= $value; |
2418 | 2418 | }, |
2419 | - 'lte' => static function ($item, $prop, $value): bool { |
|
2419 | + 'lte' => static function($item, $prop, $value): bool { |
|
2420 | 2420 | return $item[$prop] <= $value; |
2421 | 2421 | }, |
2422 | - 'ne' => static function ($item, $prop, $value): bool { |
|
2422 | + 'ne' => static function($item, $prop, $value): bool { |
|
2423 | 2423 | return $item[$prop] !== $value; |
2424 | 2424 | }, |
2425 | - 'contains' => static function ($item, $prop, $value): bool { |
|
2425 | + 'contains' => static function($item, $prop, $value): bool { |
|
2426 | 2426 | return \in_array($item[$prop], (array) $value, true); |
2427 | 2427 | }, |
2428 | - 'notContains' => static function ($item, $prop, $value): bool { |
|
2428 | + 'notContains' => static function($item, $prop, $value): bool { |
|
2429 | 2429 | return !\in_array($item[$prop], (array) $value, true); |
2430 | 2430 | }, |
2431 | - 'newer' => static function ($item, $prop, $value): bool { |
|
2431 | + 'newer' => static function($item, $prop, $value): bool { |
|
2432 | 2432 | return \strtotime($item[$prop]) > \strtotime($value); |
2433 | 2433 | }, |
2434 | - 'older' => static function ($item, $prop, $value): bool { |
|
2434 | + 'older' => static function($item, $prop, $value): bool { |
|
2435 | 2435 | return \strtotime($item[$prop]) < \strtotime($value); |
2436 | 2436 | }, |
2437 | 2437 | ]; |
@@ -2439,7 +2439,7 @@ discard block |
||
2439 | 2439 | $result = \array_values( |
2440 | 2440 | \array_filter( |
2441 | 2441 | $this->toArray(false, true), |
2442 | - static function ($item) use ( |
|
2442 | + static function($item) use ( |
|
2443 | 2443 | $property, |
2444 | 2444 | $value, |
2445 | 2445 | $ops, |
@@ -2653,7 +2653,7 @@ discard block |
||
2653 | 2653 | */ |
2654 | 2654 | public function flip(): self |
2655 | 2655 | { |
2656 | - $generator = function (): \Generator { |
|
2656 | + $generator = function(): \Generator { |
|
2657 | 2657 | foreach ($this->getGenerator() as $key => $value) { |
2658 | 2658 | yield (string) $value => $key; |
2659 | 2659 | } |
@@ -2914,9 +2914,9 @@ discard block |
||
2914 | 2914 | $jsonObject = \json_decode($json, false); |
2915 | 2915 | |
2916 | 2916 | $mapper = new \Arrayy\Mapper\Json(); |
2917 | - $mapper->undefinedPropertyHandler = static function ($object, $key, $jsonValue) use ($class) { |
|
2917 | + $mapper->undefinedPropertyHandler = static function($object, $key, $jsonValue) use ($class) { |
|
2918 | 2918 | if ($class->checkPropertiesMismatchInConstructor) { |
2919 | - throw new \TypeError('Property mismatch - input: ' . \print_r(['key' => $key, 'jsonValue' => $jsonValue], true) . ' for object: ' . \get_class($object)); |
|
2919 | + throw new \TypeError('Property mismatch - input: '.\print_r(['key' => $key, 'jsonValue' => $jsonValue], true).' for object: '.\get_class($object)); |
|
2920 | 2920 | } |
2921 | 2921 | }; |
2922 | 2922 | |
@@ -3285,7 +3285,7 @@ discard block |
||
3285 | 3285 | */ |
3286 | 3286 | public function implode(string $glue = '', string $prefix = ''): string |
3287 | 3287 | { |
3288 | - return $prefix . $this->implode_recursive($glue, $this->toArray(), false); |
|
3288 | + return $prefix.$this->implode_recursive($glue, $this->toArray(), false); |
|
3289 | 3289 | } |
3290 | 3290 | |
3291 | 3291 | /** |
@@ -3394,7 +3394,7 @@ discard block |
||
3394 | 3394 | \array_uintersect( |
3395 | 3395 | $this->toArray(), |
3396 | 3396 | $search, |
3397 | - static function ($a, $b) { |
|
3397 | + static function($a, $b) { |
|
3398 | 3398 | return $a === $b ? 0 : -1; |
3399 | 3399 | } |
3400 | 3400 | ), |
@@ -3730,13 +3730,13 @@ discard block |
||
3730 | 3730 | // non recursive |
3731 | 3731 | |
3732 | 3732 | if ($search_values === null) { |
3733 | - $arrayFunction = function (): \Generator { |
|
3733 | + $arrayFunction = function(): \Generator { |
|
3734 | 3734 | foreach ($this->getGenerator() as $key => $value) { |
3735 | 3735 | yield $key; |
3736 | 3736 | } |
3737 | 3737 | }; |
3738 | 3738 | } else { |
3739 | - $arrayFunction = function () use ($search_values, $strict): \Generator { |
|
3739 | + $arrayFunction = function() use ($search_values, $strict): \Generator { |
|
3740 | 3740 | $is_array_tmp = \is_array($search_values); |
3741 | 3741 | |
3742 | 3742 | /** @noinspection PhpParameterByRefIsNotUsedAsReferenceInspection */ |
@@ -3976,7 +3976,7 @@ discard block |
||
3976 | 3976 | $useArguments = \func_num_args() > 2; |
3977 | 3977 | |
3978 | 3978 | return static::create( |
3979 | - function () use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
3979 | + function() use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
3980 | 3980 | foreach ($this->getGenerator() as $key => $value) { |
3981 | 3981 | if ($useArguments) { |
3982 | 3982 | if ($useKeyAsSecondParameter) { |
@@ -4448,7 +4448,7 @@ discard block |
||
4448 | 4448 | */ |
4449 | 4449 | public function nth(int $step, int $offset = 0): self |
4450 | 4450 | { |
4451 | - $arrayFunction = function () use ($step, $offset): \Generator { |
|
4451 | + $arrayFunction = function() use ($step, $offset): \Generator { |
|
4452 | 4452 | $position = 0; |
4453 | 4453 | foreach ($this->getGenerator() as $key => $value) { |
4454 | 4454 | if ($position++ % $step !== $offset) { |
@@ -4482,7 +4482,7 @@ discard block |
||
4482 | 4482 | { |
4483 | 4483 | $keys = \array_flip($keys); |
4484 | 4484 | |
4485 | - $generator = function () use ($keys): \Generator { |
|
4485 | + $generator = function() use ($keys): \Generator { |
|
4486 | 4486 | foreach ($this->getGenerator() as $key => $value) { |
4487 | 4487 | if (isset($keys[$key])) { |
4488 | 4488 | yield $key => $value; |
@@ -4612,7 +4612,7 @@ discard block |
||
4612 | 4612 | */ |
4613 | 4613 | public function prependImmutable($value, $key = null) |
4614 | 4614 | { |
4615 | - $generator = function () use ($key, $value): \Generator { |
|
4615 | + $generator = function() use ($key, $value): \Generator { |
|
4616 | 4616 | if ($this->properties !== []) { |
4617 | 4617 | $this->checkType($key, $value); |
4618 | 4618 | } |
@@ -4663,7 +4663,7 @@ discard block |
||
4663 | 4663 | )->prependToEachKey($suffix) |
4664 | 4664 | ->toArray(); |
4665 | 4665 | } else { |
4666 | - $result[$key . $suffix] = $item; |
|
4666 | + $result[$key.$suffix] = $item; |
|
4667 | 4667 | } |
4668 | 4668 | } |
4669 | 4669 | |
@@ -4703,7 +4703,7 @@ discard block |
||
4703 | 4703 | } elseif (\is_object($item) === true) { |
4704 | 4704 | $result[$key] = $item; |
4705 | 4705 | } else { |
4706 | - $result[$key] = $item . $suffix; |
|
4706 | + $result[$key] = $item.$suffix; |
|
4707 | 4707 | } |
4708 | 4708 | } |
4709 | 4709 | |
@@ -5508,7 +5508,7 @@ discard block |
||
5508 | 5508 | * @psalm-suppress MissingClosureParamType |
5509 | 5509 | */ |
5510 | 5510 | return $this->each( |
5511 | - static function ($value) use ($search, $replacement) { |
|
5511 | + static function($value) use ($search, $replacement) { |
|
5512 | 5512 | return \str_replace($search, $replacement, $value); |
5513 | 5513 | } |
5514 | 5514 | ); |
@@ -6192,7 +6192,7 @@ discard block |
||
6192 | 6192 | * @psalm-suppress MissingClosureParamType |
6193 | 6193 | */ |
6194 | 6194 | $results = $arrayy->each( |
6195 | - function ($value) use ($sorter) { |
|
6195 | + function($value) use ($sorter) { |
|
6196 | 6196 | if (\is_callable($sorter) === true) { |
6197 | 6197 | return $sorter($value); |
6198 | 6198 | } |
@@ -6265,7 +6265,7 @@ discard block |
||
6265 | 6265 | public function split(int $numberOfPieces = 2, bool $keepKeys = false): self |
6266 | 6266 | { |
6267 | 6267 | if ($keepKeys) { |
6268 | - $generator = function () use ($numberOfPieces) { |
|
6268 | + $generator = function() use ($numberOfPieces) { |
|
6269 | 6269 | $carry = []; |
6270 | 6270 | $i = 1; |
6271 | 6271 | foreach ($this->getGenerator() as $key => $value) { |
@@ -6288,7 +6288,7 @@ discard block |
||
6288 | 6288 | } |
6289 | 6289 | }; |
6290 | 6290 | } else { |
6291 | - $generator = function () use ($numberOfPieces) { |
|
6291 | + $generator = function() use ($numberOfPieces) { |
|
6292 | 6292 | $carry = []; |
6293 | 6293 | $i = 1; |
6294 | 6294 | foreach ($this->getGenerator() as $key => $value) { |
@@ -6335,7 +6335,7 @@ discard block |
||
6335 | 6335 | public function stripEmpty(): self |
6336 | 6336 | { |
6337 | 6337 | return $this->filter( |
6338 | - static function ($item) { |
|
6338 | + static function($item) { |
|
6339 | 6339 | if ($item === null) { |
6340 | 6340 | return false; |
6341 | 6341 | } |
@@ -6539,7 +6539,7 @@ discard block |
||
6539 | 6539 | * @psalm-suppress MissingClosureParamType |
6540 | 6540 | */ |
6541 | 6541 | $this->array = $this->reduce( |
6542 | - static function ($resultArray, $value) { |
|
6542 | + static function($resultArray, $value) { |
|
6543 | 6543 | if (!\in_array($value, $resultArray, true)) { |
6544 | 6544 | $resultArray[] = $value; |
6545 | 6545 | } |
@@ -6578,7 +6578,7 @@ discard block |
||
6578 | 6578 | */ |
6579 | 6579 | $this->array = \array_reduce( |
6580 | 6580 | \array_keys($array), |
6581 | - static function ($resultArray, $key) use ($array) { |
|
6581 | + static function($resultArray, $key) use ($array) { |
|
6582 | 6582 | if (!\in_array($array[$key], $resultArray, true)) { |
6583 | 6583 | $resultArray[$key] = $array[$key]; |
6584 | 6584 | } |
@@ -6663,7 +6663,7 @@ discard block |
||
6663 | 6663 | public function values(): self |
6664 | 6664 | { |
6665 | 6665 | return static::create( |
6666 | - function () { |
|
6666 | + function() { |
|
6667 | 6667 | /** @noinspection YieldFromCanBeUsedInspection */ |
6668 | 6668 | foreach ($this->getGenerator() as $value) { |
6669 | 6669 | yield $value; |
@@ -6741,7 +6741,7 @@ discard block |
||
6741 | 6741 | public function where(string $keyOrPropertyOrMethod, $value): self |
6742 | 6742 | { |
6743 | 6743 | return $this->filter( |
6744 | - function ($item) use ($keyOrPropertyOrMethod, $value) { |
|
6744 | + function($item) use ($keyOrPropertyOrMethod, $value) { |
|
6745 | 6745 | $accessorValue = $this->extractValue( |
6746 | 6746 | $item, |
6747 | 6747 | $keyOrPropertyOrMethod |
@@ -7031,7 +7031,7 @@ discard block |
||
7031 | 7031 | protected function getPropertiesFromPhpDoc() |
7032 | 7032 | { |
7033 | 7033 | static $PROPERTY_CACHE = []; |
7034 | - $cacheKey = 'Class::' . static::class; |
|
7034 | + $cacheKey = 'Class::'.static::class; |
|
7035 | 7035 | |
7036 | 7036 | if (isset($PROPERTY_CACHE[$cacheKey])) { |
7037 | 7037 | return $PROPERTY_CACHE[$cacheKey]; |
@@ -7337,7 +7337,7 @@ discard block |
||
7337 | 7337 | if ($array === null) { |
7338 | 7338 | $array = []; |
7339 | 7339 | } elseif (!\is_array($array)) { |
7340 | - throw new \RuntimeException('Can not set value at this path "' . $key . '" because (' . \gettype($array) . ')"' . \print_r($array, true) . '" is not an array.'); |
|
7340 | + throw new \RuntimeException('Can not set value at this path "'.$key.'" because ('.\gettype($array).')"'.\print_r($array, true).'" is not an array.'); |
|
7341 | 7341 | } |
7342 | 7342 | |
7343 | 7343 | $array[$key] = $value; |
@@ -7409,7 +7409,7 @@ discard block |
||
7409 | 7409 | && |
7410 | 7410 | \count(\array_diff_key($properties, $data)) > 0 |
7411 | 7411 | ) { |
7412 | - throw new \TypeError('Property mismatch - input: ' . \print_r(\array_keys($data), true) . ' | expected: ' . \print_r(\array_keys($properties), true)); |
|
7412 | + throw new \TypeError('Property mismatch - input: '.\print_r(\array_keys($data), true).' | expected: '.\print_r(\array_keys($properties), true)); |
|
7413 | 7413 | } |
7414 | 7414 | |
7415 | 7415 | foreach ($data as $key => &$valueInner) { |
@@ -7527,7 +7527,7 @@ discard block |
||
7527 | 7527 | * |
7528 | 7528 | * @return void |
7529 | 7529 | */ |
7530 | - static function (&$item) { |
|
7530 | + static function(&$item) { |
|
7531 | 7531 | if ($item instanceof self) { |
7532 | 7532 | $item = $item->getArray(); |
7533 | 7533 | } |
@@ -7552,7 +7552,7 @@ discard block |
||
7552 | 7552 | && |
7553 | 7553 | $this->checkPropertiesMismatch === true |
7554 | 7554 | ) { |
7555 | - throw new \TypeError('The key "' . $key . '" does not exists as "@property" phpdoc. (' . \get_class($this) . ').'); |
|
7555 | + throw new \TypeError('The key "'.$key.'" does not exists as "@property" phpdoc. ('.\get_class($this).').'); |
|
7556 | 7556 | } |
7557 | 7557 | |
7558 | 7558 | if (isset($this->properties[self::ARRAYY_HELPER_TYPES_FOR_ALL_PROPERTIES])) { |