@@ -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 | * |
@@ -1525,11 +1525,11 @@ discard block |
||
1525 | 1525 | ), |
1526 | 1526 | \COUNT_NORMAL |
1527 | 1527 | ) |
1528 | - === |
|
1529 | - \count( |
|
1530 | - $needles, |
|
1531 | - \COUNT_NORMAL |
|
1532 | - ); |
|
1528 | + === |
|
1529 | + \count( |
|
1530 | + $needles, |
|
1531 | + \COUNT_NORMAL |
|
1532 | + ); |
|
1533 | 1533 | } |
1534 | 1534 | |
1535 | 1535 | /** |
@@ -3459,15 +3459,15 @@ discard block |
||
3459 | 3459 | |
3460 | 3460 | if ($recursive === true) { |
3461 | 3461 | return $this->array_keys_recursive($this->toArray()) |
3462 | - === |
|
3463 | - \range(0, \count($this->toArray(), \COUNT_RECURSIVE) - 1); |
|
3462 | + === |
|
3463 | + \range(0, \count($this->toArray(), \COUNT_RECURSIVE) - 1); |
|
3464 | 3464 | } |
3465 | 3465 | |
3466 | 3466 | // non recursive |
3467 | 3467 | |
3468 | 3468 | return \array_keys($this->toArray()) |
3469 | - === |
|
3470 | - \range(0, \count($this->toArray(), \COUNT_NORMAL) - 1); |
|
3469 | + === |
|
3470 | + \range(0, \count($this->toArray(), \COUNT_NORMAL) - 1); |
|
3471 | 3471 | } |
3472 | 3472 | |
3473 | 3473 | /** |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | */ |
308 | 308 | public function appendImmutable($value, $key = null): self |
309 | 309 | { |
310 | - $generator = function () use ($key, $value): \Generator { |
|
310 | + $generator = function() use ($key, $value): \Generator { |
|
311 | 311 | if ($this->properties !== []) { |
312 | 312 | $this->checkType($key, $value); |
313 | 313 | } |
@@ -688,7 +688,7 @@ discard block |
||
688 | 688 | */ |
689 | 689 | $this->callAtPath( |
690 | 690 | $containerPath, |
691 | - static function ($container) use ($lastOffset, &$offsetExists) { |
|
691 | + static function($container) use ($lastOffset, &$offsetExists) { |
|
692 | 692 | $offsetExists = \array_key_exists($lastOffset, $container); |
693 | 693 | } |
694 | 694 | ); |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | */ |
792 | 792 | $this->callAtPath( |
793 | 793 | \implode($this->pathSeparator, $path), |
794 | - static function (&$offset) use ($pathToUnset) { |
|
794 | + static function(&$offset) use ($pathToUnset) { |
|
795 | 795 | if (\is_array($offset)) { |
796 | 796 | unset($offset[$pathToUnset]); |
797 | 797 | } else { |
@@ -841,7 +841,7 @@ discard block |
||
841 | 841 | } |
842 | 842 | |
843 | 843 | if (\strpos($iteratorClass, '\\') === 0) { |
844 | - $iteratorClass = '\\' . $iteratorClass; |
|
844 | + $iteratorClass = '\\'.$iteratorClass; |
|
845 | 845 | if (\class_exists($iteratorClass)) { |
846 | 846 | /** |
847 | 847 | * @psalm-suppress PropertyTypeCoercion |
@@ -852,7 +852,7 @@ discard block |
||
852 | 852 | } |
853 | 853 | } |
854 | 854 | |
855 | - throw new \InvalidArgumentException('The iterator class does not exist: ' . $iteratorClass); |
|
855 | + throw new \InvalidArgumentException('The iterator class does not exist: '.$iteratorClass); |
|
856 | 856 | } |
857 | 857 | |
858 | 858 | /** |
@@ -1022,13 +1022,13 @@ discard block |
||
1022 | 1022 | |
1023 | 1023 | foreach ($this->getGenerator() as $key => $item) { |
1024 | 1024 | if ($item instanceof self) { |
1025 | - $result[$prefix . $key] = $item->appendToEachKey($prefix); |
|
1025 | + $result[$prefix.$key] = $item->appendToEachKey($prefix); |
|
1026 | 1026 | } elseif (\is_array($item) === true) { |
1027 | - $result[$prefix . $key] = self::create($item, $this->iteratorClass, false) |
|
1027 | + $result[$prefix.$key] = self::create($item, $this->iteratorClass, false) |
|
1028 | 1028 | ->appendToEachKey($prefix) |
1029 | 1029 | ->toArray(); |
1030 | 1030 | } else { |
1031 | - $result[$prefix . $key] = $item; |
|
1031 | + $result[$prefix.$key] = $item; |
|
1032 | 1032 | } |
1033 | 1033 | } |
1034 | 1034 | |
@@ -1059,7 +1059,7 @@ discard block |
||
1059 | 1059 | } elseif (\is_object($item) === true) { |
1060 | 1060 | $result[$key] = $item; |
1061 | 1061 | } else { |
1062 | - $result[$key] = $prefix . $item; |
|
1062 | + $result[$key] = $prefix.$item; |
|
1063 | 1063 | } |
1064 | 1064 | } |
1065 | 1065 | |
@@ -1267,7 +1267,7 @@ discard block |
||
1267 | 1267 | public function clean(): self |
1268 | 1268 | { |
1269 | 1269 | return $this->filter( |
1270 | - static function ($value) { |
|
1270 | + static function($value) { |
|
1271 | 1271 | return (bool) $value; |
1272 | 1272 | } |
1273 | 1273 | ); |
@@ -1598,9 +1598,9 @@ discard block |
||
1598 | 1598 | |
1599 | 1599 | foreach ($items as $key => $value) { |
1600 | 1600 | if (\is_array($value) && !empty($value)) { |
1601 | - $flatten[] = $this->flatten($delimiter, $prepend . $key . $delimiter, $value); |
|
1601 | + $flatten[] = $this->flatten($delimiter, $prepend.$key.$delimiter, $value); |
|
1602 | 1602 | } else { |
1603 | - $flatten[] = [$prepend . $key => $value]; |
|
1603 | + $flatten[] = [$prepend.$key => $value]; |
|
1604 | 1604 | } |
1605 | 1605 | } |
1606 | 1606 | |
@@ -1778,7 +1778,7 @@ discard block |
||
1778 | 1778 | */ |
1779 | 1779 | \array_walk( |
1780 | 1780 | $array, |
1781 | - static function (&$val) { |
|
1781 | + static function(&$val) { |
|
1782 | 1782 | if ((string) $val === $val) { |
1783 | 1783 | $val = \trim($val); |
1784 | 1784 | } |
@@ -2316,40 +2316,40 @@ discard block |
||
2316 | 2316 | } |
2317 | 2317 | |
2318 | 2318 | $ops = [ |
2319 | - 'eq' => static function ($item, $prop, $value): bool { |
|
2319 | + 'eq' => static function($item, $prop, $value): bool { |
|
2320 | 2320 | return $item[$prop] === $value; |
2321 | 2321 | }, |
2322 | - 'gt' => static function ($item, $prop, $value): bool { |
|
2322 | + 'gt' => static function($item, $prop, $value): bool { |
|
2323 | 2323 | return $item[$prop] > $value; |
2324 | 2324 | }, |
2325 | - 'ge' => static function ($item, $prop, $value): bool { |
|
2325 | + 'ge' => static function($item, $prop, $value): bool { |
|
2326 | 2326 | return $item[$prop] >= $value; |
2327 | 2327 | }, |
2328 | - 'gte' => static function ($item, $prop, $value): bool { |
|
2328 | + 'gte' => static function($item, $prop, $value): bool { |
|
2329 | 2329 | return $item[$prop] >= $value; |
2330 | 2330 | }, |
2331 | - 'lt' => static function ($item, $prop, $value): bool { |
|
2331 | + 'lt' => static function($item, $prop, $value): bool { |
|
2332 | 2332 | return $item[$prop] < $value; |
2333 | 2333 | }, |
2334 | - 'le' => static function ($item, $prop, $value): bool { |
|
2334 | + 'le' => static function($item, $prop, $value): bool { |
|
2335 | 2335 | return $item[$prop] <= $value; |
2336 | 2336 | }, |
2337 | - 'lte' => static function ($item, $prop, $value): bool { |
|
2337 | + 'lte' => static function($item, $prop, $value): bool { |
|
2338 | 2338 | return $item[$prop] <= $value; |
2339 | 2339 | }, |
2340 | - 'ne' => static function ($item, $prop, $value): bool { |
|
2340 | + 'ne' => static function($item, $prop, $value): bool { |
|
2341 | 2341 | return $item[$prop] !== $value; |
2342 | 2342 | }, |
2343 | - 'contains' => static function ($item, $prop, $value): bool { |
|
2343 | + 'contains' => static function($item, $prop, $value): bool { |
|
2344 | 2344 | return \in_array($item[$prop], (array) $value, true); |
2345 | 2345 | }, |
2346 | - 'notContains' => static function ($item, $prop, $value): bool { |
|
2346 | + 'notContains' => static function($item, $prop, $value): bool { |
|
2347 | 2347 | return !\in_array($item[$prop], (array) $value, true); |
2348 | 2348 | }, |
2349 | - 'newer' => static function ($item, $prop, $value): bool { |
|
2349 | + 'newer' => static function($item, $prop, $value): bool { |
|
2350 | 2350 | return \strtotime($item[$prop]) > \strtotime($value); |
2351 | 2351 | }, |
2352 | - 'older' => static function ($item, $prop, $value): bool { |
|
2352 | + 'older' => static function($item, $prop, $value): bool { |
|
2353 | 2353 | return \strtotime($item[$prop]) < \strtotime($value); |
2354 | 2354 | }, |
2355 | 2355 | ]; |
@@ -2357,7 +2357,7 @@ discard block |
||
2357 | 2357 | $result = \array_values( |
2358 | 2358 | \array_filter( |
2359 | 2359 | $this->toArray(false, true), |
2360 | - static function ($item) use ( |
|
2360 | + static function($item) use ( |
|
2361 | 2361 | $property, |
2362 | 2362 | $value, |
2363 | 2363 | $ops, |
@@ -2540,7 +2540,7 @@ discard block |
||
2540 | 2540 | */ |
2541 | 2541 | public function flip(): self |
2542 | 2542 | { |
2543 | - $generator = function (): \Generator { |
|
2543 | + $generator = function(): \Generator { |
|
2544 | 2544 | foreach ($this->getGenerator() as $key => $value) { |
2545 | 2545 | yield (string) $value => $key; |
2546 | 2546 | } |
@@ -2789,9 +2789,9 @@ discard block |
||
2789 | 2789 | $jsonObject = \json_decode($json, false); |
2790 | 2790 | |
2791 | 2791 | $mapper = new \Arrayy\Mapper\Json(); |
2792 | - $mapper->undefinedPropertyHandler = static function ($object, $key, $jsonValue) use ($class) { |
|
2792 | + $mapper->undefinedPropertyHandler = static function($object, $key, $jsonValue) use ($class) { |
|
2793 | 2793 | if ($class->checkPropertiesMismatchInConstructor) { |
2794 | - throw new \TypeError('Property mismatch - input: ' . \print_r(['key' => $key, 'jsonValue' => $jsonValue], true) . ' for object: ' . \get_class($object)); |
|
2794 | + throw new \TypeError('Property mismatch - input: '.\print_r(['key' => $key, 'jsonValue' => $jsonValue], true).' for object: '.\get_class($object)); |
|
2795 | 2795 | } |
2796 | 2796 | }; |
2797 | 2797 | |
@@ -3152,7 +3152,7 @@ discard block |
||
3152 | 3152 | */ |
3153 | 3153 | public function implode(string $glue = '', string $prefix = ''): string |
3154 | 3154 | { |
3155 | - return $prefix . $this->implode_recursive($glue, $this->toArray(), false); |
|
3155 | + return $prefix.$this->implode_recursive($glue, $this->toArray(), false); |
|
3156 | 3156 | } |
3157 | 3157 | |
3158 | 3158 | /** |
@@ -3253,7 +3253,7 @@ discard block |
||
3253 | 3253 | \array_uintersect( |
3254 | 3254 | $this->toArray(), |
3255 | 3255 | $search, |
3256 | - static function ($a, $b) { |
|
3256 | + static function($a, $b) { |
|
3257 | 3257 | return $a === $b ? 0 : -1; |
3258 | 3258 | } |
3259 | 3259 | ), |
@@ -3550,13 +3550,13 @@ discard block |
||
3550 | 3550 | // non recursive |
3551 | 3551 | |
3552 | 3552 | if ($search_values === null) { |
3553 | - $arrayFunction = function (): \Generator { |
|
3553 | + $arrayFunction = function(): \Generator { |
|
3554 | 3554 | foreach ($this->getGenerator() as $key => $value) { |
3555 | 3555 | yield $key; |
3556 | 3556 | } |
3557 | 3557 | }; |
3558 | 3558 | } else { |
3559 | - $arrayFunction = function () use ($search_values, $strict): \Generator { |
|
3559 | + $arrayFunction = function() use ($search_values, $strict): \Generator { |
|
3560 | 3560 | $is_array_tmp = \is_array($search_values); |
3561 | 3561 | |
3562 | 3562 | /** @noinspection PhpParameterByRefIsNotUsedAsReferenceInspection */ |
@@ -3801,7 +3801,7 @@ discard block |
||
3801 | 3801 | $useArguments = \func_num_args() > 2; |
3802 | 3802 | |
3803 | 3803 | return static::create( |
3804 | - function () use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
3804 | + function() use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
3805 | 3805 | foreach ($this->getGenerator() as $key => $value) { |
3806 | 3806 | if ($useArguments) { |
3807 | 3807 | if ($useKeyAsSecondParameter) { |
@@ -4223,7 +4223,7 @@ discard block |
||
4223 | 4223 | */ |
4224 | 4224 | public function nth(int $step, int $offset = 0): self |
4225 | 4225 | { |
4226 | - $arrayFunction = function () use ($step, $offset): \Generator { |
|
4226 | + $arrayFunction = function() use ($step, $offset): \Generator { |
|
4227 | 4227 | $position = 0; |
4228 | 4228 | foreach ($this->getGenerator() as $key => $value) { |
4229 | 4229 | if ($position++ % $step !== $offset) { |
@@ -4257,7 +4257,7 @@ discard block |
||
4257 | 4257 | { |
4258 | 4258 | $keys = \array_flip($keys); |
4259 | 4259 | |
4260 | - $generator = function () use ($keys): \Generator { |
|
4260 | + $generator = function() use ($keys): \Generator { |
|
4261 | 4261 | foreach ($this->getGenerator() as $key => $value) { |
4262 | 4262 | if (isset($keys[$key])) { |
4263 | 4263 | yield $key => $value; |
@@ -4387,7 +4387,7 @@ discard block |
||
4387 | 4387 | */ |
4388 | 4388 | public function prependImmutable($value, $key = null) |
4389 | 4389 | { |
4390 | - $generator = function () use ($key, $value): \Generator { |
|
4390 | + $generator = function() use ($key, $value): \Generator { |
|
4391 | 4391 | if ($this->properties !== []) { |
4392 | 4392 | $this->checkType($key, $value); |
4393 | 4393 | } |
@@ -4438,7 +4438,7 @@ discard block |
||
4438 | 4438 | )->prependToEachKey($suffix) |
4439 | 4439 | ->toArray(); |
4440 | 4440 | } else { |
4441 | - $result[$key . $suffix] = $item; |
|
4441 | + $result[$key.$suffix] = $item; |
|
4442 | 4442 | } |
4443 | 4443 | } |
4444 | 4444 | |
@@ -4478,7 +4478,7 @@ discard block |
||
4478 | 4478 | } elseif (\is_object($item) === true) { |
4479 | 4479 | $result[$key] = $item; |
4480 | 4480 | } else { |
4481 | - $result[$key] = $item . $suffix; |
|
4481 | + $result[$key] = $item.$suffix; |
|
4482 | 4482 | } |
4483 | 4483 | } |
4484 | 4484 | |
@@ -5170,7 +5170,7 @@ discard block |
||
5170 | 5170 | * @psalm-suppress MissingClosureParamType |
5171 | 5171 | */ |
5172 | 5172 | return $this->each( |
5173 | - static function ($value) use ($search, $replacement) { |
|
5173 | + static function($value) use ($search, $replacement) { |
|
5174 | 5174 | return \str_replace($search, $replacement, $value); |
5175 | 5175 | } |
5176 | 5176 | ); |
@@ -5797,7 +5797,7 @@ discard block |
||
5797 | 5797 | * @psalm-suppress MissingClosureParamType |
5798 | 5798 | */ |
5799 | 5799 | $results = $arrayy->each( |
5800 | - function ($value) use ($sorter) { |
|
5800 | + function($value) use ($sorter) { |
|
5801 | 5801 | if (\is_callable($sorter) === true) { |
5802 | 5802 | return $sorter($value); |
5803 | 5803 | } |
@@ -5895,7 +5895,7 @@ discard block |
||
5895 | 5895 | public function stripEmpty(): self |
5896 | 5896 | { |
5897 | 5897 | return $this->filter( |
5898 | - static function ($item) { |
|
5898 | + static function($item) { |
|
5899 | 5899 | if ($item === null) { |
5900 | 5900 | return false; |
5901 | 5901 | } |
@@ -6087,7 +6087,7 @@ discard block |
||
6087 | 6087 | * @psalm-suppress MissingClosureParamType |
6088 | 6088 | */ |
6089 | 6089 | $this->array = $this->reduce( |
6090 | - static function ($resultArray, $value) { |
|
6090 | + static function($resultArray, $value) { |
|
6091 | 6091 | if (!\in_array($value, $resultArray, true)) { |
6092 | 6092 | $resultArray[] = $value; |
6093 | 6093 | } |
@@ -6122,7 +6122,7 @@ discard block |
||
6122 | 6122 | */ |
6123 | 6123 | $this->array = \array_reduce( |
6124 | 6124 | \array_keys($array), |
6125 | - static function ($resultArray, $key) use ($array) { |
|
6125 | + static function($resultArray, $key) use ($array) { |
|
6126 | 6126 | if (!\in_array($array[$key], $resultArray, true)) { |
6127 | 6127 | $resultArray[$key] = $array[$key]; |
6128 | 6128 | } |
@@ -6202,7 +6202,7 @@ discard block |
||
6202 | 6202 | public function values(): self |
6203 | 6203 | { |
6204 | 6204 | return static::create( |
6205 | - function () { |
|
6205 | + function() { |
|
6206 | 6206 | /** @noinspection YieldFromCanBeUsedInspection */ |
6207 | 6207 | foreach ($this->getGenerator() as $value) { |
6208 | 6208 | yield $value; |
@@ -6268,7 +6268,7 @@ discard block |
||
6268 | 6268 | public function where(string $keyOrPropertyOrMethod, $value): self |
6269 | 6269 | { |
6270 | 6270 | return $this->filter( |
6271 | - function ($item) use ($keyOrPropertyOrMethod, $value) { |
|
6271 | + function($item) use ($keyOrPropertyOrMethod, $value) { |
|
6272 | 6272 | $accessorValue = $this->extractValue( |
6273 | 6273 | $item, |
6274 | 6274 | $keyOrPropertyOrMethod |
@@ -6558,7 +6558,7 @@ discard block |
||
6558 | 6558 | protected function getPropertiesFromPhpDoc() |
6559 | 6559 | { |
6560 | 6560 | static $PROPERTY_CACHE = []; |
6561 | - $cacheKey = 'Class::' . static::class; |
|
6561 | + $cacheKey = 'Class::'.static::class; |
|
6562 | 6562 | |
6563 | 6563 | if (isset($PROPERTY_CACHE[$cacheKey])) { |
6564 | 6564 | return $PROPERTY_CACHE[$cacheKey]; |
@@ -6841,7 +6841,7 @@ discard block |
||
6841 | 6841 | if ($array === null) { |
6842 | 6842 | $array = []; |
6843 | 6843 | } elseif (!\is_array($array)) { |
6844 | - throw new \RuntimeException('Can not set value at this path "' . $key . '" because (' . \gettype($array) . ')"' . \print_r($array, true) . '" is not an array.'); |
|
6844 | + throw new \RuntimeException('Can not set value at this path "'.$key.'" because ('.\gettype($array).')"'.\print_r($array, true).'" is not an array.'); |
|
6845 | 6845 | } |
6846 | 6846 | |
6847 | 6847 | $array[$key] = $value; |
@@ -6913,7 +6913,7 @@ discard block |
||
6913 | 6913 | && |
6914 | 6914 | \count(\array_diff_key($properties, $data)) > 0 |
6915 | 6915 | ) { |
6916 | - throw new \TypeError('Property mismatch - input: ' . \print_r(\array_keys($data), true) . ' | expected: ' . \print_r(\array_keys($properties), true)); |
|
6916 | + throw new \TypeError('Property mismatch - input: '.\print_r(\array_keys($data), true).' | expected: '.\print_r(\array_keys($properties), true)); |
|
6917 | 6917 | } |
6918 | 6918 | |
6919 | 6919 | foreach ($data as $key => &$valueInner) { |
@@ -7026,7 +7026,7 @@ discard block |
||
7026 | 7026 | * |
7027 | 7027 | * @return void |
7028 | 7028 | */ |
7029 | - static function (&$item) { |
|
7029 | + static function(&$item) { |
|
7030 | 7030 | if ($item instanceof self) { |
7031 | 7031 | $item = $item->getArray(); |
7032 | 7032 | } |
@@ -7051,7 +7051,7 @@ discard block |
||
7051 | 7051 | && |
7052 | 7052 | $this->checkPropertiesMismatch === true |
7053 | 7053 | ) { |
7054 | - throw new \TypeError('The key ' . $key . ' does not exists in "properties". Maybe because @property was not used for the class (' . \get_class($this) . ').'); |
|
7054 | + throw new \TypeError('The key '.$key.' does not exists in "properties". Maybe because @property was not used for the class ('.\get_class($this).').'); |
|
7055 | 7055 | } |
7056 | 7056 | |
7057 | 7057 | 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 | ); |