@@ -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 | /** |
@@ -625,7 +625,7 @@ discard block |
||
625 | 625 | */ |
626 | 626 | $this->callAtPath( |
627 | 627 | $containerPath, |
628 | - static function ($container) use ($lastOffset, &$offsetExists) { |
|
628 | + static function($container) use ($lastOffset, &$offsetExists) { |
|
629 | 629 | $offsetExists = \array_key_exists($lastOffset, $container); |
630 | 630 | } |
631 | 631 | ); |
@@ -720,7 +720,7 @@ discard block |
||
720 | 720 | */ |
721 | 721 | $this->callAtPath( |
722 | 722 | \implode($this->pathSeparator, $path), |
723 | - static function (&$offset) use ($pathToUnset) { |
|
723 | + static function(&$offset) use ($pathToUnset) { |
|
724 | 724 | unset($offset[$pathToUnset]); |
725 | 725 | } |
726 | 726 | ); |
@@ -766,7 +766,7 @@ discard block |
||
766 | 766 | } |
767 | 767 | |
768 | 768 | if (\strpos($iteratorClass, '\\') === 0) { |
769 | - $iteratorClass = '\\' . $iteratorClass; |
|
769 | + $iteratorClass = '\\'.$iteratorClass; |
|
770 | 770 | if (\class_exists($iteratorClass)) { |
771 | 771 | /** |
772 | 772 | * @psalm-suppress PropertyTypeCoercion |
@@ -777,7 +777,7 @@ discard block |
||
777 | 777 | } |
778 | 778 | } |
779 | 779 | |
780 | - throw new \InvalidArgumentException('The iterator class does not exist: ' . $iteratorClass); |
|
780 | + throw new \InvalidArgumentException('The iterator class does not exist: '.$iteratorClass); |
|
781 | 781 | } |
782 | 782 | |
783 | 783 | /** |
@@ -943,13 +943,13 @@ discard block |
||
943 | 943 | |
944 | 944 | foreach ($this->getGenerator() as $key => $item) { |
945 | 945 | if ($item instanceof self) { |
946 | - $result[$prefix . $key] = $item->appendToEachKey($prefix); |
|
946 | + $result[$prefix.$key] = $item->appendToEachKey($prefix); |
|
947 | 947 | } elseif (\is_array($item) === true) { |
948 | - $result[$prefix . $key] = self::create($item, $this->iteratorClass, false) |
|
948 | + $result[$prefix.$key] = self::create($item, $this->iteratorClass, false) |
|
949 | 949 | ->appendToEachKey($prefix) |
950 | 950 | ->toArray(); |
951 | 951 | } else { |
952 | - $result[$prefix . $key] = $item; |
|
952 | + $result[$prefix.$key] = $item; |
|
953 | 953 | } |
954 | 954 | } |
955 | 955 | |
@@ -980,7 +980,7 @@ discard block |
||
980 | 980 | } elseif (\is_object($item) === true) { |
981 | 981 | $result[$key] = $item; |
982 | 982 | } else { |
983 | - $result[$key] = $prefix . $item; |
|
983 | + $result[$key] = $prefix.$item; |
|
984 | 984 | } |
985 | 985 | } |
986 | 986 | |
@@ -1166,7 +1166,7 @@ discard block |
||
1166 | 1166 | public function clean(): self |
1167 | 1167 | { |
1168 | 1168 | return $this->filter( |
1169 | - static function ($value) { |
|
1169 | + static function($value) { |
|
1170 | 1170 | return (bool) $value; |
1171 | 1171 | } |
1172 | 1172 | ); |
@@ -1579,7 +1579,7 @@ discard block |
||
1579 | 1579 | */ |
1580 | 1580 | \array_walk( |
1581 | 1581 | $array, |
1582 | - static function (&$val) { |
|
1582 | + static function(&$val) { |
|
1583 | 1583 | if ((string) $val === $val) { |
1584 | 1584 | $val = \trim($val); |
1585 | 1585 | } |
@@ -2088,40 +2088,40 @@ discard block |
||
2088 | 2088 | } |
2089 | 2089 | |
2090 | 2090 | $ops = [ |
2091 | - 'eq' => static function ($item, $prop, $value): bool { |
|
2091 | + 'eq' => static function($item, $prop, $value): bool { |
|
2092 | 2092 | return $item[$prop] === $value; |
2093 | 2093 | }, |
2094 | - 'gt' => static function ($item, $prop, $value): bool { |
|
2094 | + 'gt' => static function($item, $prop, $value): bool { |
|
2095 | 2095 | return $item[$prop] > $value; |
2096 | 2096 | }, |
2097 | - 'ge' => static function ($item, $prop, $value): bool { |
|
2097 | + 'ge' => static function($item, $prop, $value): bool { |
|
2098 | 2098 | return $item[$prop] >= $value; |
2099 | 2099 | }, |
2100 | - 'gte' => static function ($item, $prop, $value): bool { |
|
2100 | + 'gte' => static function($item, $prop, $value): bool { |
|
2101 | 2101 | return $item[$prop] >= $value; |
2102 | 2102 | }, |
2103 | - 'lt' => static function ($item, $prop, $value): bool { |
|
2103 | + 'lt' => static function($item, $prop, $value): bool { |
|
2104 | 2104 | return $item[$prop] < $value; |
2105 | 2105 | }, |
2106 | - 'le' => static function ($item, $prop, $value): bool { |
|
2106 | + 'le' => static function($item, $prop, $value): bool { |
|
2107 | 2107 | return $item[$prop] <= $value; |
2108 | 2108 | }, |
2109 | - 'lte' => static function ($item, $prop, $value): bool { |
|
2109 | + 'lte' => static function($item, $prop, $value): bool { |
|
2110 | 2110 | return $item[$prop] <= $value; |
2111 | 2111 | }, |
2112 | - 'ne' => static function ($item, $prop, $value): bool { |
|
2112 | + 'ne' => static function($item, $prop, $value): bool { |
|
2113 | 2113 | return $item[$prop] !== $value; |
2114 | 2114 | }, |
2115 | - 'contains' => static function ($item, $prop, $value): bool { |
|
2115 | + 'contains' => static function($item, $prop, $value): bool { |
|
2116 | 2116 | return \in_array($item[$prop], (array) $value, true); |
2117 | 2117 | }, |
2118 | - 'notContains' => static function ($item, $prop, $value): bool { |
|
2118 | + 'notContains' => static function($item, $prop, $value): bool { |
|
2119 | 2119 | return !\in_array($item[$prop], (array) $value, true); |
2120 | 2120 | }, |
2121 | - 'newer' => static function ($item, $prop, $value): bool { |
|
2121 | + 'newer' => static function($item, $prop, $value): bool { |
|
2122 | 2122 | return \strtotime($item[$prop]) > \strtotime($value); |
2123 | 2123 | }, |
2124 | - 'older' => static function ($item, $prop, $value): bool { |
|
2124 | + 'older' => static function($item, $prop, $value): bool { |
|
2125 | 2125 | return \strtotime($item[$prop]) < \strtotime($value); |
2126 | 2126 | }, |
2127 | 2127 | ]; |
@@ -2129,7 +2129,7 @@ discard block |
||
2129 | 2129 | $result = \array_values( |
2130 | 2130 | \array_filter( |
2131 | 2131 | $this->toArray(false, true), |
2132 | - static function ($item) use ( |
|
2132 | + static function($item) use ( |
|
2133 | 2133 | $property, |
2134 | 2134 | $value, |
2135 | 2135 | $ops, |
@@ -2866,7 +2866,7 @@ discard block |
||
2866 | 2866 | \array_uintersect( |
2867 | 2867 | $this->toArray(), |
2868 | 2868 | $search, |
2869 | - static function ($a, $b) { |
|
2869 | + static function($a, $b) { |
|
2870 | 2870 | return $a === $b ? 0 : -1; |
2871 | 2871 | } |
2872 | 2872 | ), |
@@ -3161,13 +3161,13 @@ discard block |
||
3161 | 3161 | // non recursive |
3162 | 3162 | |
3163 | 3163 | if ($search_values === null) { |
3164 | - $arrayFunction = function (): \Generator { |
|
3164 | + $arrayFunction = function(): \Generator { |
|
3165 | 3165 | foreach ($this->getGenerator() as $key => $value) { |
3166 | 3166 | yield $key; |
3167 | 3167 | } |
3168 | 3168 | }; |
3169 | 3169 | } else { |
3170 | - $arrayFunction = function () use ($search_values, $strict): \Generator { |
|
3170 | + $arrayFunction = function() use ($search_values, $strict): \Generator { |
|
3171 | 3171 | $is_array_tmp = \is_array($search_values); |
3172 | 3172 | |
3173 | 3173 | foreach ($this->getGenerator() as $key => $value) { |
@@ -3413,7 +3413,7 @@ discard block |
||
3413 | 3413 | $useArguments = \func_num_args() > 2; |
3414 | 3414 | |
3415 | 3415 | return static::create( |
3416 | - function () use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
3416 | + function() use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
3417 | 3417 | foreach ($this->getGenerator() as $key => $value) { |
3418 | 3418 | if ($useArguments) { |
3419 | 3419 | if ($useKeyAsSecondParameter) { |
@@ -3829,7 +3829,7 @@ discard block |
||
3829 | 3829 | */ |
3830 | 3830 | public function nth(int $step, int $offset = 0): self |
3831 | 3831 | { |
3832 | - $arrayFunction = function () use ($step, $offset): \Generator { |
|
3832 | + $arrayFunction = function() use ($step, $offset): \Generator { |
|
3833 | 3833 | $position = 0; |
3834 | 3834 | foreach ($this->getGenerator() as $key => $value) { |
3835 | 3835 | if ($position++ % $step !== $offset) { |
@@ -3989,7 +3989,7 @@ discard block |
||
3989 | 3989 | )->prependToEachKey($suffix) |
3990 | 3990 | ->toArray(); |
3991 | 3991 | } else { |
3992 | - $result[$key . $suffix] = $item; |
|
3992 | + $result[$key.$suffix] = $item; |
|
3993 | 3993 | } |
3994 | 3994 | } |
3995 | 3995 | |
@@ -4029,7 +4029,7 @@ discard block |
||
4029 | 4029 | } elseif (\is_object($item) === true) { |
4030 | 4030 | $result[$key] = $item; |
4031 | 4031 | } else { |
4032 | - $result[$key] = $item . $suffix; |
|
4032 | + $result[$key] = $item.$suffix; |
|
4033 | 4033 | } |
4034 | 4034 | } |
4035 | 4035 | |
@@ -4721,7 +4721,7 @@ discard block |
||
4721 | 4721 | * @psalm-suppress MissingClosureParamType |
4722 | 4722 | */ |
4723 | 4723 | return $this->each( |
4724 | - static function ($value) use ($search, $replacement) { |
|
4724 | + static function($value) use ($search, $replacement) { |
|
4725 | 4725 | return \str_replace($search, $replacement, $value); |
4726 | 4726 | } |
4727 | 4727 | ); |
@@ -5346,7 +5346,7 @@ discard block |
||
5346 | 5346 | * @psalm-suppress MissingClosureParamType |
5347 | 5347 | */ |
5348 | 5348 | $results = $arrayy->each( |
5349 | - function ($value) use ($sorter) { |
|
5349 | + function($value) use ($sorter) { |
|
5350 | 5350 | if (\is_callable($sorter) === true) { |
5351 | 5351 | return $sorter($value); |
5352 | 5352 | } |
@@ -5444,7 +5444,7 @@ discard block |
||
5444 | 5444 | public function stripEmpty(): self |
5445 | 5445 | { |
5446 | 5446 | return $this->filter( |
5447 | - static function ($item) { |
|
5447 | + static function($item) { |
|
5448 | 5448 | if ($item === null) { |
5449 | 5449 | return false; |
5450 | 5450 | } |
@@ -5633,7 +5633,7 @@ discard block |
||
5633 | 5633 | * @psalm-suppress MissingClosureParamType |
5634 | 5634 | */ |
5635 | 5635 | $this->array = $this->reduce( |
5636 | - static function ($resultArray, $value) { |
|
5636 | + static function($resultArray, $value) { |
|
5637 | 5637 | if (!\in_array($value, $resultArray, true)) { |
5638 | 5638 | $resultArray[] = $value; |
5639 | 5639 | } |
@@ -5668,7 +5668,7 @@ discard block |
||
5668 | 5668 | */ |
5669 | 5669 | $this->array = \array_reduce( |
5670 | 5670 | \array_keys($array), |
5671 | - static function ($resultArray, $key) use ($array) { |
|
5671 | + static function($resultArray, $key) use ($array) { |
|
5672 | 5672 | if (!\in_array($array[$key], $resultArray, true)) { |
5673 | 5673 | $resultArray[$key] = $array[$key]; |
5674 | 5674 | } |
@@ -5748,7 +5748,7 @@ discard block |
||
5748 | 5748 | public function values(): self |
5749 | 5749 | { |
5750 | 5750 | return static::create( |
5751 | - function () { |
|
5751 | + function() { |
|
5752 | 5752 | /** @noinspection YieldFromCanBeUsedInspection */ |
5753 | 5753 | foreach ($this->getGenerator() as $value) { |
5754 | 5754 | yield $value; |
@@ -5799,7 +5799,7 @@ discard block |
||
5799 | 5799 | public function where(string $keyOrPropertyOrMethod, $value): self |
5800 | 5800 | { |
5801 | 5801 | return $this->filter( |
5802 | - function ($item) use ($keyOrPropertyOrMethod, $value) { |
|
5802 | + function($item) use ($keyOrPropertyOrMethod, $value) { |
|
5803 | 5803 | $accessorValue = $this->extractValue( |
5804 | 5804 | $item, |
5805 | 5805 | $keyOrPropertyOrMethod |
@@ -6089,7 +6089,7 @@ discard block |
||
6089 | 6089 | protected function getPropertiesFromPhpDoc() |
6090 | 6090 | { |
6091 | 6091 | static $PROPERTY_CACHE = []; |
6092 | - $cacheKey = 'Class::' . static::class; |
|
6092 | + $cacheKey = 'Class::'.static::class; |
|
6093 | 6093 | |
6094 | 6094 | if (isset($PROPERTY_CACHE[$cacheKey])) { |
6095 | 6095 | return $PROPERTY_CACHE[$cacheKey]; |
@@ -6427,7 +6427,7 @@ discard block |
||
6427 | 6427 | && |
6428 | 6428 | \count(\array_diff_key($properties, $data)) > 0 |
6429 | 6429 | ) { |
6430 | - throw new \TypeError('Property mismatch - input: ' . \print_r(\array_keys($data), true) . ' | expected: ' . \print_r(\array_keys($properties), true)); |
|
6430 | + throw new \TypeError('Property mismatch - input: '.\print_r(\array_keys($data), true).' | expected: '.\print_r(\array_keys($properties), true)); |
|
6431 | 6431 | } |
6432 | 6432 | |
6433 | 6433 | foreach ($data as $key => &$valueInner) { |
@@ -6535,7 +6535,7 @@ discard block |
||
6535 | 6535 | && |
6536 | 6536 | $this->checkPropertiesMismatch === true |
6537 | 6537 | ) { |
6538 | - throw new \TypeError('The key ' . $key . ' does not exists in "properties". Maybe because @property was not used for the class (' . \get_class($this) . ').'); |
|
6538 | + throw new \TypeError('The key '.$key.' does not exists in "properties". Maybe because @property was not used for the class ('.\get_class($this).').'); |
|
6539 | 6539 | } |
6540 | 6540 | |
6541 | 6541 | if (isset($this->properties[self::ARRAYY_HELPER_TYPES_FOR_ALL_PROPERTIES])) { |