@@ -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, |
@@ -2487,9 +2487,9 @@ discard block |
||
2487 | 2487 | */ |
2488 | 2488 | public function flip(): self |
2489 | 2489 | { |
2490 | - $generator = function (): \Generator { |
|
2490 | + $generator = function(): \Generator { |
|
2491 | 2491 | foreach ($this->getGenerator() as $key => $value) { |
2492 | - yield (string)$value => $key; |
|
2492 | + yield (string) $value => $key; |
|
2493 | 2493 | } |
2494 | 2494 | }; |
2495 | 2495 | |
@@ -2736,9 +2736,9 @@ discard block |
||
2736 | 2736 | $jsonObject = \json_decode($json, false); |
2737 | 2737 | |
2738 | 2738 | $mapper = new \Arrayy\Mapper\Json(); |
2739 | - $mapper->undefinedPropertyHandler = static function ($object, $key, $jsonValue) use ($class) { |
|
2739 | + $mapper->undefinedPropertyHandler = static function($object, $key, $jsonValue) use ($class) { |
|
2740 | 2740 | if ($class->checkPropertiesMismatchInConstructor) { |
2741 | - throw new \TypeError('Property mismatch - input: ' . \print_r(['key' => $key, 'jsonValue' => $jsonValue], true) . ' for object: ' . \get_class($object)); |
|
2741 | + throw new \TypeError('Property mismatch - input: '.\print_r(['key' => $key, 'jsonValue' => $jsonValue], true).' for object: '.\get_class($object)); |
|
2742 | 2742 | } |
2743 | 2743 | }; |
2744 | 2744 | |
@@ -3099,7 +3099,7 @@ discard block |
||
3099 | 3099 | */ |
3100 | 3100 | public function implode(string $glue = '', string $prefix = ''): string |
3101 | 3101 | { |
3102 | - return $prefix . $this->implode_recursive($glue, $this->toArray(), false); |
|
3102 | + return $prefix.$this->implode_recursive($glue, $this->toArray(), false); |
|
3103 | 3103 | } |
3104 | 3104 | |
3105 | 3105 | /** |
@@ -3200,7 +3200,7 @@ discard block |
||
3200 | 3200 | \array_uintersect( |
3201 | 3201 | $this->toArray(), |
3202 | 3202 | $search, |
3203 | - static function ($a, $b) { |
|
3203 | + static function($a, $b) { |
|
3204 | 3204 | return $a === $b ? 0 : -1; |
3205 | 3205 | } |
3206 | 3206 | ), |
@@ -3497,13 +3497,13 @@ discard block |
||
3497 | 3497 | // non recursive |
3498 | 3498 | |
3499 | 3499 | if ($search_values === null) { |
3500 | - $arrayFunction = function (): \Generator { |
|
3500 | + $arrayFunction = function(): \Generator { |
|
3501 | 3501 | foreach ($this->getGenerator() as $key => $value) { |
3502 | 3502 | yield $key; |
3503 | 3503 | } |
3504 | 3504 | }; |
3505 | 3505 | } else { |
3506 | - $arrayFunction = function () use ($search_values, $strict): \Generator { |
|
3506 | + $arrayFunction = function() use ($search_values, $strict): \Generator { |
|
3507 | 3507 | $is_array_tmp = \is_array($search_values); |
3508 | 3508 | |
3509 | 3509 | /** @noinspection PhpParameterByRefIsNotUsedAsReferenceInspection */ |
@@ -3748,7 +3748,7 @@ discard block |
||
3748 | 3748 | $useArguments = \func_num_args() > 2; |
3749 | 3749 | |
3750 | 3750 | return static::create( |
3751 | - function () use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
3751 | + function() use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
3752 | 3752 | foreach ($this->getGenerator() as $key => $value) { |
3753 | 3753 | if ($useArguments) { |
3754 | 3754 | if ($useKeyAsSecondParameter) { |
@@ -4170,7 +4170,7 @@ discard block |
||
4170 | 4170 | */ |
4171 | 4171 | public function nth(int $step, int $offset = 0): self |
4172 | 4172 | { |
4173 | - $arrayFunction = function () use ($step, $offset): \Generator { |
|
4173 | + $arrayFunction = function() use ($step, $offset): \Generator { |
|
4174 | 4174 | $position = 0; |
4175 | 4175 | foreach ($this->getGenerator() as $key => $value) { |
4176 | 4176 | if ($position++ % $step !== $offset) { |
@@ -4204,7 +4204,7 @@ discard block |
||
4204 | 4204 | { |
4205 | 4205 | $keys = \array_flip($keys); |
4206 | 4206 | |
4207 | - $generator = function () use ($keys): \Generator { |
|
4207 | + $generator = function() use ($keys): \Generator { |
|
4208 | 4208 | foreach ($this->getGenerator() as $key => $value) { |
4209 | 4209 | if (isset($keys[$key])) { |
4210 | 4210 | yield $key => $value; |
@@ -4343,7 +4343,7 @@ discard block |
||
4343 | 4343 | )->prependToEachKey($suffix) |
4344 | 4344 | ->toArray(); |
4345 | 4345 | } else { |
4346 | - $result[$key . $suffix] = $item; |
|
4346 | + $result[$key.$suffix] = $item; |
|
4347 | 4347 | } |
4348 | 4348 | } |
4349 | 4349 | |
@@ -4383,7 +4383,7 @@ discard block |
||
4383 | 4383 | } elseif (\is_object($item) === true) { |
4384 | 4384 | $result[$key] = $item; |
4385 | 4385 | } else { |
4386 | - $result[$key] = $item . $suffix; |
|
4386 | + $result[$key] = $item.$suffix; |
|
4387 | 4387 | } |
4388 | 4388 | } |
4389 | 4389 | |
@@ -5075,7 +5075,7 @@ discard block |
||
5075 | 5075 | * @psalm-suppress MissingClosureParamType |
5076 | 5076 | */ |
5077 | 5077 | return $this->each( |
5078 | - static function ($value) use ($search, $replacement) { |
|
5078 | + static function($value) use ($search, $replacement) { |
|
5079 | 5079 | return \str_replace($search, $replacement, $value); |
5080 | 5080 | } |
5081 | 5081 | ); |
@@ -5702,7 +5702,7 @@ discard block |
||
5702 | 5702 | * @psalm-suppress MissingClosureParamType |
5703 | 5703 | */ |
5704 | 5704 | $results = $arrayy->each( |
5705 | - function ($value) use ($sorter) { |
|
5705 | + function($value) use ($sorter) { |
|
5706 | 5706 | if (\is_callable($sorter) === true) { |
5707 | 5707 | return $sorter($value); |
5708 | 5708 | } |
@@ -5800,7 +5800,7 @@ discard block |
||
5800 | 5800 | public function stripEmpty(): self |
5801 | 5801 | { |
5802 | 5802 | return $this->filter( |
5803 | - static function ($item) { |
|
5803 | + static function($item) { |
|
5804 | 5804 | if ($item === null) { |
5805 | 5805 | return false; |
5806 | 5806 | } |
@@ -5989,7 +5989,7 @@ discard block |
||
5989 | 5989 | * @psalm-suppress MissingClosureParamType |
5990 | 5990 | */ |
5991 | 5991 | $this->array = $this->reduce( |
5992 | - static function ($resultArray, $value) { |
|
5992 | + static function($resultArray, $value) { |
|
5993 | 5993 | if (!\in_array($value, $resultArray, true)) { |
5994 | 5994 | $resultArray[] = $value; |
5995 | 5995 | } |
@@ -6024,7 +6024,7 @@ discard block |
||
6024 | 6024 | */ |
6025 | 6025 | $this->array = \array_reduce( |
6026 | 6026 | \array_keys($array), |
6027 | - static function ($resultArray, $key) use ($array) { |
|
6027 | + static function($resultArray, $key) use ($array) { |
|
6028 | 6028 | if (!\in_array($array[$key], $resultArray, true)) { |
6029 | 6029 | $resultArray[$key] = $array[$key]; |
6030 | 6030 | } |
@@ -6104,7 +6104,7 @@ discard block |
||
6104 | 6104 | public function values(): self |
6105 | 6105 | { |
6106 | 6106 | return static::create( |
6107 | - function () { |
|
6107 | + function() { |
|
6108 | 6108 | /** @noinspection YieldFromCanBeUsedInspection */ |
6109 | 6109 | foreach ($this->getGenerator() as $value) { |
6110 | 6110 | yield $value; |
@@ -6170,7 +6170,7 @@ discard block |
||
6170 | 6170 | public function where(string $keyOrPropertyOrMethod, $value): self |
6171 | 6171 | { |
6172 | 6172 | return $this->filter( |
6173 | - function ($item) use ($keyOrPropertyOrMethod, $value) { |
|
6173 | + function($item) use ($keyOrPropertyOrMethod, $value) { |
|
6174 | 6174 | $accessorValue = $this->extractValue( |
6175 | 6175 | $item, |
6176 | 6176 | $keyOrPropertyOrMethod |
@@ -6460,7 +6460,7 @@ discard block |
||
6460 | 6460 | protected function getPropertiesFromPhpDoc() |
6461 | 6461 | { |
6462 | 6462 | static $PROPERTY_CACHE = []; |
6463 | - $cacheKey = 'Class::' . static::class; |
|
6463 | + $cacheKey = 'Class::'.static::class; |
|
6464 | 6464 | |
6465 | 6465 | if (isset($PROPERTY_CACHE[$cacheKey])) { |
6466 | 6466 | return $PROPERTY_CACHE[$cacheKey]; |
@@ -6743,7 +6743,7 @@ discard block |
||
6743 | 6743 | if ($array === null) { |
6744 | 6744 | $array = []; |
6745 | 6745 | } elseif (!\is_array($array)) { |
6746 | - throw new \RuntimeException('Can not set value at this path "' . $key . '" because (' . \gettype($array) . ')"' . \print_r($array, true) . '" is not an array.'); |
|
6746 | + throw new \RuntimeException('Can not set value at this path "'.$key.'" because ('.\gettype($array).')"'.\print_r($array, true).'" is not an array.'); |
|
6747 | 6747 | } |
6748 | 6748 | |
6749 | 6749 | $array[$key] = $value; |
@@ -6815,7 +6815,7 @@ discard block |
||
6815 | 6815 | && |
6816 | 6816 | \count(\array_diff_key($properties, $data)) > 0 |
6817 | 6817 | ) { |
6818 | - throw new \TypeError('Property mismatch - input: ' . \print_r(\array_keys($data), true) . ' | expected: ' . \print_r(\array_keys($properties), true)); |
|
6818 | + throw new \TypeError('Property mismatch - input: '.\print_r(\array_keys($data), true).' | expected: '.\print_r(\array_keys($properties), true)); |
|
6819 | 6819 | } |
6820 | 6820 | |
6821 | 6821 | foreach ($data as $key => &$valueInner) { |
@@ -6928,7 +6928,7 @@ discard block |
||
6928 | 6928 | * |
6929 | 6929 | * @return void |
6930 | 6930 | */ |
6931 | - static function (&$item) { |
|
6931 | + static function(&$item) { |
|
6932 | 6932 | if ($item instanceof self) { |
6933 | 6933 | $item = $item->getArray(); |
6934 | 6934 | } |
@@ -6953,7 +6953,7 @@ discard block |
||
6953 | 6953 | && |
6954 | 6954 | $this->checkPropertiesMismatch === true |
6955 | 6955 | ) { |
6956 | - throw new \TypeError('The key ' . $key . ' does not exists in "properties". Maybe because @property was not used for the class (' . \get_class($this) . ').'); |
|
6956 | + throw new \TypeError('The key '.$key.' does not exists in "properties". Maybe because @property was not used for the class ('.\get_class($this).').'); |
|
6957 | 6957 | } |
6958 | 6958 | |
6959 | 6959 | 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 | ); |