@@ -42,7 +42,7 @@ |
||
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | if (!isset(static::$methodArgs[$name])) { |
| 45 | - throw new \BadMethodCallException($name . ' is not a valid method'); |
|
| 45 | + throw new \BadMethodCallException($name.' is not a valid method'); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | $numArgs = \count($arguments); |
@@ -90,9 +90,9 @@ discard block |
||
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | if ($type instanceof \phpDocumentor\Reflection\Types\Array_) { |
| 93 | - $valueTypeTmp = $type->getValueType() . ''; |
|
| 93 | + $valueTypeTmp = $type->getValueType().''; |
|
| 94 | 94 | if ($valueTypeTmp !== 'mixed') { |
| 95 | - return $valueTypeTmp . '[]'; |
|
| 95 | + return $valueTypeTmp.'[]'; |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | return 'array'; |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | return 'resource'; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - return $type . ''; |
|
| 141 | + return $type.''; |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | /** |
@@ -150,6 +150,6 @@ discard block |
||
| 150 | 150 | */ |
| 151 | 151 | public function throwException($expectedTypes, $value, $type): \Throwable |
| 152 | 152 | { |
| 153 | - throw new \TypeError("Invalid type: expected \"{$this->property_name}\" to be of type {{$expectedTypes}}, instead got value \"" . $this->valueToString($value) . '" (' . \print_r($value, true) . ") with type {{$type}}."); |
|
| 153 | + throw new \TypeError("Invalid type: expected \"{$this->property_name}\" to be of type {{$expectedTypes}}, instead got value \"".$this->valueToString($value).'" ('.\print_r($value, true).") with type {{$type}}."); |
|
| 154 | 154 | } |
| 155 | 155 | } |
@@ -111,11 +111,11 @@ |
||
| 111 | 111 | |
| 112 | 112 | // resource |
| 113 | 113 | if (\is_resource($value)) { |
| 114 | - return \get_resource_type($value) . ' resource #' . (int) $value; |
|
| 114 | + return \get_resource_type($value).' resource #'.(int) $value; |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | if (\is_object($value)) { |
| 118 | - return \get_class($value) . ' Object'; |
|
| 118 | + return \get_class($value).' Object'; |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | return ''; |
@@ -82,32 +82,32 @@ |
||
| 82 | 82 | \gettype($value) === (self::$typeMapping[$type] ?? $type) |
| 83 | 83 | || |
| 84 | 84 | ( |
| 85 | - $type === 'scalar' |
|
| 85 | + $type === 'scalar' |
|
| 86 | 86 | && |
| 87 | 87 | \is_scalar($value) |
| 88 | - ) |
|
| 88 | + ) |
|
| 89 | 89 | || |
| 90 | 90 | ( |
| 91 | - $type === 'callable' |
|
| 91 | + $type === 'callable' |
|
| 92 | 92 | && |
| 93 | 93 | \is_callable($value) |
| 94 | - ) |
|
| 94 | + ) |
|
| 95 | 95 | || |
| 96 | 96 | ( |
| 97 | - $type === 'numeric' |
|
| 97 | + $type === 'numeric' |
|
| 98 | 98 | && |
| 99 | 99 | ( |
| 100 | - \is_float($value) |
|
| 100 | + \is_float($value) |
|
| 101 | 101 | || |
| 102 | 102 | \is_int($value) |
| 103 | - ) |
|
| 104 | - ) |
|
| 103 | + ) |
|
| 104 | + ) |
|
| 105 | 105 | || |
| 106 | 106 | ( |
| 107 | - $type === 'resource' |
|
| 107 | + $type === 'resource' |
|
| 108 | 108 | && |
| 109 | 109 | \is_resource($value) |
| 110 | - ); |
|
| 110 | + ); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | /** |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | public function throwException($expectedTypes, $value, $type): \Throwable |
| 28 | 28 | { |
| 29 | - throw new \TypeError("Invalid type: expected to be of type {{$expectedTypes}}, instead got value `" . \print_r($value, true) . "` with type {{$type}}."); |
|
| 29 | + throw new \TypeError("Invalid type: expected to be of type {{$expectedTypes}}, instead got value `".\print_r($value, true)."` with type {{$type}}."); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | /** |
@@ -50,6 +50,7 @@ |
||
| 50 | 50 | * Merge current items and items of given collections into a new one. |
| 51 | 51 | * |
| 52 | 52 | * @param CollectionInterface ...$collections The collections to merge. |
| 53 | + * @param CollectionInterface[] $collections |
|
| 53 | 54 | * |
| 54 | 55 | * @throws \InvalidArgumentException if any of the given collections are not of the same type |
| 55 | 56 | * |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | /** |
| 30 | 30 | * @param array<mixed> $array |
| 31 | 31 | * |
| 32 | - * @return int|string|null |
|
| 32 | + * @return integer|null |
|
| 33 | 33 | */ |
| 34 | 34 | function array_key_first(array $array) |
| 35 | 35 | { |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | /** |
| 46 | 46 | * @param array<mixed> $array |
| 47 | 47 | * |
| 48 | - * @return int|string|null |
|
| 48 | + * @return null|integer |
|
| 49 | 49 | */ |
| 50 | 50 | function array_key_last(array $array) |
| 51 | 51 | { |
@@ -1565,7 +1565,7 @@ discard block |
||
| 1565 | 1565 | * |
| 1566 | 1566 | * @param float|int|string $low <p>First value of the sequence.</p> |
| 1567 | 1567 | * @param float|int|string $high <p>The sequence is ended upon reaching the end value.</p> |
| 1568 | - * @param float|int $step <p>Used as the increment between elements in the sequence.</p> |
|
| 1568 | + * @param integer $step <p>Used as the increment between elements in the sequence.</p> |
|
| 1569 | 1569 | * |
| 1570 | 1570 | * @return static |
| 1571 | 1571 | * <p>(Immutable) Returns an new instance of the Arrayy object.</p> |
@@ -2162,7 +2162,7 @@ discard block |
||
| 2162 | 2162 | /** |
| 2163 | 2163 | * Get the first key from the current array. |
| 2164 | 2164 | * |
| 2165 | - * @return mixed |
|
| 2165 | + * @return integer|null |
|
| 2166 | 2166 | * <p>Return null if there wasn't a element.</p> |
| 2167 | 2167 | * @psalm-mutation-free |
| 2168 | 2168 | */ |
@@ -3230,7 +3230,7 @@ discard block |
||
| 3230 | 3230 | /** |
| 3231 | 3231 | * Get the last key from the current array. |
| 3232 | 3232 | * |
| 3233 | - * @return mixed|null |
|
| 3233 | + * @return null|integer |
|
| 3234 | 3234 | * <p>Return null if there wasn't a element.</p> |
| 3235 | 3235 | * @psalm-mutation-free |
| 3236 | 3236 | */ |
@@ -3622,7 +3622,7 @@ discard block |
||
| 3622 | 3622 | /** |
| 3623 | 3623 | * Get the most used value from the array. |
| 3624 | 3624 | * |
| 3625 | - * @return mixed|null |
|
| 3625 | + * @return integer|null |
|
| 3626 | 3626 | * <p>(Immutable) Return null if there wasn't a element.</p> |
| 3627 | 3627 | * @psalm-mutation-free |
| 3628 | 3628 | */ |
@@ -5874,7 +5874,7 @@ discard block |
||
| 5874 | 5874 | } |
| 5875 | 5875 | |
| 5876 | 5876 | /** |
| 5877 | - * @param mixed $path |
|
| 5877 | + * @param string $path |
|
| 5878 | 5878 | * @param callable $callable |
| 5879 | 5879 | * @param array|null $currentOffset |
| 5880 | 5880 | * |
@@ -6065,7 +6065,7 @@ discard block |
||
| 6065 | 6065 | } |
| 6066 | 6066 | |
| 6067 | 6067 | /** |
| 6068 | - * @param mixed $glue |
|
| 6068 | + * @param string $glue |
|
| 6069 | 6069 | * @param mixed $pieces |
| 6070 | 6070 | * @param bool $useKeys |
| 6071 | 6071 | * |
@@ -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 | ); |
@@ -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])) { |
@@ -290,9 +290,9 @@ |
||
| 290 | 290 | $return = static::create(); |
| 291 | 291 | $jsonObject = \json_decode($json, false); |
| 292 | 292 | $mapper = new \Arrayy\Mapper\Json(); |
| 293 | - $mapper->undefinedPropertyHandler = static function ($object, $key, $jsonValue) use ($return) { |
|
| 293 | + $mapper->undefinedPropertyHandler = static function($object, $key, $jsonValue) use ($return) { |
|
| 294 | 294 | if ($return->checkForMissingPropertiesInConstructor) { |
| 295 | - throw new \TypeError('Property mismatch - input: ' . \print_r(['key' => $key, 'jsonValue' => $jsonValue], true) . ' for object: ' . \get_class($object)); |
|
| 295 | + throw new \TypeError('Property mismatch - input: '.\print_r(['key' => $key, 'jsonValue' => $jsonValue], true).' for object: '.\get_class($object)); |
|
| 296 | 296 | } |
| 297 | 297 | }; |
| 298 | 298 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | if (!\is_object($object)) { |
| 67 | 67 | throw new \InvalidArgumentException( |
| 68 | - 'JsonMapper::map() requires second argument to be an object, ' . \gettype($object) . ' given.' |
|
| 68 | + 'JsonMapper::map() requires second argument to be an object, '.\gettype($object).' given.' |
|
| 69 | 69 | ); |
| 70 | 70 | } |
| 71 | 71 | |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | $type = $this->removeNullable($type); |
| 115 | 115 | } elseif ($jsonValue === null) { |
| 116 | 116 | throw new \InvalidArgumentException( |
| 117 | - 'JSON property "' . $key . '" in class "' . $strClassName . '" must not be NULL' |
|
| 117 | + 'JSON property "'.$key.'" in class "'.$strClassName.'" must not be NULL' |
|
| 118 | 118 | ); |
| 119 | 119 | } |
| 120 | 120 | |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | if ($this->isSimpleType($type)) { |
| 142 | 142 | if ($type === 'string' && \is_object($jsonValue)) { |
| 143 | 143 | throw new \InvalidArgumentException( |
| 144 | - 'JSON property "' . $key . '" in class "' . $strClassName . '" is an object and cannot be converted to a string' |
|
| 144 | + 'JSON property "'.$key.'" in class "'.$strClassName.'" is an object and cannot be converted to a string' |
|
| 145 | 145 | ); |
| 146 | 146 | } |
| 147 | 147 | |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | |
| 163 | 163 | if ($type === '') { |
| 164 | 164 | throw new \InvalidArgumentException( |
| 165 | - 'Empty type at property "' . $strClassName . '::$' . $key . '"' |
|
| 165 | + 'Empty type at property "'.$strClassName.'::$'.$key.'"' |
|
| 166 | 166 | ); |
| 167 | 167 | } |
| 168 | 168 | |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | $this->isScalarType(\gettype($jsonValue)) |
| 197 | 197 | ) { |
| 198 | 198 | throw new \InvalidArgumentException( |
| 199 | - 'JSON property "' . $key . '" must be an array, ' . \gettype($jsonValue) . ' given' |
|
| 199 | + 'JSON property "'.$key.'" must be an array, '.\gettype($jsonValue).' given' |
|
| 200 | 200 | ); |
| 201 | 201 | } |
| 202 | 202 | |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | } |
| 274 | 274 | } elseif ($this->isScalarType($class)) { |
| 275 | 275 | throw new \InvalidArgumentException( |
| 276 | - 'JSON property "' . ($parent_key ?: '?') . '" is an array of type "' . $class . '" but contained a value of type "' . \gettype($jsonValue) . '"' |
|
| 276 | + 'JSON property "'.($parent_key ?: '?').'" is an array of type "'.$class.'" but contained a value of type "'.\gettype($jsonValue).'"' |
|
| 277 | 277 | ); |
| 278 | 278 | } elseif (\is_a($class, \ArrayObject::class, true)) { |
| 279 | 279 | /** @noinspection PhpSillyAssignmentInspection - phpstan helper */ |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | //create a full qualified namespace |
| 332 | - return '\\' . $strNs . '\\' . $type; |
|
| 332 | + return '\\'.$strNs.'\\'.$type; |
|
| 333 | 333 | } |
| 334 | 334 | |
| 335 | 335 | /** |
@@ -633,7 +633,7 @@ discard block |
||
| 633 | 633 | */ |
| 634 | 634 | private function isNullable($type): bool |
| 635 | 635 | { |
| 636 | - return \stripos('|' . $type . '|', '|null|') !== false; |
|
| 636 | + return \stripos('|'.$type.'|', '|null|') !== false; |
|
| 637 | 637 | } |
| 638 | 638 | |
| 639 | 639 | /** |
@@ -650,7 +650,7 @@ discard block |
||
| 650 | 650 | } |
| 651 | 651 | |
| 652 | 652 | return \substr( |
| 653 | - \str_ireplace('|null|', '|', '|' . $type . '|'), |
|
| 653 | + \str_ireplace('|null|', '|', '|'.$type.'|'), |
|
| 654 | 654 | 1, |
| 655 | 655 | -1 |
| 656 | 656 | ); |