@@ -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 | |
@@ -1262,7 +1262,7 @@ discard block |
||
| 1262 | 1262 | public function chunk($size, $preserveKeys = false): self |
| 1263 | 1263 | { |
| 1264 | 1264 | if ($preserveKeys) { |
| 1265 | - $generator = function () use ($size) { |
|
| 1265 | + $generator = function() use ($size) { |
|
| 1266 | 1266 | $values = []; |
| 1267 | 1267 | $tmpCounter = 0; |
| 1268 | 1268 | foreach ($this->getGenerator() as $key => $value) { |
@@ -1282,7 +1282,7 @@ discard block |
||
| 1282 | 1282 | } |
| 1283 | 1283 | }; |
| 1284 | 1284 | } else { |
| 1285 | - $generator = function () use ($size) { |
|
| 1285 | + $generator = function() use ($size) { |
|
| 1286 | 1286 | $values = []; |
| 1287 | 1287 | $tmpCounter = 0; |
| 1288 | 1288 | foreach ($this->getGenerator() as $key => $value) { |
@@ -1326,7 +1326,7 @@ discard block |
||
| 1326 | 1326 | public function clean(): self |
| 1327 | 1327 | { |
| 1328 | 1328 | return $this->filter( |
| 1329 | - static function ($value) { |
|
| 1329 | + static function($value) { |
|
| 1330 | 1330 | return (bool) $value; |
| 1331 | 1331 | } |
| 1332 | 1332 | ); |
@@ -1668,9 +1668,9 @@ discard block |
||
| 1668 | 1668 | |
| 1669 | 1669 | foreach ($items as $key => $value) { |
| 1670 | 1670 | if (\is_array($value) && $value !== []) { |
| 1671 | - $flatten[] = $this->flatten($delimiter, $prepend . $key . $delimiter, $value); |
|
| 1671 | + $flatten[] = $this->flatten($delimiter, $prepend.$key.$delimiter, $value); |
|
| 1672 | 1672 | } else { |
| 1673 | - $flatten[] = [$prepend . $key => $value]; |
|
| 1673 | + $flatten[] = [$prepend.$key => $value]; |
|
| 1674 | 1674 | } |
| 1675 | 1675 | } |
| 1676 | 1676 | |
@@ -1848,7 +1848,7 @@ discard block |
||
| 1848 | 1848 | */ |
| 1849 | 1849 | \array_walk( |
| 1850 | 1850 | $array, |
| 1851 | - static function (&$val) { |
|
| 1851 | + static function(&$val) { |
|
| 1852 | 1852 | if ((string) $val === $val) { |
| 1853 | 1853 | $val = \trim($val); |
| 1854 | 1854 | } |
@@ -2380,7 +2380,7 @@ discard block |
||
| 2380 | 2380 | } |
| 2381 | 2381 | |
| 2382 | 2382 | if ($flag === \ARRAY_FILTER_USE_KEY) { |
| 2383 | - $generator = function () use ($closure) { |
|
| 2383 | + $generator = function() use ($closure) { |
|
| 2384 | 2384 | foreach ($this->getGenerator() as $key => $value) { |
| 2385 | 2385 | if ($closure($key) === true) { |
| 2386 | 2386 | yield $key => $value; |
@@ -2388,7 +2388,7 @@ discard block |
||
| 2388 | 2388 | } |
| 2389 | 2389 | }; |
| 2390 | 2390 | } elseif ($flag === \ARRAY_FILTER_USE_BOTH) { |
| 2391 | - $generator = function () use ($closure) { |
|
| 2391 | + $generator = function() use ($closure) { |
|
| 2392 | 2392 | foreach ($this->getGenerator() as $key => $value) { |
| 2393 | 2393 | if ($closure($value, $key) === true) { |
| 2394 | 2394 | yield $key => $value; |
@@ -2396,7 +2396,7 @@ discard block |
||
| 2396 | 2396 | } |
| 2397 | 2397 | }; |
| 2398 | 2398 | } else { |
| 2399 | - $generator = function () use ($closure) { |
|
| 2399 | + $generator = function() use ($closure) { |
|
| 2400 | 2400 | foreach ($this->getGenerator() as $key => $value) { |
| 2401 | 2401 | if ($closure($value) === true) { |
| 2402 | 2402 | yield $key => $value; |
@@ -2451,40 +2451,40 @@ discard block |
||
| 2451 | 2451 | } |
| 2452 | 2452 | |
| 2453 | 2453 | $ops = [ |
| 2454 | - 'eq' => static function ($item, $prop, $value): bool { |
|
| 2454 | + 'eq' => static function($item, $prop, $value): bool { |
|
| 2455 | 2455 | return $item[$prop] === $value; |
| 2456 | 2456 | }, |
| 2457 | - 'gt' => static function ($item, $prop, $value): bool { |
|
| 2457 | + 'gt' => static function($item, $prop, $value): bool { |
|
| 2458 | 2458 | return $item[$prop] > $value; |
| 2459 | 2459 | }, |
| 2460 | - 'ge' => static function ($item, $prop, $value): bool { |
|
| 2460 | + 'ge' => static function($item, $prop, $value): bool { |
|
| 2461 | 2461 | return $item[$prop] >= $value; |
| 2462 | 2462 | }, |
| 2463 | - 'gte' => static function ($item, $prop, $value): bool { |
|
| 2463 | + 'gte' => static function($item, $prop, $value): bool { |
|
| 2464 | 2464 | return $item[$prop] >= $value; |
| 2465 | 2465 | }, |
| 2466 | - 'lt' => static function ($item, $prop, $value): bool { |
|
| 2466 | + 'lt' => static function($item, $prop, $value): bool { |
|
| 2467 | 2467 | return $item[$prop] < $value; |
| 2468 | 2468 | }, |
| 2469 | - 'le' => static function ($item, $prop, $value): bool { |
|
| 2469 | + 'le' => static function($item, $prop, $value): bool { |
|
| 2470 | 2470 | return $item[$prop] <= $value; |
| 2471 | 2471 | }, |
| 2472 | - 'lte' => static function ($item, $prop, $value): bool { |
|
| 2472 | + 'lte' => static function($item, $prop, $value): bool { |
|
| 2473 | 2473 | return $item[$prop] <= $value; |
| 2474 | 2474 | }, |
| 2475 | - 'ne' => static function ($item, $prop, $value): bool { |
|
| 2475 | + 'ne' => static function($item, $prop, $value): bool { |
|
| 2476 | 2476 | return $item[$prop] !== $value; |
| 2477 | 2477 | }, |
| 2478 | - 'contains' => static function ($item, $prop, $value): bool { |
|
| 2478 | + 'contains' => static function($item, $prop, $value): bool { |
|
| 2479 | 2479 | return \in_array($item[$prop], (array) $value, true); |
| 2480 | 2480 | }, |
| 2481 | - 'notContains' => static function ($item, $prop, $value): bool { |
|
| 2481 | + 'notContains' => static function($item, $prop, $value): bool { |
|
| 2482 | 2482 | return !\in_array($item[$prop], (array) $value, true); |
| 2483 | 2483 | }, |
| 2484 | - 'newer' => static function ($item, $prop, $value): bool { |
|
| 2484 | + 'newer' => static function($item, $prop, $value): bool { |
|
| 2485 | 2485 | return \strtotime($item[$prop]) > \strtotime($value); |
| 2486 | 2486 | }, |
| 2487 | - 'older' => static function ($item, $prop, $value): bool { |
|
| 2487 | + 'older' => static function($item, $prop, $value): bool { |
|
| 2488 | 2488 | return \strtotime($item[$prop]) < \strtotime($value); |
| 2489 | 2489 | }, |
| 2490 | 2490 | ]; |
@@ -2492,7 +2492,7 @@ discard block |
||
| 2492 | 2492 | $result = \array_values( |
| 2493 | 2493 | \array_filter( |
| 2494 | 2494 | $this->toArray(false, true), |
| 2495 | - static function ($item) use ( |
|
| 2495 | + static function($item) use ( |
|
| 2496 | 2496 | $property, |
| 2497 | 2497 | $value, |
| 2498 | 2498 | $ops, |
@@ -2706,7 +2706,7 @@ discard block |
||
| 2706 | 2706 | */ |
| 2707 | 2707 | public function flip(): self |
| 2708 | 2708 | { |
| 2709 | - $generator = function (): \Generator { |
|
| 2709 | + $generator = function(): \Generator { |
|
| 2710 | 2710 | foreach ($this->getGenerator() as $key => $value) { |
| 2711 | 2711 | yield (string) $value => $key; |
| 2712 | 2712 | } |
@@ -2967,9 +2967,9 @@ discard block |
||
| 2967 | 2967 | $jsonObject = \json_decode($json, false); |
| 2968 | 2968 | |
| 2969 | 2969 | $mapper = new \Arrayy\Mapper\Json(); |
| 2970 | - $mapper->undefinedPropertyHandler = static function ($object, $key, $jsonValue) use ($class) { |
|
| 2970 | + $mapper->undefinedPropertyHandler = static function($object, $key, $jsonValue) use ($class) { |
|
| 2971 | 2971 | if ($class->checkPropertiesMismatchInConstructor) { |
| 2972 | - throw new \TypeError('Property mismatch - input: ' . \print_r(['key' => $key, 'jsonValue' => $jsonValue], true) . ' for object: ' . \get_class($object)); |
|
| 2972 | + throw new \TypeError('Property mismatch - input: '.\print_r(['key' => $key, 'jsonValue' => $jsonValue], true).' for object: '.\get_class($object)); |
|
| 2973 | 2973 | } |
| 2974 | 2974 | }; |
| 2975 | 2975 | |
@@ -3034,13 +3034,13 @@ discard block |
||
| 3034 | 3034 | public function getColumn($columnKey = null, $indexKey = null): self |
| 3035 | 3035 | { |
| 3036 | 3036 | if ($columnKey === null && $indexKey === null) { |
| 3037 | - $generator = function () { |
|
| 3037 | + $generator = function() { |
|
| 3038 | 3038 | foreach ($this->getGenerator() as $key => $value) { |
| 3039 | 3039 | yield $value; |
| 3040 | 3040 | } |
| 3041 | 3041 | }; |
| 3042 | 3042 | } else { |
| 3043 | - $generator = function () use ($columnKey, $indexKey) { |
|
| 3043 | + $generator = function() use ($columnKey, $indexKey) { |
|
| 3044 | 3044 | foreach ($this->getGenerator() as $key => $value) { |
| 3045 | 3045 | // reset |
| 3046 | 3046 | $newKey = null; |
@@ -3390,7 +3390,7 @@ discard block |
||
| 3390 | 3390 | */ |
| 3391 | 3391 | public function implode(string $glue = '', string $prefix = ''): string |
| 3392 | 3392 | { |
| 3393 | - return $prefix . $this->implode_recursive($glue, $this->toArray(), false); |
|
| 3393 | + return $prefix.$this->implode_recursive($glue, $this->toArray(), false); |
|
| 3394 | 3394 | } |
| 3395 | 3395 | |
| 3396 | 3396 | /** |
@@ -3499,7 +3499,7 @@ discard block |
||
| 3499 | 3499 | \array_uintersect( |
| 3500 | 3500 | $this->toArray(), |
| 3501 | 3501 | $search, |
| 3502 | - static function ($a, $b) { |
|
| 3502 | + static function($a, $b) { |
|
| 3503 | 3503 | return $a === $b ? 0 : -1; |
| 3504 | 3504 | } |
| 3505 | 3505 | ), |
@@ -3835,13 +3835,13 @@ discard block |
||
| 3835 | 3835 | // non recursive |
| 3836 | 3836 | |
| 3837 | 3837 | if ($search_values === null) { |
| 3838 | - $arrayFunction = function (): \Generator { |
|
| 3838 | + $arrayFunction = function(): \Generator { |
|
| 3839 | 3839 | foreach ($this->getGenerator() as $key => $value) { |
| 3840 | 3840 | yield $key; |
| 3841 | 3841 | } |
| 3842 | 3842 | }; |
| 3843 | 3843 | } else { |
| 3844 | - $arrayFunction = function () use ($search_values, $strict): \Generator { |
|
| 3844 | + $arrayFunction = function() use ($search_values, $strict): \Generator { |
|
| 3845 | 3845 | $is_array_tmp = \is_array($search_values); |
| 3846 | 3846 | |
| 3847 | 3847 | /** @noinspection PhpParameterByRefIsNotUsedAsReferenceInspection */ |
@@ -4081,7 +4081,7 @@ discard block |
||
| 4081 | 4081 | $useArguments = \func_num_args() > 2; |
| 4082 | 4082 | |
| 4083 | 4083 | return static::create( |
| 4084 | - function () use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
| 4084 | + function() use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
| 4085 | 4085 | foreach ($this->getGenerator() as $key => $value) { |
| 4086 | 4086 | if ($useArguments) { |
| 4087 | 4087 | if ($useKeyAsSecondParameter) { |
@@ -4568,7 +4568,7 @@ discard block |
||
| 4568 | 4568 | */ |
| 4569 | 4569 | public function nth(int $step, int $offset = 0): self |
| 4570 | 4570 | { |
| 4571 | - $arrayFunction = function () use ($step, $offset): \Generator { |
|
| 4571 | + $arrayFunction = function() use ($step, $offset): \Generator { |
|
| 4572 | 4572 | $position = 0; |
| 4573 | 4573 | foreach ($this->getGenerator() as $key => $value) { |
| 4574 | 4574 | if ($position++ % $step !== $offset) { |
@@ -4602,7 +4602,7 @@ discard block |
||
| 4602 | 4602 | { |
| 4603 | 4603 | $keys = \array_flip($keys); |
| 4604 | 4604 | |
| 4605 | - $generator = function () use ($keys): \Generator { |
|
| 4605 | + $generator = function() use ($keys): \Generator { |
|
| 4606 | 4606 | foreach ($this->getGenerator() as $key => $value) { |
| 4607 | 4607 | if (isset($keys[$key])) { |
| 4608 | 4608 | yield $key => $value; |
@@ -4732,7 +4732,7 @@ discard block |
||
| 4732 | 4732 | */ |
| 4733 | 4733 | public function prependImmutable($value, $key = null) |
| 4734 | 4734 | { |
| 4735 | - $generator = function () use ($key, $value): \Generator { |
|
| 4735 | + $generator = function() use ($key, $value): \Generator { |
|
| 4736 | 4736 | if ($this->properties !== []) { |
| 4737 | 4737 | $this->checkType($key, $value); |
| 4738 | 4738 | } |
@@ -4783,7 +4783,7 @@ discard block |
||
| 4783 | 4783 | )->prependToEachKey($suffix) |
| 4784 | 4784 | ->toArray(); |
| 4785 | 4785 | } else { |
| 4786 | - $result[$key . $suffix] = $item; |
|
| 4786 | + $result[$key.$suffix] = $item; |
|
| 4787 | 4787 | } |
| 4788 | 4788 | } |
| 4789 | 4789 | |
@@ -4823,7 +4823,7 @@ discard block |
||
| 4823 | 4823 | } elseif (\is_object($item) === true) { |
| 4824 | 4824 | $result[$key] = $item; |
| 4825 | 4825 | } else { |
| 4826 | - $result[$key] = $item . $suffix; |
|
| 4826 | + $result[$key] = $item.$suffix; |
|
| 4827 | 4827 | } |
| 4828 | 4828 | } |
| 4829 | 4829 | |
@@ -5628,7 +5628,7 @@ discard block |
||
| 5628 | 5628 | * @psalm-suppress MissingClosureParamType |
| 5629 | 5629 | */ |
| 5630 | 5630 | return $this->each( |
| 5631 | - static function ($value) use ($search, $replacement) { |
|
| 5631 | + static function($value) use ($search, $replacement) { |
|
| 5632 | 5632 | return \str_replace($search, $replacement, $value); |
| 5633 | 5633 | } |
| 5634 | 5634 | ); |
@@ -6312,7 +6312,7 @@ discard block |
||
| 6312 | 6312 | * @psalm-suppress MissingClosureParamType |
| 6313 | 6313 | */ |
| 6314 | 6314 | $results = $arrayy->each( |
| 6315 | - static function ($value) use ($sorter) { |
|
| 6315 | + static function($value) use ($sorter) { |
|
| 6316 | 6316 | if (\is_callable($sorter) === true) { |
| 6317 | 6317 | return $sorter($value); |
| 6318 | 6318 | } |
@@ -6385,7 +6385,7 @@ discard block |
||
| 6385 | 6385 | public function split(int $numberOfPieces = 2, bool $keepKeys = false): self |
| 6386 | 6386 | { |
| 6387 | 6387 | if ($keepKeys) { |
| 6388 | - $generator = function () use ($numberOfPieces) { |
|
| 6388 | + $generator = function() use ($numberOfPieces) { |
|
| 6389 | 6389 | $carry = []; |
| 6390 | 6390 | $i = 1; |
| 6391 | 6391 | foreach ($this->getGenerator() as $key => $value) { |
@@ -6408,7 +6408,7 @@ discard block |
||
| 6408 | 6408 | } |
| 6409 | 6409 | }; |
| 6410 | 6410 | } else { |
| 6411 | - $generator = function () use ($numberOfPieces) { |
|
| 6411 | + $generator = function() use ($numberOfPieces) { |
|
| 6412 | 6412 | $carry = []; |
| 6413 | 6413 | $i = 1; |
| 6414 | 6414 | foreach ($this->getGenerator() as $key => $value) { |
@@ -6455,7 +6455,7 @@ discard block |
||
| 6455 | 6455 | public function stripEmpty(): self |
| 6456 | 6456 | { |
| 6457 | 6457 | return $this->filter( |
| 6458 | - static function ($item) { |
|
| 6458 | + static function($item) { |
|
| 6459 | 6459 | if ($item === null) { |
| 6460 | 6460 | return false; |
| 6461 | 6461 | } |
@@ -6659,7 +6659,7 @@ discard block |
||
| 6659 | 6659 | * @psalm-suppress MissingClosureParamType |
| 6660 | 6660 | */ |
| 6661 | 6661 | $this->array = $this->reduce( |
| 6662 | - static function ($resultArray, $value) { |
|
| 6662 | + static function($resultArray, $value) { |
|
| 6663 | 6663 | if (!\in_array($value, $resultArray, true)) { |
| 6664 | 6664 | $resultArray[] = $value; |
| 6665 | 6665 | } |
@@ -6698,7 +6698,7 @@ discard block |
||
| 6698 | 6698 | */ |
| 6699 | 6699 | $this->array = \array_reduce( |
| 6700 | 6700 | \array_keys($array), |
| 6701 | - static function ($resultArray, $key) use ($array) { |
|
| 6701 | + static function($resultArray, $key) use ($array) { |
|
| 6702 | 6702 | if (!\in_array($array[$key], $resultArray, true)) { |
| 6703 | 6703 | $resultArray[$key] = $array[$key]; |
| 6704 | 6704 | } |
@@ -6783,7 +6783,7 @@ discard block |
||
| 6783 | 6783 | public function values(): self |
| 6784 | 6784 | { |
| 6785 | 6785 | return static::create( |
| 6786 | - function () { |
|
| 6786 | + function() { |
|
| 6787 | 6787 | /** @noinspection YieldFromCanBeUsedInspection */ |
| 6788 | 6788 | foreach ($this->getGenerator() as $value) { |
| 6789 | 6789 | yield $value; |
@@ -6860,7 +6860,7 @@ discard block |
||
| 6860 | 6860 | public function where(string $keyOrPropertyOrMethod, $value): self |
| 6861 | 6861 | { |
| 6862 | 6862 | return $this->filter( |
| 6863 | - function ($item) use ($keyOrPropertyOrMethod, $value) { |
|
| 6863 | + function($item) use ($keyOrPropertyOrMethod, $value) { |
|
| 6864 | 6864 | $accessorValue = $this->extractValue( |
| 6865 | 6865 | $item, |
| 6866 | 6866 | $keyOrPropertyOrMethod |
@@ -7150,7 +7150,7 @@ discard block |
||
| 7150 | 7150 | protected function getPropertiesFromPhpDoc() |
| 7151 | 7151 | { |
| 7152 | 7152 | static $PROPERTY_CACHE = []; |
| 7153 | - $cacheKey = 'Class::' . static::class; |
|
| 7153 | + $cacheKey = 'Class::'.static::class; |
|
| 7154 | 7154 | |
| 7155 | 7155 | if (isset($PROPERTY_CACHE[$cacheKey])) { |
| 7156 | 7156 | return $PROPERTY_CACHE[$cacheKey]; |
@@ -7456,7 +7456,7 @@ discard block |
||
| 7456 | 7456 | if ($array === null) { |
| 7457 | 7457 | $array = []; |
| 7458 | 7458 | } elseif (!\is_array($array)) { |
| 7459 | - throw new \RuntimeException('Can not set value at this path "' . $key . '" because (' . \gettype($array) . ')"' . \print_r($array, true) . '" is not an array.'); |
|
| 7459 | + throw new \RuntimeException('Can not set value at this path "'.$key.'" because ('.\gettype($array).')"'.\print_r($array, true).'" is not an array.'); |
|
| 7460 | 7460 | } |
| 7461 | 7461 | |
| 7462 | 7462 | $array[$key] = $value; |
@@ -7528,7 +7528,7 @@ discard block |
||
| 7528 | 7528 | && |
| 7529 | 7529 | \count(\array_diff_key($properties, $data)) > 0 |
| 7530 | 7530 | ) { |
| 7531 | - throw new \TypeError('Property mismatch - input: ' . \print_r(\array_keys($data), true) . ' | expected: ' . \print_r(\array_keys($properties), true)); |
|
| 7531 | + throw new \TypeError('Property mismatch - input: '.\print_r(\array_keys($data), true).' | expected: '.\print_r(\array_keys($properties), true)); |
|
| 7532 | 7532 | } |
| 7533 | 7533 | |
| 7534 | 7534 | foreach ($data as $key => &$valueInner) { |
@@ -7645,7 +7645,7 @@ discard block |
||
| 7645 | 7645 | * |
| 7646 | 7646 | * @return void |
| 7647 | 7647 | */ |
| 7648 | - static function (&$item) { |
|
| 7648 | + static function(&$item) { |
|
| 7649 | 7649 | if ($item instanceof self) { |
| 7650 | 7650 | $item = $item->getArray(); |
| 7651 | 7651 | } |
@@ -7670,7 +7670,7 @@ discard block |
||
| 7670 | 7670 | && |
| 7671 | 7671 | $this->checkPropertiesMismatch === true |
| 7672 | 7672 | ) { |
| 7673 | - throw new \TypeError('The key "' . $key . '" does not exists as "@property" phpdoc. (' . \get_class($this) . ').'); |
|
| 7673 | + throw new \TypeError('The key "'.$key.'" does not exists as "@property" phpdoc. ('.\get_class($this).').'); |
|
| 7674 | 7674 | } |
| 7675 | 7675 | |
| 7676 | 7676 | 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 | ); |