@@ -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 | ); |
@@ -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) { |
@@ -4447,7 +4447,7 @@ discard block |
||
| 4447 | 4447 | */ |
| 4448 | 4448 | public function nth(int $step, int $offset = 0): self |
| 4449 | 4449 | { |
| 4450 | - $arrayFunction = function () use ($step, $offset): \Generator { |
|
| 4450 | + $arrayFunction = function() use ($step, $offset): \Generator { |
|
| 4451 | 4451 | $position = 0; |
| 4452 | 4452 | foreach ($this->getGenerator() as $key => $value) { |
| 4453 | 4453 | if ($position++ % $step !== $offset) { |
@@ -4481,7 +4481,7 @@ discard block |
||
| 4481 | 4481 | { |
| 4482 | 4482 | $keys = \array_flip($keys); |
| 4483 | 4483 | |
| 4484 | - $generator = function () use ($keys): \Generator { |
|
| 4484 | + $generator = function() use ($keys): \Generator { |
|
| 4485 | 4485 | foreach ($this->getGenerator() as $key => $value) { |
| 4486 | 4486 | if (isset($keys[$key])) { |
| 4487 | 4487 | yield $key => $value; |
@@ -4611,7 +4611,7 @@ discard block |
||
| 4611 | 4611 | */ |
| 4612 | 4612 | public function prependImmutable($value, $key = null) |
| 4613 | 4613 | { |
| 4614 | - $generator = function () use ($key, $value): \Generator { |
|
| 4614 | + $generator = function() use ($key, $value): \Generator { |
|
| 4615 | 4615 | if ($this->properties !== []) { |
| 4616 | 4616 | $this->checkType($key, $value); |
| 4617 | 4617 | } |
@@ -4662,7 +4662,7 @@ discard block |
||
| 4662 | 4662 | )->prependToEachKey($suffix) |
| 4663 | 4663 | ->toArray(); |
| 4664 | 4664 | } else { |
| 4665 | - $result[$key . $suffix] = $item; |
|
| 4665 | + $result[$key.$suffix] = $item; |
|
| 4666 | 4666 | } |
| 4667 | 4667 | } |
| 4668 | 4668 | |
@@ -4702,7 +4702,7 @@ discard block |
||
| 4702 | 4702 | } elseif (\is_object($item) === true) { |
| 4703 | 4703 | $result[$key] = $item; |
| 4704 | 4704 | } else { |
| 4705 | - $result[$key] = $item . $suffix; |
|
| 4705 | + $result[$key] = $item.$suffix; |
|
| 4706 | 4706 | } |
| 4707 | 4707 | } |
| 4708 | 4708 | |
@@ -5507,7 +5507,7 @@ discard block |
||
| 5507 | 5507 | * @psalm-suppress MissingClosureParamType |
| 5508 | 5508 | */ |
| 5509 | 5509 | return $this->each( |
| 5510 | - static function ($value) use ($search, $replacement) { |
|
| 5510 | + static function($value) use ($search, $replacement) { |
|
| 5511 | 5511 | return \str_replace($search, $replacement, $value); |
| 5512 | 5512 | } |
| 5513 | 5513 | ); |
@@ -6191,7 +6191,7 @@ discard block |
||
| 6191 | 6191 | * @psalm-suppress MissingClosureParamType |
| 6192 | 6192 | */ |
| 6193 | 6193 | $results = $arrayy->each( |
| 6194 | - static function ($value) use ($sorter) { |
|
| 6194 | + static function($value) use ($sorter) { |
|
| 6195 | 6195 | if (\is_callable($sorter) === true) { |
| 6196 | 6196 | return $sorter($value); |
| 6197 | 6197 | } |
@@ -6264,7 +6264,7 @@ discard block |
||
| 6264 | 6264 | public function split(int $numberOfPieces = 2, bool $keepKeys = false): self |
| 6265 | 6265 | { |
| 6266 | 6266 | if ($keepKeys) { |
| 6267 | - $generator = function () use ($numberOfPieces) { |
|
| 6267 | + $generator = function() use ($numberOfPieces) { |
|
| 6268 | 6268 | $carry = []; |
| 6269 | 6269 | $i = 1; |
| 6270 | 6270 | foreach ($this->getGenerator() as $key => $value) { |
@@ -6287,7 +6287,7 @@ discard block |
||
| 6287 | 6287 | } |
| 6288 | 6288 | }; |
| 6289 | 6289 | } else { |
| 6290 | - $generator = function () use ($numberOfPieces) { |
|
| 6290 | + $generator = function() use ($numberOfPieces) { |
|
| 6291 | 6291 | $carry = []; |
| 6292 | 6292 | $i = 1; |
| 6293 | 6293 | foreach ($this->getGenerator() as $key => $value) { |
@@ -6334,7 +6334,7 @@ discard block |
||
| 6334 | 6334 | public function stripEmpty(): self |
| 6335 | 6335 | { |
| 6336 | 6336 | return $this->filter( |
| 6337 | - static function ($item) { |
|
| 6337 | + static function($item) { |
|
| 6338 | 6338 | if ($item === null) { |
| 6339 | 6339 | return false; |
| 6340 | 6340 | } |
@@ -6538,7 +6538,7 @@ discard block |
||
| 6538 | 6538 | * @psalm-suppress MissingClosureParamType |
| 6539 | 6539 | */ |
| 6540 | 6540 | $this->array = $this->reduce( |
| 6541 | - static function ($resultArray, $value) { |
|
| 6541 | + static function($resultArray, $value) { |
|
| 6542 | 6542 | if (!\in_array($value, $resultArray, true)) { |
| 6543 | 6543 | $resultArray[] = $value; |
| 6544 | 6544 | } |
@@ -6577,7 +6577,7 @@ discard block |
||
| 6577 | 6577 | */ |
| 6578 | 6578 | $this->array = \array_reduce( |
| 6579 | 6579 | \array_keys($array), |
| 6580 | - static function ($resultArray, $key) use ($array) { |
|
| 6580 | + static function($resultArray, $key) use ($array) { |
|
| 6581 | 6581 | if (!\in_array($array[$key], $resultArray, true)) { |
| 6582 | 6582 | $resultArray[$key] = $array[$key]; |
| 6583 | 6583 | } |
@@ -6662,7 +6662,7 @@ discard block |
||
| 6662 | 6662 | public function values(): self |
| 6663 | 6663 | { |
| 6664 | 6664 | return static::create( |
| 6665 | - function () { |
|
| 6665 | + function() { |
|
| 6666 | 6666 | /** @noinspection YieldFromCanBeUsedInspection */ |
| 6667 | 6667 | foreach ($this->getGenerator() as $value) { |
| 6668 | 6668 | yield $value; |
@@ -6739,7 +6739,7 @@ discard block |
||
| 6739 | 6739 | public function where(string $keyOrPropertyOrMethod, $value): self |
| 6740 | 6740 | { |
| 6741 | 6741 | return $this->filter( |
| 6742 | - function ($item) use ($keyOrPropertyOrMethod, $value) { |
|
| 6742 | + function($item) use ($keyOrPropertyOrMethod, $value) { |
|
| 6743 | 6743 | $accessorValue = $this->extractValue( |
| 6744 | 6744 | $item, |
| 6745 | 6745 | $keyOrPropertyOrMethod |
@@ -7029,7 +7029,7 @@ discard block |
||
| 7029 | 7029 | protected function getPropertiesFromPhpDoc() |
| 7030 | 7030 | { |
| 7031 | 7031 | static $PROPERTY_CACHE = []; |
| 7032 | - $cacheKey = 'Class::' . static::class; |
|
| 7032 | + $cacheKey = 'Class::'.static::class; |
|
| 7033 | 7033 | |
| 7034 | 7034 | if (isset($PROPERTY_CACHE[$cacheKey])) { |
| 7035 | 7035 | return $PROPERTY_CACHE[$cacheKey]; |
@@ -7335,7 +7335,7 @@ discard block |
||
| 7335 | 7335 | if ($array === null) { |
| 7336 | 7336 | $array = []; |
| 7337 | 7337 | } elseif (!\is_array($array)) { |
| 7338 | - throw new \RuntimeException('Can not set value at this path "' . $key . '" because (' . \gettype($array) . ')"' . \print_r($array, true) . '" is not an array.'); |
|
| 7338 | + throw new \RuntimeException('Can not set value at this path "'.$key.'" because ('.\gettype($array).')"'.\print_r($array, true).'" is not an array.'); |
|
| 7339 | 7339 | } |
| 7340 | 7340 | |
| 7341 | 7341 | $array[$key] = $value; |
@@ -7407,7 +7407,7 @@ discard block |
||
| 7407 | 7407 | && |
| 7408 | 7408 | \count(\array_diff_key($properties, $data)) > 0 |
| 7409 | 7409 | ) { |
| 7410 | - throw new \TypeError('Property mismatch - input: ' . \print_r(\array_keys($data), true) . ' | expected: ' . \print_r(\array_keys($properties), true)); |
|
| 7410 | + throw new \TypeError('Property mismatch - input: '.\print_r(\array_keys($data), true).' | expected: '.\print_r(\array_keys($properties), true)); |
|
| 7411 | 7411 | } |
| 7412 | 7412 | |
| 7413 | 7413 | foreach ($data as $key => &$valueInner) { |
@@ -7524,7 +7524,7 @@ discard block |
||
| 7524 | 7524 | * |
| 7525 | 7525 | * @return void |
| 7526 | 7526 | */ |
| 7527 | - static function (&$item) { |
|
| 7527 | + static function(&$item) { |
|
| 7528 | 7528 | if ($item instanceof self) { |
| 7529 | 7529 | $item = $item->getArray(); |
| 7530 | 7530 | } |
@@ -7549,7 +7549,7 @@ discard block |
||
| 7549 | 7549 | && |
| 7550 | 7550 | $this->checkPropertiesMismatch === true |
| 7551 | 7551 | ) { |
| 7552 | - throw new \TypeError('The key "' . $key . '" does not exists as "@property" phpdoc. (' . \get_class($this) . ').'); |
|
| 7552 | + throw new \TypeError('The key "'.$key.'" does not exists as "@property" phpdoc. ('.\get_class($this).').'); |
|
| 7553 | 7553 | } |
| 7554 | 7554 | |
| 7555 | 7555 | 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 | ); |