@@ -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 ''; |
@@ -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 | * |
@@ -1267,11 +1267,11 @@ discard block |
||
1267 | 1267 | \array_intersect($needles, $this->keys()->toArray()), |
1268 | 1268 | \COUNT_NORMAL |
1269 | 1269 | ) |
1270 | - === |
|
1271 | - \count( |
|
1272 | - $needles, |
|
1273 | - \COUNT_NORMAL |
|
1274 | - ); |
|
1270 | + === |
|
1271 | + \count( |
|
1272 | + $needles, |
|
1273 | + \COUNT_NORMAL |
|
1274 | + ); |
|
1275 | 1275 | } |
1276 | 1276 | |
1277 | 1277 | /** |
@@ -1334,8 +1334,8 @@ discard block |
||
1334 | 1334 | public function containsValues(array $needles): bool |
1335 | 1335 | { |
1336 | 1336 | return \count(\array_intersect($needles, $this->toArray()), \COUNT_NORMAL) |
1337 | - === |
|
1338 | - \count($needles, \COUNT_NORMAL); |
|
1337 | + === |
|
1338 | + \count($needles, \COUNT_NORMAL); |
|
1339 | 1339 | } |
1340 | 1340 | |
1341 | 1341 | /** |
@@ -3024,15 +3024,15 @@ discard block |
||
3024 | 3024 | |
3025 | 3025 | if ($recursive === true) { |
3026 | 3026 | return $this->array_keys_recursive($this->toArray()) |
3027 | - === |
|
3028 | - \range(0, \count($this->toArray(), \COUNT_RECURSIVE) - 1); |
|
3027 | + === |
|
3028 | + \range(0, \count($this->toArray(), \COUNT_RECURSIVE) - 1); |
|
3029 | 3029 | } |
3030 | 3030 | |
3031 | 3031 | // non recursive |
3032 | 3032 | |
3033 | 3033 | return \array_keys($this->toArray()) |
3034 | - === |
|
3035 | - \range(0, \count($this->toArray(), \COUNT_NORMAL) - 1); |
|
3034 | + === |
|
3035 | + \range(0, \count($this->toArray(), \COUNT_NORMAL) - 1); |
|
3036 | 3036 | } |
3037 | 3037 | |
3038 | 3038 | /** |
@@ -603,7 +603,7 @@ discard block |
||
603 | 603 | |
604 | 604 | $this->callAtPath( |
605 | 605 | $containerPath, |
606 | - static function ($container) use ($lastOffset, &$offsetExists) { |
|
606 | + static function($container) use ($lastOffset, &$offsetExists) { |
|
607 | 607 | $offsetExists = \array_key_exists($lastOffset, $container); |
608 | 608 | } |
609 | 609 | ); |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | |
690 | 690 | $this->callAtPath( |
691 | 691 | \implode($this->pathSeparator, $path), |
692 | - static function (&$offset) use ($pathToUnset) { |
|
692 | + static function(&$offset) use ($pathToUnset) { |
|
693 | 693 | unset($offset[$pathToUnset]); |
694 | 694 | } |
695 | 695 | ); |
@@ -735,7 +735,7 @@ discard block |
||
735 | 735 | } |
736 | 736 | |
737 | 737 | if (\strpos($iteratorClass, '\\') === 0) { |
738 | - $iteratorClass = '\\' . $iteratorClass; |
|
738 | + $iteratorClass = '\\'.$iteratorClass; |
|
739 | 739 | if (\class_exists($iteratorClass)) { |
740 | 740 | $this->iteratorClass = $iteratorClass; |
741 | 741 | |
@@ -743,7 +743,7 @@ discard block |
||
743 | 743 | } |
744 | 744 | } |
745 | 745 | |
746 | - throw new \InvalidArgumentException('The iterator class does not exist: ' . $iteratorClass); |
|
746 | + throw new \InvalidArgumentException('The iterator class does not exist: '.$iteratorClass); |
|
747 | 747 | } |
748 | 748 | |
749 | 749 | /** |
@@ -906,13 +906,13 @@ discard block |
||
906 | 906 | |
907 | 907 | foreach ($this->getGenerator() as $key => $item) { |
908 | 908 | if ($item instanceof self) { |
909 | - $result[$prefix . $key] = $item->appendToEachKey($prefix); |
|
909 | + $result[$prefix.$key] = $item->appendToEachKey($prefix); |
|
910 | 910 | } elseif (\is_array($item) === true) { |
911 | - $result[$prefix . $key] = self::create($item, $this->iteratorClass, false) |
|
911 | + $result[$prefix.$key] = self::create($item, $this->iteratorClass, false) |
|
912 | 912 | ->appendToEachKey($prefix) |
913 | 913 | ->toArray(); |
914 | 914 | } else { |
915 | - $result[$prefix . $key] = $item; |
|
915 | + $result[$prefix.$key] = $item; |
|
916 | 916 | } |
917 | 917 | } |
918 | 918 | |
@@ -943,7 +943,7 @@ discard block |
||
943 | 943 | } elseif (\is_object($item) === true) { |
944 | 944 | $result[$key] = $item; |
945 | 945 | } else { |
946 | - $result[$key] = $prefix . $item; |
|
946 | + $result[$key] = $prefix.$item; |
|
947 | 947 | } |
948 | 948 | } |
949 | 949 | |
@@ -1129,7 +1129,7 @@ discard block |
||
1129 | 1129 | public function clean(): self |
1130 | 1130 | { |
1131 | 1131 | return $this->filter( |
1132 | - static function ($value) { |
|
1132 | + static function($value) { |
|
1133 | 1133 | return (bool) $value; |
1134 | 1134 | } |
1135 | 1135 | ); |
@@ -1533,7 +1533,7 @@ discard block |
||
1533 | 1533 | */ |
1534 | 1534 | \array_walk( |
1535 | 1535 | $array, |
1536 | - static function (&$val) { |
|
1536 | + static function(&$val) { |
|
1537 | 1537 | if ((string) $val === $val) { |
1538 | 1538 | $val = \trim($val); |
1539 | 1539 | } |
@@ -2042,40 +2042,40 @@ discard block |
||
2042 | 2042 | } |
2043 | 2043 | |
2044 | 2044 | $ops = [ |
2045 | - 'eq' => static function ($item, $prop, $value): bool { |
|
2045 | + 'eq' => static function($item, $prop, $value): bool { |
|
2046 | 2046 | return $item[$prop] === $value; |
2047 | 2047 | }, |
2048 | - 'gt' => static function ($item, $prop, $value): bool { |
|
2048 | + 'gt' => static function($item, $prop, $value): bool { |
|
2049 | 2049 | return $item[$prop] > $value; |
2050 | 2050 | }, |
2051 | - 'ge' => static function ($item, $prop, $value): bool { |
|
2051 | + 'ge' => static function($item, $prop, $value): bool { |
|
2052 | 2052 | return $item[$prop] >= $value; |
2053 | 2053 | }, |
2054 | - 'gte' => static function ($item, $prop, $value): bool { |
|
2054 | + 'gte' => static function($item, $prop, $value): bool { |
|
2055 | 2055 | return $item[$prop] >= $value; |
2056 | 2056 | }, |
2057 | - 'lt' => static function ($item, $prop, $value): bool { |
|
2057 | + 'lt' => static function($item, $prop, $value): bool { |
|
2058 | 2058 | return $item[$prop] < $value; |
2059 | 2059 | }, |
2060 | - 'le' => static function ($item, $prop, $value): bool { |
|
2060 | + 'le' => static function($item, $prop, $value): bool { |
|
2061 | 2061 | return $item[$prop] <= $value; |
2062 | 2062 | }, |
2063 | - 'lte' => static function ($item, $prop, $value): bool { |
|
2063 | + 'lte' => static function($item, $prop, $value): bool { |
|
2064 | 2064 | return $item[$prop] <= $value; |
2065 | 2065 | }, |
2066 | - 'ne' => static function ($item, $prop, $value): bool { |
|
2066 | + 'ne' => static function($item, $prop, $value): bool { |
|
2067 | 2067 | return $item[$prop] !== $value; |
2068 | 2068 | }, |
2069 | - 'contains' => static function ($item, $prop, $value): bool { |
|
2069 | + 'contains' => static function($item, $prop, $value): bool { |
|
2070 | 2070 | return \in_array($item[$prop], (array) $value, true); |
2071 | 2071 | }, |
2072 | - 'notContains' => static function ($item, $prop, $value): bool { |
|
2072 | + 'notContains' => static function($item, $prop, $value): bool { |
|
2073 | 2073 | return !\in_array($item[$prop], (array) $value, true); |
2074 | 2074 | }, |
2075 | - 'newer' => static function ($item, $prop, $value): bool { |
|
2075 | + 'newer' => static function($item, $prop, $value): bool { |
|
2076 | 2076 | return \strtotime($item[$prop]) > \strtotime($value); |
2077 | 2077 | }, |
2078 | - 'older' => static function ($item, $prop, $value): bool { |
|
2078 | + 'older' => static function($item, $prop, $value): bool { |
|
2079 | 2079 | return \strtotime($item[$prop]) < \strtotime($value); |
2080 | 2080 | }, |
2081 | 2081 | ]; |
@@ -2083,7 +2083,7 @@ discard block |
||
2083 | 2083 | $result = \array_values( |
2084 | 2084 | \array_filter( |
2085 | 2085 | $this->toArray(false, true), |
2086 | - static function ($item) use ( |
|
2086 | + static function($item) use ( |
|
2087 | 2087 | $property, |
2088 | 2088 | $value, |
2089 | 2089 | $ops, |
@@ -2820,7 +2820,7 @@ discard block |
||
2820 | 2820 | \array_uintersect( |
2821 | 2821 | $this->toArray(), |
2822 | 2822 | $search, |
2823 | - static function ($a, $b) { |
|
2823 | + static function($a, $b) { |
|
2824 | 2824 | return $a === $b ? 0 : -1; |
2825 | 2825 | } |
2826 | 2826 | ), |
@@ -3114,13 +3114,13 @@ discard block |
||
3114 | 3114 | // non recursive |
3115 | 3115 | |
3116 | 3116 | if ($search_values === null) { |
3117 | - $arrayFunction = function (): \Generator { |
|
3117 | + $arrayFunction = function(): \Generator { |
|
3118 | 3118 | foreach ($this->getGenerator() as $key => $value) { |
3119 | 3119 | yield $key; |
3120 | 3120 | } |
3121 | 3121 | }; |
3122 | 3122 | } else { |
3123 | - $arrayFunction = function () use ($search_values, $strict): \Generator { |
|
3123 | + $arrayFunction = function() use ($search_values, $strict): \Generator { |
|
3124 | 3124 | $is_array_tmp = \is_array($search_values); |
3125 | 3125 | |
3126 | 3126 | foreach ($this->getGenerator() as $key => $value) { |
@@ -3366,7 +3366,7 @@ discard block |
||
3366 | 3366 | $useArguments = \func_num_args() > 2; |
3367 | 3367 | |
3368 | 3368 | return static::create( |
3369 | - function () use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
3369 | + function() use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
3370 | 3370 | foreach ($this->getGenerator() as $key => $value) { |
3371 | 3371 | if ($useArguments) { |
3372 | 3372 | if ($useKeyAsSecondParameter) { |
@@ -3782,7 +3782,7 @@ discard block |
||
3782 | 3782 | */ |
3783 | 3783 | public function nth(int $step, int $offset = 0): self |
3784 | 3784 | { |
3785 | - $arrayFunction = function () use ($step, $offset): \Generator { |
|
3785 | + $arrayFunction = function() use ($step, $offset): \Generator { |
|
3786 | 3786 | $position = 0; |
3787 | 3787 | foreach ($this->getGenerator() as $key => $value) { |
3788 | 3788 | if ($position++ % $step !== $offset) { |
@@ -3942,7 +3942,7 @@ discard block |
||
3942 | 3942 | )->prependToEachKey($suffix) |
3943 | 3943 | ->toArray(); |
3944 | 3944 | } else { |
3945 | - $result[$key . $suffix] = $item; |
|
3945 | + $result[$key.$suffix] = $item; |
|
3946 | 3946 | } |
3947 | 3947 | } |
3948 | 3948 | |
@@ -3982,7 +3982,7 @@ discard block |
||
3982 | 3982 | } elseif (\is_object($item) === true) { |
3983 | 3983 | $result[$key] = $item; |
3984 | 3984 | } else { |
3985 | - $result[$key] = $item . $suffix; |
|
3985 | + $result[$key] = $item.$suffix; |
|
3986 | 3986 | } |
3987 | 3987 | } |
3988 | 3988 | |
@@ -4674,7 +4674,7 @@ discard block |
||
4674 | 4674 | * @psalm-suppress MissingClosureParamType |
4675 | 4675 | */ |
4676 | 4676 | return $this->each( |
4677 | - static function ($value) use ($search, $replacement) { |
|
4677 | + static function($value) use ($search, $replacement) { |
|
4678 | 4678 | return \str_replace($search, $replacement, $value); |
4679 | 4679 | } |
4680 | 4680 | ); |
@@ -5299,7 +5299,7 @@ discard block |
||
5299 | 5299 | * @psalm-suppress MissingClosureParamType |
5300 | 5300 | */ |
5301 | 5301 | $results = $arrayy->each( |
5302 | - function ($value) use ($sorter) { |
|
5302 | + function($value) use ($sorter) { |
|
5303 | 5303 | if (\is_callable($sorter) === true) { |
5304 | 5304 | return $sorter($value); |
5305 | 5305 | } |
@@ -5397,7 +5397,7 @@ discard block |
||
5397 | 5397 | public function stripEmpty(): self |
5398 | 5398 | { |
5399 | 5399 | return $this->filter( |
5400 | - static function ($item) { |
|
5400 | + static function($item) { |
|
5401 | 5401 | if ($item === null) { |
5402 | 5402 | return false; |
5403 | 5403 | } |
@@ -5586,7 +5586,7 @@ discard block |
||
5586 | 5586 | * @psalm-suppress MissingClosureParamType |
5587 | 5587 | */ |
5588 | 5588 | $this->array = $this->reduce( |
5589 | - static function ($resultArray, $value) { |
|
5589 | + static function($resultArray, $value) { |
|
5590 | 5590 | if (!\in_array($value, $resultArray, true)) { |
5591 | 5591 | $resultArray[] = $value; |
5592 | 5592 | } |
@@ -5621,7 +5621,7 @@ discard block |
||
5621 | 5621 | */ |
5622 | 5622 | $this->array = \array_reduce( |
5623 | 5623 | \array_keys($array), |
5624 | - static function ($resultArray, $key) use ($array) { |
|
5624 | + static function($resultArray, $key) use ($array) { |
|
5625 | 5625 | if (!\in_array($array[$key], $resultArray, true)) { |
5626 | 5626 | $resultArray[$key] = $array[$key]; |
5627 | 5627 | } |
@@ -5701,7 +5701,7 @@ discard block |
||
5701 | 5701 | public function values(): self |
5702 | 5702 | { |
5703 | 5703 | return static::create( |
5704 | - function () { |
|
5704 | + function() { |
|
5705 | 5705 | /** @noinspection YieldFromCanBeUsedInspection */ |
5706 | 5706 | foreach ($this->getGenerator() as $value) { |
5707 | 5707 | yield $value; |
@@ -5752,7 +5752,7 @@ discard block |
||
5752 | 5752 | public function where(string $keyOrPropertyOrMethod, $value): self |
5753 | 5753 | { |
5754 | 5754 | return $this->filter( |
5755 | - function ($item) use ($keyOrPropertyOrMethod, $value) { |
|
5755 | + function($item) use ($keyOrPropertyOrMethod, $value) { |
|
5756 | 5756 | $accessorValue = $this->extractValue( |
5757 | 5757 | $item, |
5758 | 5758 | $keyOrPropertyOrMethod |
@@ -6041,7 +6041,7 @@ discard block |
||
6041 | 6041 | protected function getPropertiesFromPhpDoc() |
6042 | 6042 | { |
6043 | 6043 | static $PROPERTY_CACHE = []; |
6044 | - $cacheKey = 'Class::' . static::class; |
|
6044 | + $cacheKey = 'Class::'.static::class; |
|
6045 | 6045 | |
6046 | 6046 | if (isset($PROPERTY_CACHE[$cacheKey])) { |
6047 | 6047 | return $PROPERTY_CACHE[$cacheKey]; |
@@ -6378,7 +6378,7 @@ discard block |
||
6378 | 6378 | && |
6379 | 6379 | \count(\array_diff_key($properties, $data)) > 0 |
6380 | 6380 | ) { |
6381 | - throw new \TypeError('Property mismatch - input: ' . \print_r(\array_keys($data), true) . ' | expected: ' . \print_r(\array_keys($properties), true)); |
|
6381 | + throw new \TypeError('Property mismatch - input: '.\print_r(\array_keys($data), true).' | expected: '.\print_r(\array_keys($properties), true)); |
|
6382 | 6382 | } |
6383 | 6383 | |
6384 | 6384 | foreach ($data as $key => &$valueInner) { |
@@ -6486,7 +6486,7 @@ discard block |
||
6486 | 6486 | && |
6487 | 6487 | $this->checkPropertiesMismatch === true |
6488 | 6488 | ) { |
6489 | - throw new \TypeError('The key ' . $key . ' does not exists in "properties". Maybe because @property was not used for the class (' . \get_class($this) . ').'); |
|
6489 | + throw new \TypeError('The key '.$key.' does not exists in "properties". Maybe because @property was not used for the class ('.\get_class($this).').'); |
|
6490 | 6490 | } |
6491 | 6491 | |
6492 | 6492 | if (isset($this->properties[self::ARRAYY_HELPER_TYPES_FOR_ALL_PROPERTIES])) { |