@@ -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 | ); |
@@ -1626,9 +1626,9 @@ discard block |
||
1626 | 1626 | |
1627 | 1627 | foreach ($items as $key => $value) { |
1628 | 1628 | if (\is_array($value) && $value !== []) { |
1629 | - $flatten[] = $this->flatten($delimiter, $prepend . $key . $delimiter, $value); |
|
1629 | + $flatten[] = $this->flatten($delimiter, $prepend.$key.$delimiter, $value); |
|
1630 | 1630 | } else { |
1631 | - $flatten[] = [$prepend . $key => $value]; |
|
1631 | + $flatten[] = [$prepend.$key => $value]; |
|
1632 | 1632 | } |
1633 | 1633 | } |
1634 | 1634 | |
@@ -1806,7 +1806,7 @@ discard block |
||
1806 | 1806 | */ |
1807 | 1807 | \array_walk( |
1808 | 1808 | $array, |
1809 | - static function (&$val) { |
|
1809 | + static function(&$val) { |
|
1810 | 1810 | if ((string) $val === $val) { |
1811 | 1811 | $val = \trim($val); |
1812 | 1812 | } |
@@ -2338,7 +2338,7 @@ discard block |
||
2338 | 2338 | } |
2339 | 2339 | |
2340 | 2340 | if ($flag === \ARRAY_FILTER_USE_KEY) { |
2341 | - $generator = function () use ($closure) { |
|
2341 | + $generator = function() use ($closure) { |
|
2342 | 2342 | foreach ($this->getGenerator() as $key => $value) { |
2343 | 2343 | if ($closure($key) === true) { |
2344 | 2344 | yield $key => $value; |
@@ -2346,7 +2346,7 @@ discard block |
||
2346 | 2346 | } |
2347 | 2347 | }; |
2348 | 2348 | } elseif ($flag === \ARRAY_FILTER_USE_BOTH) { |
2349 | - $generator = function () use ($closure) { |
|
2349 | + $generator = function() use ($closure) { |
|
2350 | 2350 | foreach ($this->getGenerator() as $key => $value) { |
2351 | 2351 | if ($closure($value, $key) === true) { |
2352 | 2352 | yield $key => $value; |
@@ -2354,7 +2354,7 @@ discard block |
||
2354 | 2354 | } |
2355 | 2355 | }; |
2356 | 2356 | } else { |
2357 | - $generator = function () use ($closure) { |
|
2357 | + $generator = function() use ($closure) { |
|
2358 | 2358 | foreach ($this->getGenerator() as $key => $value) { |
2359 | 2359 | if ($closure($value) === true) { |
2360 | 2360 | yield $key => $value; |
@@ -2409,40 +2409,40 @@ discard block |
||
2409 | 2409 | } |
2410 | 2410 | |
2411 | 2411 | $ops = [ |
2412 | - 'eq' => static function ($item, $prop, $value): bool { |
|
2412 | + 'eq' => static function($item, $prop, $value): bool { |
|
2413 | 2413 | return $item[$prop] === $value; |
2414 | 2414 | }, |
2415 | - 'gt' => static function ($item, $prop, $value): bool { |
|
2415 | + 'gt' => static function($item, $prop, $value): bool { |
|
2416 | 2416 | return $item[$prop] > $value; |
2417 | 2417 | }, |
2418 | - 'ge' => static function ($item, $prop, $value): bool { |
|
2418 | + 'ge' => static function($item, $prop, $value): bool { |
|
2419 | 2419 | return $item[$prop] >= $value; |
2420 | 2420 | }, |
2421 | - 'gte' => static function ($item, $prop, $value): bool { |
|
2421 | + 'gte' => static function($item, $prop, $value): bool { |
|
2422 | 2422 | return $item[$prop] >= $value; |
2423 | 2423 | }, |
2424 | - 'lt' => static function ($item, $prop, $value): bool { |
|
2424 | + 'lt' => static function($item, $prop, $value): bool { |
|
2425 | 2425 | return $item[$prop] < $value; |
2426 | 2426 | }, |
2427 | - 'le' => static function ($item, $prop, $value): bool { |
|
2427 | + 'le' => static function($item, $prop, $value): bool { |
|
2428 | 2428 | return $item[$prop] <= $value; |
2429 | 2429 | }, |
2430 | - 'lte' => static function ($item, $prop, $value): bool { |
|
2430 | + 'lte' => static function($item, $prop, $value): bool { |
|
2431 | 2431 | return $item[$prop] <= $value; |
2432 | 2432 | }, |
2433 | - 'ne' => static function ($item, $prop, $value): bool { |
|
2433 | + 'ne' => static function($item, $prop, $value): bool { |
|
2434 | 2434 | return $item[$prop] !== $value; |
2435 | 2435 | }, |
2436 | - 'contains' => static function ($item, $prop, $value): bool { |
|
2436 | + 'contains' => static function($item, $prop, $value): bool { |
|
2437 | 2437 | return \in_array($item[$prop], (array) $value, true); |
2438 | 2438 | }, |
2439 | - 'notContains' => static function ($item, $prop, $value): bool { |
|
2439 | + 'notContains' => static function($item, $prop, $value): bool { |
|
2440 | 2440 | return !\in_array($item[$prop], (array) $value, true); |
2441 | 2441 | }, |
2442 | - 'newer' => static function ($item, $prop, $value): bool { |
|
2442 | + 'newer' => static function($item, $prop, $value): bool { |
|
2443 | 2443 | return \strtotime($item[$prop]) > \strtotime($value); |
2444 | 2444 | }, |
2445 | - 'older' => static function ($item, $prop, $value): bool { |
|
2445 | + 'older' => static function($item, $prop, $value): bool { |
|
2446 | 2446 | return \strtotime($item[$prop]) < \strtotime($value); |
2447 | 2447 | }, |
2448 | 2448 | ]; |
@@ -2450,7 +2450,7 @@ discard block |
||
2450 | 2450 | $result = \array_values( |
2451 | 2451 | \array_filter( |
2452 | 2452 | $this->toArray(false, true), |
2453 | - static function ($item) use ( |
|
2453 | + static function($item) use ( |
|
2454 | 2454 | $property, |
2455 | 2455 | $value, |
2456 | 2456 | $ops, |
@@ -2664,7 +2664,7 @@ discard block |
||
2664 | 2664 | */ |
2665 | 2665 | public function flip(): self |
2666 | 2666 | { |
2667 | - $generator = function (): \Generator { |
|
2667 | + $generator = function(): \Generator { |
|
2668 | 2668 | foreach ($this->getGenerator() as $key => $value) { |
2669 | 2669 | yield (string) $value => $key; |
2670 | 2670 | } |
@@ -2925,9 +2925,9 @@ discard block |
||
2925 | 2925 | $jsonObject = \json_decode($json, false); |
2926 | 2926 | |
2927 | 2927 | $mapper = new \Arrayy\Mapper\Json(); |
2928 | - $mapper->undefinedPropertyHandler = static function ($object, $key, $jsonValue) use ($class) { |
|
2928 | + $mapper->undefinedPropertyHandler = static function($object, $key, $jsonValue) use ($class) { |
|
2929 | 2929 | if ($class->checkPropertiesMismatchInConstructor) { |
2930 | - throw new \TypeError('Property mismatch - input: ' . \print_r(['key' => $key, 'jsonValue' => $jsonValue], true) . ' for object: ' . \get_class($object)); |
|
2930 | + throw new \TypeError('Property mismatch - input: '.\print_r(['key' => $key, 'jsonValue' => $jsonValue], true).' for object: '.\get_class($object)); |
|
2931 | 2931 | } |
2932 | 2932 | }; |
2933 | 2933 | |
@@ -3296,7 +3296,7 @@ discard block |
||
3296 | 3296 | */ |
3297 | 3297 | public function implode(string $glue = '', string $prefix = ''): string |
3298 | 3298 | { |
3299 | - return $prefix . $this->implode_recursive($glue, $this->toArray(), false); |
|
3299 | + return $prefix.$this->implode_recursive($glue, $this->toArray(), false); |
|
3300 | 3300 | } |
3301 | 3301 | |
3302 | 3302 | /** |
@@ -3405,7 +3405,7 @@ discard block |
||
3405 | 3405 | \array_uintersect( |
3406 | 3406 | $this->toArray(), |
3407 | 3407 | $search, |
3408 | - static function ($a, $b) { |
|
3408 | + static function($a, $b) { |
|
3409 | 3409 | return $a === $b ? 0 : -1; |
3410 | 3410 | } |
3411 | 3411 | ), |
@@ -3741,13 +3741,13 @@ discard block |
||
3741 | 3741 | // non recursive |
3742 | 3742 | |
3743 | 3743 | if ($search_values === null) { |
3744 | - $arrayFunction = function (): \Generator { |
|
3744 | + $arrayFunction = function(): \Generator { |
|
3745 | 3745 | foreach ($this->getGenerator() as $key => $value) { |
3746 | 3746 | yield $key; |
3747 | 3747 | } |
3748 | 3748 | }; |
3749 | 3749 | } else { |
3750 | - $arrayFunction = function () use ($search_values, $strict): \Generator { |
|
3750 | + $arrayFunction = function() use ($search_values, $strict): \Generator { |
|
3751 | 3751 | $is_array_tmp = \is_array($search_values); |
3752 | 3752 | |
3753 | 3753 | /** @noinspection PhpParameterByRefIsNotUsedAsReferenceInspection */ |
@@ -3987,7 +3987,7 @@ discard block |
||
3987 | 3987 | $useArguments = \func_num_args() > 2; |
3988 | 3988 | |
3989 | 3989 | return static::create( |
3990 | - function () use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
3990 | + function() use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
3991 | 3991 | foreach ($this->getGenerator() as $key => $value) { |
3992 | 3992 | if ($useArguments) { |
3993 | 3993 | if ($useKeyAsSecondParameter) { |
@@ -4474,7 +4474,7 @@ discard block |
||
4474 | 4474 | */ |
4475 | 4475 | public function nth(int $step, int $offset = 0): self |
4476 | 4476 | { |
4477 | - $arrayFunction = function () use ($step, $offset): \Generator { |
|
4477 | + $arrayFunction = function() use ($step, $offset): \Generator { |
|
4478 | 4478 | $position = 0; |
4479 | 4479 | foreach ($this->getGenerator() as $key => $value) { |
4480 | 4480 | if ($position++ % $step !== $offset) { |
@@ -4508,7 +4508,7 @@ discard block |
||
4508 | 4508 | { |
4509 | 4509 | $keys = \array_flip($keys); |
4510 | 4510 | |
4511 | - $generator = function () use ($keys): \Generator { |
|
4511 | + $generator = function() use ($keys): \Generator { |
|
4512 | 4512 | foreach ($this->getGenerator() as $key => $value) { |
4513 | 4513 | if (isset($keys[$key])) { |
4514 | 4514 | yield $key => $value; |
@@ -4638,7 +4638,7 @@ discard block |
||
4638 | 4638 | */ |
4639 | 4639 | public function prependImmutable($value, $key = null) |
4640 | 4640 | { |
4641 | - $generator = function () use ($key, $value): \Generator { |
|
4641 | + $generator = function() use ($key, $value): \Generator { |
|
4642 | 4642 | if ($this->properties !== []) { |
4643 | 4643 | $this->checkType($key, $value); |
4644 | 4644 | } |
@@ -4689,7 +4689,7 @@ discard block |
||
4689 | 4689 | )->prependToEachKey($suffix) |
4690 | 4690 | ->toArray(); |
4691 | 4691 | } else { |
4692 | - $result[$key . $suffix] = $item; |
|
4692 | + $result[$key.$suffix] = $item; |
|
4693 | 4693 | } |
4694 | 4694 | } |
4695 | 4695 | |
@@ -4729,7 +4729,7 @@ discard block |
||
4729 | 4729 | } elseif (\is_object($item) === true) { |
4730 | 4730 | $result[$key] = $item; |
4731 | 4731 | } else { |
4732 | - $result[$key] = $item . $suffix; |
|
4732 | + $result[$key] = $item.$suffix; |
|
4733 | 4733 | } |
4734 | 4734 | } |
4735 | 4735 | |
@@ -5534,7 +5534,7 @@ discard block |
||
5534 | 5534 | * @psalm-suppress MissingClosureParamType |
5535 | 5535 | */ |
5536 | 5536 | return $this->each( |
5537 | - static function ($value) use ($search, $replacement) { |
|
5537 | + static function($value) use ($search, $replacement) { |
|
5538 | 5538 | return \str_replace($search, $replacement, $value); |
5539 | 5539 | } |
5540 | 5540 | ); |
@@ -6218,7 +6218,7 @@ discard block |
||
6218 | 6218 | * @psalm-suppress MissingClosureParamType |
6219 | 6219 | */ |
6220 | 6220 | $results = $arrayy->each( |
6221 | - static function ($value) use ($sorter) { |
|
6221 | + static function($value) use ($sorter) { |
|
6222 | 6222 | if (\is_callable($sorter) === true) { |
6223 | 6223 | return $sorter($value); |
6224 | 6224 | } |
@@ -6291,7 +6291,7 @@ discard block |
||
6291 | 6291 | public function split(int $numberOfPieces = 2, bool $keepKeys = false): self |
6292 | 6292 | { |
6293 | 6293 | if ($keepKeys) { |
6294 | - $generator = function () use ($numberOfPieces) { |
|
6294 | + $generator = function() use ($numberOfPieces) { |
|
6295 | 6295 | $carry = []; |
6296 | 6296 | $i = 1; |
6297 | 6297 | foreach ($this->getGenerator() as $key => $value) { |
@@ -6314,7 +6314,7 @@ discard block |
||
6314 | 6314 | } |
6315 | 6315 | }; |
6316 | 6316 | } else { |
6317 | - $generator = function () use ($numberOfPieces) { |
|
6317 | + $generator = function() use ($numberOfPieces) { |
|
6318 | 6318 | $carry = []; |
6319 | 6319 | $i = 1; |
6320 | 6320 | foreach ($this->getGenerator() as $key => $value) { |
@@ -6361,7 +6361,7 @@ discard block |
||
6361 | 6361 | public function stripEmpty(): self |
6362 | 6362 | { |
6363 | 6363 | return $this->filter( |
6364 | - static function ($item) { |
|
6364 | + static function($item) { |
|
6365 | 6365 | if ($item === null) { |
6366 | 6366 | return false; |
6367 | 6367 | } |
@@ -6565,7 +6565,7 @@ discard block |
||
6565 | 6565 | * @psalm-suppress MissingClosureParamType |
6566 | 6566 | */ |
6567 | 6567 | $this->array = $this->reduce( |
6568 | - static function ($resultArray, $value) { |
|
6568 | + static function($resultArray, $value) { |
|
6569 | 6569 | if (!\in_array($value, $resultArray, true)) { |
6570 | 6570 | $resultArray[] = $value; |
6571 | 6571 | } |
@@ -6604,7 +6604,7 @@ discard block |
||
6604 | 6604 | */ |
6605 | 6605 | $this->array = \array_reduce( |
6606 | 6606 | \array_keys($array), |
6607 | - static function ($resultArray, $key) use ($array) { |
|
6607 | + static function($resultArray, $key) use ($array) { |
|
6608 | 6608 | if (!\in_array($array[$key], $resultArray, true)) { |
6609 | 6609 | $resultArray[$key] = $array[$key]; |
6610 | 6610 | } |
@@ -6689,7 +6689,7 @@ discard block |
||
6689 | 6689 | public function values(): self |
6690 | 6690 | { |
6691 | 6691 | return static::create( |
6692 | - function () { |
|
6692 | + function() { |
|
6693 | 6693 | /** @noinspection YieldFromCanBeUsedInspection */ |
6694 | 6694 | foreach ($this->getGenerator() as $value) { |
6695 | 6695 | yield $value; |
@@ -6766,7 +6766,7 @@ discard block |
||
6766 | 6766 | public function where(string $keyOrPropertyOrMethod, $value): self |
6767 | 6767 | { |
6768 | 6768 | return $this->filter( |
6769 | - function ($item) use ($keyOrPropertyOrMethod, $value) { |
|
6769 | + function($item) use ($keyOrPropertyOrMethod, $value) { |
|
6770 | 6770 | $accessorValue = $this->extractValue( |
6771 | 6771 | $item, |
6772 | 6772 | $keyOrPropertyOrMethod |
@@ -7056,7 +7056,7 @@ discard block |
||
7056 | 7056 | protected function getPropertiesFromPhpDoc() |
7057 | 7057 | { |
7058 | 7058 | static $PROPERTY_CACHE = []; |
7059 | - $cacheKey = 'Class::' . static::class; |
|
7059 | + $cacheKey = 'Class::'.static::class; |
|
7060 | 7060 | |
7061 | 7061 | if (isset($PROPERTY_CACHE[$cacheKey])) { |
7062 | 7062 | return $PROPERTY_CACHE[$cacheKey]; |
@@ -7362,7 +7362,7 @@ discard block |
||
7362 | 7362 | if ($array === null) { |
7363 | 7363 | $array = []; |
7364 | 7364 | } elseif (!\is_array($array)) { |
7365 | - throw new \RuntimeException('Can not set value at this path "' . $key . '" because (' . \gettype($array) . ')"' . \print_r($array, true) . '" is not an array.'); |
|
7365 | + throw new \RuntimeException('Can not set value at this path "'.$key.'" because ('.\gettype($array).')"'.\print_r($array, true).'" is not an array.'); |
|
7366 | 7366 | } |
7367 | 7367 | |
7368 | 7368 | $array[$key] = $value; |
@@ -7434,7 +7434,7 @@ discard block |
||
7434 | 7434 | && |
7435 | 7435 | \count(\array_diff_key($properties, $data)) > 0 |
7436 | 7436 | ) { |
7437 | - throw new \TypeError('Property mismatch - input: ' . \print_r(\array_keys($data), true) . ' | expected: ' . \print_r(\array_keys($properties), true)); |
|
7437 | + throw new \TypeError('Property mismatch - input: '.\print_r(\array_keys($data), true).' | expected: '.\print_r(\array_keys($properties), true)); |
|
7438 | 7438 | } |
7439 | 7439 | |
7440 | 7440 | foreach ($data as $key => &$valueInner) { |
@@ -7551,7 +7551,7 @@ discard block |
||
7551 | 7551 | * |
7552 | 7552 | * @return void |
7553 | 7553 | */ |
7554 | - static function (&$item) { |
|
7554 | + static function(&$item) { |
|
7555 | 7555 | if ($item instanceof self) { |
7556 | 7556 | $item = $item->getArray(); |
7557 | 7557 | } |
@@ -7576,7 +7576,7 @@ discard block |
||
7576 | 7576 | && |
7577 | 7577 | $this->checkPropertiesMismatch === true |
7578 | 7578 | ) { |
7579 | - throw new \TypeError('The key "' . $key . '" does not exists as "@property" phpdoc. (' . \get_class($this) . ').'); |
|
7579 | + throw new \TypeError('The key "'.$key.'" does not exists as "@property" phpdoc. ('.\get_class($this).').'); |
|
7580 | 7580 | } |
7581 | 7581 | |
7582 | 7582 | if (isset($this->properties[self::ARRAYY_HELPER_TYPES_FOR_ALL_PROPERTIES])) { |