@@ -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 | * |
@@ -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 | /** |
@@ -644,7 +644,7 @@ discard block |
||
644 | 644 | */ |
645 | 645 | $this->callAtPath( |
646 | 646 | $containerPath, |
647 | - static function ($container) use ($lastOffset, &$offsetExists) { |
|
647 | + static function($container) use ($lastOffset, &$offsetExists) { |
|
648 | 648 | $offsetExists = \array_key_exists($lastOffset, $container); |
649 | 649 | } |
650 | 650 | ); |
@@ -747,7 +747,7 @@ discard block |
||
747 | 747 | */ |
748 | 748 | $this->callAtPath( |
749 | 749 | \implode($this->pathSeparator, $path), |
750 | - static function (&$offset) use ($pathToUnset) { |
|
750 | + static function(&$offset) use ($pathToUnset) { |
|
751 | 751 | if (\is_array($offset)) { |
752 | 752 | unset($offset[$pathToUnset]); |
753 | 753 | } else { |
@@ -797,7 +797,7 @@ discard block |
||
797 | 797 | } |
798 | 798 | |
799 | 799 | if (\strpos($iteratorClass, '\\') === 0) { |
800 | - $iteratorClass = '\\' . $iteratorClass; |
|
800 | + $iteratorClass = '\\'.$iteratorClass; |
|
801 | 801 | if (\class_exists($iteratorClass)) { |
802 | 802 | /** |
803 | 803 | * @psalm-suppress PropertyTypeCoercion |
@@ -808,7 +808,7 @@ discard block |
||
808 | 808 | } |
809 | 809 | } |
810 | 810 | |
811 | - throw new \InvalidArgumentException('The iterator class does not exist: ' . $iteratorClass); |
|
811 | + throw new \InvalidArgumentException('The iterator class does not exist: '.$iteratorClass); |
|
812 | 812 | } |
813 | 813 | |
814 | 814 | /** |
@@ -978,13 +978,13 @@ discard block |
||
978 | 978 | |
979 | 979 | foreach ($this->getGenerator() as $key => $item) { |
980 | 980 | if ($item instanceof self) { |
981 | - $result[$prefix . $key] = $item->appendToEachKey($prefix); |
|
981 | + $result[$prefix.$key] = $item->appendToEachKey($prefix); |
|
982 | 982 | } elseif (\is_array($item) === true) { |
983 | - $result[$prefix . $key] = self::create($item, $this->iteratorClass, false) |
|
983 | + $result[$prefix.$key] = self::create($item, $this->iteratorClass, false) |
|
984 | 984 | ->appendToEachKey($prefix) |
985 | 985 | ->toArray(); |
986 | 986 | } else { |
987 | - $result[$prefix . $key] = $item; |
|
987 | + $result[$prefix.$key] = $item; |
|
988 | 988 | } |
989 | 989 | } |
990 | 990 | |
@@ -1015,7 +1015,7 @@ discard block |
||
1015 | 1015 | } elseif (\is_object($item) === true) { |
1016 | 1016 | $result[$key] = $item; |
1017 | 1017 | } else { |
1018 | - $result[$key] = $prefix . $item; |
|
1018 | + $result[$key] = $prefix.$item; |
|
1019 | 1019 | } |
1020 | 1020 | } |
1021 | 1021 | |
@@ -1223,7 +1223,7 @@ discard block |
||
1223 | 1223 | public function clean(): self |
1224 | 1224 | { |
1225 | 1225 | return $this->filter( |
1226 | - static function ($value) { |
|
1226 | + static function($value) { |
|
1227 | 1227 | return (bool) $value; |
1228 | 1228 | } |
1229 | 1229 | ); |
@@ -1545,9 +1545,9 @@ discard block |
||
1545 | 1545 | |
1546 | 1546 | foreach ($items as $key => $value) { |
1547 | 1547 | if (\is_array($value) && !empty($value)) { |
1548 | - $flatten[] = $this->flatten($delimiter, $prepend . $key . $delimiter, $value); |
|
1548 | + $flatten[] = $this->flatten($delimiter, $prepend.$key.$delimiter, $value); |
|
1549 | 1549 | } else { |
1550 | - $flatten[] = [$prepend . $key => $value]; |
|
1550 | + $flatten[] = [$prepend.$key => $value]; |
|
1551 | 1551 | } |
1552 | 1552 | } |
1553 | 1553 | |
@@ -1725,7 +1725,7 @@ discard block |
||
1725 | 1725 | */ |
1726 | 1726 | \array_walk( |
1727 | 1727 | $array, |
1728 | - static function (&$val) { |
|
1728 | + static function(&$val) { |
|
1729 | 1729 | if ((string) $val === $val) { |
1730 | 1730 | $val = \trim($val); |
1731 | 1731 | } |
@@ -2263,40 +2263,40 @@ discard block |
||
2263 | 2263 | } |
2264 | 2264 | |
2265 | 2265 | $ops = [ |
2266 | - 'eq' => static function ($item, $prop, $value): bool { |
|
2266 | + 'eq' => static function($item, $prop, $value): bool { |
|
2267 | 2267 | return $item[$prop] === $value; |
2268 | 2268 | }, |
2269 | - 'gt' => static function ($item, $prop, $value): bool { |
|
2269 | + 'gt' => static function($item, $prop, $value): bool { |
|
2270 | 2270 | return $item[$prop] > $value; |
2271 | 2271 | }, |
2272 | - 'ge' => static function ($item, $prop, $value): bool { |
|
2272 | + 'ge' => static function($item, $prop, $value): bool { |
|
2273 | 2273 | return $item[$prop] >= $value; |
2274 | 2274 | }, |
2275 | - 'gte' => static function ($item, $prop, $value): bool { |
|
2275 | + 'gte' => static function($item, $prop, $value): bool { |
|
2276 | 2276 | return $item[$prop] >= $value; |
2277 | 2277 | }, |
2278 | - 'lt' => static function ($item, $prop, $value): bool { |
|
2278 | + 'lt' => static function($item, $prop, $value): bool { |
|
2279 | 2279 | return $item[$prop] < $value; |
2280 | 2280 | }, |
2281 | - 'le' => static function ($item, $prop, $value): bool { |
|
2281 | + 'le' => static function($item, $prop, $value): bool { |
|
2282 | 2282 | return $item[$prop] <= $value; |
2283 | 2283 | }, |
2284 | - 'lte' => static function ($item, $prop, $value): bool { |
|
2284 | + 'lte' => static function($item, $prop, $value): bool { |
|
2285 | 2285 | return $item[$prop] <= $value; |
2286 | 2286 | }, |
2287 | - 'ne' => static function ($item, $prop, $value): bool { |
|
2287 | + 'ne' => static function($item, $prop, $value): bool { |
|
2288 | 2288 | return $item[$prop] !== $value; |
2289 | 2289 | }, |
2290 | - 'contains' => static function ($item, $prop, $value): bool { |
|
2290 | + 'contains' => static function($item, $prop, $value): bool { |
|
2291 | 2291 | return \in_array($item[$prop], (array) $value, true); |
2292 | 2292 | }, |
2293 | - 'notContains' => static function ($item, $prop, $value): bool { |
|
2293 | + 'notContains' => static function($item, $prop, $value): bool { |
|
2294 | 2294 | return !\in_array($item[$prop], (array) $value, true); |
2295 | 2295 | }, |
2296 | - 'newer' => static function ($item, $prop, $value): bool { |
|
2296 | + 'newer' => static function($item, $prop, $value): bool { |
|
2297 | 2297 | return \strtotime($item[$prop]) > \strtotime($value); |
2298 | 2298 | }, |
2299 | - 'older' => static function ($item, $prop, $value): bool { |
|
2299 | + 'older' => static function($item, $prop, $value): bool { |
|
2300 | 2300 | return \strtotime($item[$prop]) < \strtotime($value); |
2301 | 2301 | }, |
2302 | 2302 | ]; |
@@ -2304,7 +2304,7 @@ discard block |
||
2304 | 2304 | $result = \array_values( |
2305 | 2305 | \array_filter( |
2306 | 2306 | $this->toArray(false, true), |
2307 | - static function ($item) use ( |
|
2307 | + static function($item) use ( |
|
2308 | 2308 | $property, |
2309 | 2309 | $value, |
2310 | 2310 | $ops, |
@@ -2717,9 +2717,9 @@ discard block |
||
2717 | 2717 | $jsonObject = \json_decode($json, false); |
2718 | 2718 | |
2719 | 2719 | $mapper = new \Arrayy\Mapper\Json(); |
2720 | - $mapper->undefinedPropertyHandler = static function ($object, $key, $jsonValue) use ($class) { |
|
2720 | + $mapper->undefinedPropertyHandler = static function($object, $key, $jsonValue) use ($class) { |
|
2721 | 2721 | if ($class->checkPropertiesMismatchInConstructor) { |
2722 | - throw new \TypeError('Property mismatch - input: ' . \print_r(['key' => $key, 'jsonValue' => $jsonValue], true) . ' for object: ' . \get_class($object)); |
|
2722 | + throw new \TypeError('Property mismatch - input: '.\print_r(['key' => $key, 'jsonValue' => $jsonValue], true).' for object: '.\get_class($object)); |
|
2723 | 2723 | } |
2724 | 2724 | }; |
2725 | 2725 | |
@@ -3180,7 +3180,7 @@ discard block |
||
3180 | 3180 | \array_uintersect( |
3181 | 3181 | $this->toArray(), |
3182 | 3182 | $search, |
3183 | - static function ($a, $b) { |
|
3183 | + static function($a, $b) { |
|
3184 | 3184 | return $a === $b ? 0 : -1; |
3185 | 3185 | } |
3186 | 3186 | ), |
@@ -3477,13 +3477,13 @@ discard block |
||
3477 | 3477 | // non recursive |
3478 | 3478 | |
3479 | 3479 | if ($search_values === null) { |
3480 | - $arrayFunction = function (): \Generator { |
|
3480 | + $arrayFunction = function(): \Generator { |
|
3481 | 3481 | foreach ($this->getGenerator() as $key => $value) { |
3482 | 3482 | yield $key; |
3483 | 3483 | } |
3484 | 3484 | }; |
3485 | 3485 | } else { |
3486 | - $arrayFunction = function () use ($search_values, $strict): \Generator { |
|
3486 | + $arrayFunction = function() use ($search_values, $strict): \Generator { |
|
3487 | 3487 | $is_array_tmp = \is_array($search_values); |
3488 | 3488 | |
3489 | 3489 | /** @noinspection PhpParameterByRefIsNotUsedAsReferenceInspection */ |
@@ -3728,7 +3728,7 @@ discard block |
||
3728 | 3728 | $useArguments = \func_num_args() > 2; |
3729 | 3729 | |
3730 | 3730 | return static::create( |
3731 | - function () use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
3731 | + function() use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
3732 | 3732 | foreach ($this->getGenerator() as $key => $value) { |
3733 | 3733 | if ($useArguments) { |
3734 | 3734 | if ($useKeyAsSecondParameter) { |
@@ -4150,7 +4150,7 @@ discard block |
||
4150 | 4150 | */ |
4151 | 4151 | public function nth(int $step, int $offset = 0): self |
4152 | 4152 | { |
4153 | - $arrayFunction = function () use ($step, $offset): \Generator { |
|
4153 | + $arrayFunction = function() use ($step, $offset): \Generator { |
|
4154 | 4154 | $position = 0; |
4155 | 4155 | foreach ($this->getGenerator() as $key => $value) { |
4156 | 4156 | if ($position++ % $step !== $offset) { |
@@ -4314,7 +4314,7 @@ discard block |
||
4314 | 4314 | )->prependToEachKey($suffix) |
4315 | 4315 | ->toArray(); |
4316 | 4316 | } else { |
4317 | - $result[$key . $suffix] = $item; |
|
4317 | + $result[$key.$suffix] = $item; |
|
4318 | 4318 | } |
4319 | 4319 | } |
4320 | 4320 | |
@@ -4354,7 +4354,7 @@ discard block |
||
4354 | 4354 | } elseif (\is_object($item) === true) { |
4355 | 4355 | $result[$key] = $item; |
4356 | 4356 | } else { |
4357 | - $result[$key] = $item . $suffix; |
|
4357 | + $result[$key] = $item.$suffix; |
|
4358 | 4358 | } |
4359 | 4359 | } |
4360 | 4360 | |
@@ -5046,7 +5046,7 @@ discard block |
||
5046 | 5046 | * @psalm-suppress MissingClosureParamType |
5047 | 5047 | */ |
5048 | 5048 | return $this->each( |
5049 | - static function ($value) use ($search, $replacement) { |
|
5049 | + static function($value) use ($search, $replacement) { |
|
5050 | 5050 | return \str_replace($search, $replacement, $value); |
5051 | 5051 | } |
5052 | 5052 | ); |
@@ -5673,7 +5673,7 @@ discard block |
||
5673 | 5673 | * @psalm-suppress MissingClosureParamType |
5674 | 5674 | */ |
5675 | 5675 | $results = $arrayy->each( |
5676 | - function ($value) use ($sorter) { |
|
5676 | + function($value) use ($sorter) { |
|
5677 | 5677 | if (\is_callable($sorter) === true) { |
5678 | 5678 | return $sorter($value); |
5679 | 5679 | } |
@@ -5771,7 +5771,7 @@ discard block |
||
5771 | 5771 | public function stripEmpty(): self |
5772 | 5772 | { |
5773 | 5773 | return $this->filter( |
5774 | - static function ($item) { |
|
5774 | + static function($item) { |
|
5775 | 5775 | if ($item === null) { |
5776 | 5776 | return false; |
5777 | 5777 | } |
@@ -5960,7 +5960,7 @@ discard block |
||
5960 | 5960 | * @psalm-suppress MissingClosureParamType |
5961 | 5961 | */ |
5962 | 5962 | $this->array = $this->reduce( |
5963 | - static function ($resultArray, $value) { |
|
5963 | + static function($resultArray, $value) { |
|
5964 | 5964 | if (!\in_array($value, $resultArray, true)) { |
5965 | 5965 | $resultArray[] = $value; |
5966 | 5966 | } |
@@ -5995,7 +5995,7 @@ discard block |
||
5995 | 5995 | */ |
5996 | 5996 | $this->array = \array_reduce( |
5997 | 5997 | \array_keys($array), |
5998 | - static function ($resultArray, $key) use ($array) { |
|
5998 | + static function($resultArray, $key) use ($array) { |
|
5999 | 5999 | if (!\in_array($array[$key], $resultArray, true)) { |
6000 | 6000 | $resultArray[$key] = $array[$key]; |
6001 | 6001 | } |
@@ -6075,7 +6075,7 @@ discard block |
||
6075 | 6075 | public function values(): self |
6076 | 6076 | { |
6077 | 6077 | return static::create( |
6078 | - function () { |
|
6078 | + function() { |
|
6079 | 6079 | /** @noinspection YieldFromCanBeUsedInspection */ |
6080 | 6080 | foreach ($this->getGenerator() as $value) { |
6081 | 6081 | yield $value; |
@@ -6140,7 +6140,7 @@ discard block |
||
6140 | 6140 | public function where(string $keyOrPropertyOrMethod, $value): self |
6141 | 6141 | { |
6142 | 6142 | return $this->filter( |
6143 | - function ($item) use ($keyOrPropertyOrMethod, $value) { |
|
6143 | + function($item) use ($keyOrPropertyOrMethod, $value) { |
|
6144 | 6144 | $accessorValue = $this->extractValue( |
6145 | 6145 | $item, |
6146 | 6146 | $keyOrPropertyOrMethod |
@@ -6430,7 +6430,7 @@ discard block |
||
6430 | 6430 | protected function getPropertiesFromPhpDoc() |
6431 | 6431 | { |
6432 | 6432 | static $PROPERTY_CACHE = []; |
6433 | - $cacheKey = 'Class::' . static::class; |
|
6433 | + $cacheKey = 'Class::'.static::class; |
|
6434 | 6434 | |
6435 | 6435 | if (isset($PROPERTY_CACHE[$cacheKey])) { |
6436 | 6436 | return $PROPERTY_CACHE[$cacheKey]; |
@@ -6712,7 +6712,7 @@ discard block |
||
6712 | 6712 | if ($array === null) { |
6713 | 6713 | $array = []; |
6714 | 6714 | } elseif (!\is_array($array)) { |
6715 | - throw new \RuntimeException('Can not set value at this path "' . $key . '" because (' . \gettype($array) . ')"' . \print_r($array, true) . '" is not an array.'); |
|
6715 | + throw new \RuntimeException('Can not set value at this path "'.$key.'" because ('.\gettype($array).')"'.\print_r($array, true).'" is not an array.'); |
|
6716 | 6716 | } |
6717 | 6717 | |
6718 | 6718 | $array[$key] = $value; |
@@ -6784,7 +6784,7 @@ discard block |
||
6784 | 6784 | && |
6785 | 6785 | \count(\array_diff_key($properties, $data)) > 0 |
6786 | 6786 | ) { |
6787 | - throw new \TypeError('Property mismatch - input: ' . \print_r(\array_keys($data), true) . ' | expected: ' . \print_r(\array_keys($properties), true)); |
|
6787 | + throw new \TypeError('Property mismatch - input: '.\print_r(\array_keys($data), true).' | expected: '.\print_r(\array_keys($properties), true)); |
|
6788 | 6788 | } |
6789 | 6789 | |
6790 | 6790 | foreach ($data as $key => &$valueInner) { |
@@ -6897,7 +6897,7 @@ discard block |
||
6897 | 6897 | * |
6898 | 6898 | * @return void |
6899 | 6899 | */ |
6900 | - static function (&$item) { |
|
6900 | + static function(&$item) { |
|
6901 | 6901 | if ($item instanceof self) { |
6902 | 6902 | $item = $item->getArray(); |
6903 | 6903 | } |
@@ -6922,7 +6922,7 @@ discard block |
||
6922 | 6922 | && |
6923 | 6923 | $this->checkPropertiesMismatch === true |
6924 | 6924 | ) { |
6925 | - throw new \TypeError('The key ' . $key . ' does not exists in "properties". Maybe because @property was not used for the class (' . \get_class($this) . ').'); |
|
6925 | + throw new \TypeError('The key '.$key.' does not exists in "properties". Maybe because @property was not used for the class ('.\get_class($this).').'); |
|
6926 | 6926 | } |
6927 | 6927 | |
6928 | 6928 | 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 | ); |