@@ -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 | * |
@@ -1542,11 +1542,11 @@ |
||
1542 | 1542 | ), |
1543 | 1543 | \COUNT_NORMAL |
1544 | 1544 | ) |
1545 | - === |
|
1546 | - \count( |
|
1547 | - $needles, |
|
1548 | - \COUNT_NORMAL |
|
1549 | - ); |
|
1545 | + === |
|
1546 | + \count( |
|
1547 | + $needles, |
|
1548 | + \COUNT_NORMAL |
|
1549 | + ); |
|
1550 | 1550 | } |
1551 | 1551 | |
1552 | 1552 | /** |
@@ -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 | } |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | */ |
705 | 705 | $this->callAtPath( |
706 | 706 | $containerPath, |
707 | - static function ($container) use ($lastOffset, &$offsetExists) { |
|
707 | + static function($container) use ($lastOffset, &$offsetExists) { |
|
708 | 708 | $offsetExists = \array_key_exists($lastOffset, $container); |
709 | 709 | } |
710 | 710 | ); |
@@ -807,7 +807,7 @@ discard block |
||
807 | 807 | */ |
808 | 808 | $this->callAtPath( |
809 | 809 | \implode($this->pathSeparator, $path), |
810 | - static function (&$offset) use ($pathToUnset) { |
|
810 | + static function(&$offset) use ($pathToUnset) { |
|
811 | 811 | if (\is_array($offset)) { |
812 | 812 | unset($offset[$pathToUnset]); |
813 | 813 | } else { |
@@ -861,7 +861,7 @@ discard block |
||
861 | 861 | } |
862 | 862 | |
863 | 863 | if (\strpos($iteratorClass, '\\') === 0) { |
864 | - $iteratorClass = '\\' . $iteratorClass; |
|
864 | + $iteratorClass = '\\'.$iteratorClass; |
|
865 | 865 | if (\class_exists($iteratorClass)) { |
866 | 866 | /** |
867 | 867 | * @psalm-suppress PropertyTypeCoercion |
@@ -872,7 +872,7 @@ discard block |
||
872 | 872 | } |
873 | 873 | } |
874 | 874 | |
875 | - throw new \InvalidArgumentException('The iterator class does not exist: ' . $iteratorClass); |
|
875 | + throw new \InvalidArgumentException('The iterator class does not exist: '.$iteratorClass); |
|
876 | 876 | } |
877 | 877 | |
878 | 878 | /** |
@@ -1047,13 +1047,13 @@ discard block |
||
1047 | 1047 | |
1048 | 1048 | foreach ($this->getGenerator() as $key => $item) { |
1049 | 1049 | if ($item instanceof self) { |
1050 | - $result[$prefix . $key] = $item->appendToEachKey($prefix); |
|
1050 | + $result[$prefix.$key] = $item->appendToEachKey($prefix); |
|
1051 | 1051 | } elseif (\is_array($item)) { |
1052 | - $result[$prefix . $key] = self::create($item, $this->iteratorClass, false) |
|
1052 | + $result[$prefix.$key] = self::create($item, $this->iteratorClass, false) |
|
1053 | 1053 | ->appendToEachKey($prefix) |
1054 | 1054 | ->toArray(); |
1055 | 1055 | } else { |
1056 | - $result[$prefix . $key] = $item; |
|
1056 | + $result[$prefix.$key] = $item; |
|
1057 | 1057 | } |
1058 | 1058 | } |
1059 | 1059 | |
@@ -1084,7 +1084,7 @@ discard block |
||
1084 | 1084 | } elseif (\is_object($item) === true) { |
1085 | 1085 | $result[$key] = $item; |
1086 | 1086 | } else { |
1087 | - $result[$key] = $prefix . $item; |
|
1087 | + $result[$key] = $prefix.$item; |
|
1088 | 1088 | } |
1089 | 1089 | } |
1090 | 1090 | |
@@ -1270,7 +1270,7 @@ discard block |
||
1270 | 1270 | public function chunk($size, $preserveKeys = false): self |
1271 | 1271 | { |
1272 | 1272 | if ($preserveKeys) { |
1273 | - $generator = function () use ($size) { |
|
1273 | + $generator = function() use ($size) { |
|
1274 | 1274 | $values = []; |
1275 | 1275 | $tmpCounter = 0; |
1276 | 1276 | foreach ($this->getGenerator() as $key => $value) { |
@@ -1290,7 +1290,7 @@ discard block |
||
1290 | 1290 | } |
1291 | 1291 | }; |
1292 | 1292 | } else { |
1293 | - $generator = function () use ($size) { |
|
1293 | + $generator = function() use ($size) { |
|
1294 | 1294 | $values = []; |
1295 | 1295 | $tmpCounter = 0; |
1296 | 1296 | foreach ($this->getGenerator() as $key => $value) { |
@@ -1334,7 +1334,7 @@ discard block |
||
1334 | 1334 | public function clean(): self |
1335 | 1335 | { |
1336 | 1336 | return $this->filter( |
1337 | - static function ($value) { |
|
1337 | + static function($value) { |
|
1338 | 1338 | return (bool) $value; |
1339 | 1339 | } |
1340 | 1340 | ); |
@@ -1676,9 +1676,9 @@ discard block |
||
1676 | 1676 | |
1677 | 1677 | foreach ($items as $key => $value) { |
1678 | 1678 | if (\is_array($value) && $value !== []) { |
1679 | - $flatten[] = $this->flatten($delimiter, $prepend . $key . $delimiter, $value); |
|
1679 | + $flatten[] = $this->flatten($delimiter, $prepend.$key.$delimiter, $value); |
|
1680 | 1680 | } else { |
1681 | - $flatten[] = [$prepend . $key => $value]; |
|
1681 | + $flatten[] = [$prepend.$key => $value]; |
|
1682 | 1682 | } |
1683 | 1683 | } |
1684 | 1684 | |
@@ -1856,7 +1856,7 @@ discard block |
||
1856 | 1856 | */ |
1857 | 1857 | \array_walk( |
1858 | 1858 | $array, |
1859 | - static function (&$val) { |
|
1859 | + static function(&$val) { |
|
1860 | 1860 | if ((string) $val === $val) { |
1861 | 1861 | $val = \trim($val); |
1862 | 1862 | } |
@@ -2388,7 +2388,7 @@ discard block |
||
2388 | 2388 | } |
2389 | 2389 | |
2390 | 2390 | if ($flag === \ARRAY_FILTER_USE_KEY) { |
2391 | - $generator = function () use ($closure) { |
|
2391 | + $generator = function() use ($closure) { |
|
2392 | 2392 | foreach ($this->getGenerator() as $key => $value) { |
2393 | 2393 | if ($closure($key) === true) { |
2394 | 2394 | yield $key => $value; |
@@ -2396,7 +2396,7 @@ discard block |
||
2396 | 2396 | } |
2397 | 2397 | }; |
2398 | 2398 | } elseif ($flag === \ARRAY_FILTER_USE_BOTH) { |
2399 | - $generator = function () use ($closure) { |
|
2399 | + $generator = function() use ($closure) { |
|
2400 | 2400 | foreach ($this->getGenerator() as $key => $value) { |
2401 | 2401 | if ($closure($value, $key) === true) { |
2402 | 2402 | yield $key => $value; |
@@ -2404,7 +2404,7 @@ discard block |
||
2404 | 2404 | } |
2405 | 2405 | }; |
2406 | 2406 | } else { |
2407 | - $generator = function () use ($closure) { |
|
2407 | + $generator = function() use ($closure) { |
|
2408 | 2408 | foreach ($this->getGenerator() as $key => $value) { |
2409 | 2409 | if ($closure($value) === true) { |
2410 | 2410 | yield $key => $value; |
@@ -2460,40 +2460,40 @@ discard block |
||
2460 | 2460 | } |
2461 | 2461 | |
2462 | 2462 | $ops = [ |
2463 | - 'eq' => static function ($item, $prop, $value): bool { |
|
2463 | + 'eq' => static function($item, $prop, $value): bool { |
|
2464 | 2464 | return $item[$prop] === $value; |
2465 | 2465 | }, |
2466 | - 'gt' => static function ($item, $prop, $value): bool { |
|
2466 | + 'gt' => static function($item, $prop, $value): bool { |
|
2467 | 2467 | return $item[$prop] > $value; |
2468 | 2468 | }, |
2469 | - 'ge' => static function ($item, $prop, $value): bool { |
|
2469 | + 'ge' => static function($item, $prop, $value): bool { |
|
2470 | 2470 | return $item[$prop] >= $value; |
2471 | 2471 | }, |
2472 | - 'gte' => static function ($item, $prop, $value): bool { |
|
2472 | + 'gte' => static function($item, $prop, $value): bool { |
|
2473 | 2473 | return $item[$prop] >= $value; |
2474 | 2474 | }, |
2475 | - 'lt' => static function ($item, $prop, $value): bool { |
|
2475 | + 'lt' => static function($item, $prop, $value): bool { |
|
2476 | 2476 | return $item[$prop] < $value; |
2477 | 2477 | }, |
2478 | - 'le' => static function ($item, $prop, $value): bool { |
|
2478 | + 'le' => static function($item, $prop, $value): bool { |
|
2479 | 2479 | return $item[$prop] <= $value; |
2480 | 2480 | }, |
2481 | - 'lte' => static function ($item, $prop, $value): bool { |
|
2481 | + 'lte' => static function($item, $prop, $value): bool { |
|
2482 | 2482 | return $item[$prop] <= $value; |
2483 | 2483 | }, |
2484 | - 'ne' => static function ($item, $prop, $value): bool { |
|
2484 | + 'ne' => static function($item, $prop, $value): bool { |
|
2485 | 2485 | return $item[$prop] !== $value; |
2486 | 2486 | }, |
2487 | - 'contains' => static function ($item, $prop, $value): bool { |
|
2487 | + 'contains' => static function($item, $prop, $value): bool { |
|
2488 | 2488 | return \in_array($item[$prop], (array) $value, true); |
2489 | 2489 | }, |
2490 | - 'notContains' => static function ($item, $prop, $value): bool { |
|
2490 | + 'notContains' => static function($item, $prop, $value): bool { |
|
2491 | 2491 | return !\in_array($item[$prop], (array) $value, true); |
2492 | 2492 | }, |
2493 | - 'newer' => static function ($item, $prop, $value): bool { |
|
2493 | + 'newer' => static function($item, $prop, $value): bool { |
|
2494 | 2494 | return \strtotime($item[$prop]) > \strtotime($value); |
2495 | 2495 | }, |
2496 | - 'older' => static function ($item, $prop, $value): bool { |
|
2496 | + 'older' => static function($item, $prop, $value): bool { |
|
2497 | 2497 | return \strtotime($item[$prop]) < \strtotime($value); |
2498 | 2498 | }, |
2499 | 2499 | ]; |
@@ -2501,7 +2501,7 @@ discard block |
||
2501 | 2501 | $result = \array_values( |
2502 | 2502 | \array_filter( |
2503 | 2503 | $this->toArray(false, true), |
2504 | - static function ($item) use ( |
|
2504 | + static function($item) use ( |
|
2505 | 2505 | $property, |
2506 | 2506 | $value, |
2507 | 2507 | $ops, |
@@ -2716,7 +2716,7 @@ discard block |
||
2716 | 2716 | */ |
2717 | 2717 | public function flip(): self |
2718 | 2718 | { |
2719 | - $generator = function (): \Generator { |
|
2719 | + $generator = function(): \Generator { |
|
2720 | 2720 | foreach ($this->getGenerator() as $key => $value) { |
2721 | 2721 | yield (string) $value => $key; |
2722 | 2722 | } |
@@ -2977,9 +2977,9 @@ discard block |
||
2977 | 2977 | $jsonObject = \json_decode($json, false); |
2978 | 2978 | |
2979 | 2979 | $mapper = new \Arrayy\Mapper\Json(); |
2980 | - $mapper->undefinedPropertyHandler = static function ($object, $key, $jsonValue) use ($class) { |
|
2980 | + $mapper->undefinedPropertyHandler = static function($object, $key, $jsonValue) use ($class) { |
|
2981 | 2981 | if ($class->checkPropertiesMismatchInConstructor) { |
2982 | - throw new \TypeError('Property mismatch - input: ' . \print_r(['key' => $key, 'jsonValue' => $jsonValue], true) . ' for object: ' . \get_class($object)); |
|
2982 | + throw new \TypeError('Property mismatch - input: '.\print_r(['key' => $key, 'jsonValue' => $jsonValue], true).' for object: '.\get_class($object)); |
|
2983 | 2983 | } |
2984 | 2984 | }; |
2985 | 2985 | |
@@ -3044,13 +3044,13 @@ discard block |
||
3044 | 3044 | public function getColumn($columnKey = null, $indexKey = null): self |
3045 | 3045 | { |
3046 | 3046 | if ($columnKey === null && $indexKey === null) { |
3047 | - $generator = function () { |
|
3047 | + $generator = function() { |
|
3048 | 3048 | foreach ($this->getGenerator() as $key => $value) { |
3049 | 3049 | yield $value; |
3050 | 3050 | } |
3051 | 3051 | }; |
3052 | 3052 | } else { |
3053 | - $generator = function () use ($columnKey, $indexKey) { |
|
3053 | + $generator = function() use ($columnKey, $indexKey) { |
|
3054 | 3054 | foreach ($this->getGenerator() as $key => $value) { |
3055 | 3055 | // reset |
3056 | 3056 | $newKey = null; |
@@ -3350,7 +3350,7 @@ discard block |
||
3350 | 3350 | |
3351 | 3351 | if ($UN_FOUND === null) { |
3352 | 3352 | // Generate unique string to use as marker. |
3353 | - $UN_FOUND = 'arrayy--' . \uniqid('arrayy', true); |
|
3353 | + $UN_FOUND = 'arrayy--'.\uniqid('arrayy', true); |
|
3354 | 3354 | } |
3355 | 3355 | |
3356 | 3356 | if (\is_array($key)) { |
@@ -3400,7 +3400,7 @@ discard block |
||
3400 | 3400 | */ |
3401 | 3401 | public function implode(string $glue = '', string $prefix = ''): string |
3402 | 3402 | { |
3403 | - return $prefix . $this->implode_recursive($glue, $this->toArray(), false); |
|
3403 | + return $prefix.$this->implode_recursive($glue, $this->toArray(), false); |
|
3404 | 3404 | } |
3405 | 3405 | |
3406 | 3406 | /** |
@@ -3509,7 +3509,7 @@ discard block |
||
3509 | 3509 | \array_uintersect( |
3510 | 3510 | $this->toArray(), |
3511 | 3511 | $search, |
3512 | - static function ($a, $b) { |
|
3512 | + static function($a, $b) { |
|
3513 | 3513 | return $a === $b ? 0 : -1; |
3514 | 3514 | } |
3515 | 3515 | ), |
@@ -3845,13 +3845,13 @@ discard block |
||
3845 | 3845 | // non recursive |
3846 | 3846 | |
3847 | 3847 | if ($search_values === null) { |
3848 | - $arrayFunction = function (): \Generator { |
|
3848 | + $arrayFunction = function(): \Generator { |
|
3849 | 3849 | foreach ($this->getGenerator() as $key => $value) { |
3850 | 3850 | yield $key; |
3851 | 3851 | } |
3852 | 3852 | }; |
3853 | 3853 | } else { |
3854 | - $arrayFunction = function () use ($search_values, $strict): \Generator { |
|
3854 | + $arrayFunction = function() use ($search_values, $strict): \Generator { |
|
3855 | 3855 | $is_array_tmp = \is_array($search_values); |
3856 | 3856 | |
3857 | 3857 | /** @noinspection PhpParameterByRefIsNotUsedAsReferenceInspection */ |
@@ -4095,7 +4095,7 @@ discard block |
||
4095 | 4095 | $useArguments = \func_num_args() > 2; |
4096 | 4096 | |
4097 | 4097 | return static::create( |
4098 | - function () use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
4098 | + function() use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
4099 | 4099 | foreach ($this->getGenerator() as $key => $value) { |
4100 | 4100 | if ($useArguments) { |
4101 | 4101 | if ($useKeyAsSecondParameter) { |
@@ -4582,7 +4582,7 @@ discard block |
||
4582 | 4582 | */ |
4583 | 4583 | public function nth(int $step, int $offset = 0): self |
4584 | 4584 | { |
4585 | - $arrayFunction = function () use ($step, $offset): \Generator { |
|
4585 | + $arrayFunction = function() use ($step, $offset): \Generator { |
|
4586 | 4586 | $position = 0; |
4587 | 4587 | foreach ($this->getGenerator() as $key => $value) { |
4588 | 4588 | if ($position++ % $step !== $offset) { |
@@ -4616,7 +4616,7 @@ discard block |
||
4616 | 4616 | { |
4617 | 4617 | $keys = \array_flip($keys); |
4618 | 4618 | |
4619 | - $generator = function () use ($keys): \Generator { |
|
4619 | + $generator = function() use ($keys): \Generator { |
|
4620 | 4620 | foreach ($this->getGenerator() as $key => $value) { |
4621 | 4621 | if (isset($keys[$key])) { |
4622 | 4622 | yield $key => $value; |
@@ -4746,7 +4746,7 @@ discard block |
||
4746 | 4746 | */ |
4747 | 4747 | public function prependImmutable($value, $key = null) |
4748 | 4748 | { |
4749 | - $generator = function () use ($key, $value): \Generator { |
|
4749 | + $generator = function() use ($key, $value): \Generator { |
|
4750 | 4750 | if ($this->properties !== []) { |
4751 | 4751 | $this->checkType($key, $value); |
4752 | 4752 | } |
@@ -4797,7 +4797,7 @@ discard block |
||
4797 | 4797 | )->prependToEachKey($suffix) |
4798 | 4798 | ->toArray(); |
4799 | 4799 | } else { |
4800 | - $result[$key . $suffix] = $item; |
|
4800 | + $result[$key.$suffix] = $item; |
|
4801 | 4801 | } |
4802 | 4802 | } |
4803 | 4803 | |
@@ -4837,7 +4837,7 @@ discard block |
||
4837 | 4837 | } elseif (\is_object($item) === true) { |
4838 | 4838 | $result[$key] = $item; |
4839 | 4839 | } else { |
4840 | - $result[$key] = $item . $suffix; |
|
4840 | + $result[$key] = $item.$suffix; |
|
4841 | 4841 | } |
4842 | 4842 | } |
4843 | 4843 | |
@@ -5623,7 +5623,7 @@ discard block |
||
5623 | 5623 | * @psalm-suppress MissingClosureParamType |
5624 | 5624 | */ |
5625 | 5625 | return $this->each( |
5626 | - static function ($value) use ($search, $replacement) { |
|
5626 | + static function($value) use ($search, $replacement) { |
|
5627 | 5627 | return \str_replace($search, $replacement, $value); |
5628 | 5628 | } |
5629 | 5629 | ); |
@@ -6307,7 +6307,7 @@ discard block |
||
6307 | 6307 | * @psalm-suppress MissingClosureParamType |
6308 | 6308 | */ |
6309 | 6309 | $results = $arrayy->each( |
6310 | - static function ($value) use ($sorter) { |
|
6310 | + static function($value) use ($sorter) { |
|
6311 | 6311 | if (\is_callable($sorter) === true) { |
6312 | 6312 | return $sorter($value); |
6313 | 6313 | } |
@@ -6380,7 +6380,7 @@ discard block |
||
6380 | 6380 | public function split(int $numberOfPieces = 2, bool $keepKeys = false): self |
6381 | 6381 | { |
6382 | 6382 | if ($keepKeys) { |
6383 | - $generator = function () use ($numberOfPieces) { |
|
6383 | + $generator = function() use ($numberOfPieces) { |
|
6384 | 6384 | $carry = []; |
6385 | 6385 | $i = 1; |
6386 | 6386 | foreach ($this->getGenerator() as $key => $value) { |
@@ -6403,7 +6403,7 @@ discard block |
||
6403 | 6403 | } |
6404 | 6404 | }; |
6405 | 6405 | } else { |
6406 | - $generator = function () use ($numberOfPieces) { |
|
6406 | + $generator = function() use ($numberOfPieces) { |
|
6407 | 6407 | $carry = []; |
6408 | 6408 | $i = 1; |
6409 | 6409 | foreach ($this->getGenerator() as $key => $value) { |
@@ -6450,7 +6450,7 @@ discard block |
||
6450 | 6450 | public function stripEmpty(): self |
6451 | 6451 | { |
6452 | 6452 | return $this->filter( |
6453 | - static function ($item) { |
|
6453 | + static function($item) { |
|
6454 | 6454 | if ($item === null) { |
6455 | 6455 | return false; |
6456 | 6456 | } |
@@ -6653,7 +6653,7 @@ discard block |
||
6653 | 6653 | * @psalm-suppress MissingClosureParamType |
6654 | 6654 | */ |
6655 | 6655 | $this->array = $this->reduce( |
6656 | - static function ($resultArray, $value) { |
|
6656 | + static function($resultArray, $value) { |
|
6657 | 6657 | if (!\in_array($value, $resultArray, true)) { |
6658 | 6658 | $resultArray[] = $value; |
6659 | 6659 | } |
@@ -6692,7 +6692,7 @@ discard block |
||
6692 | 6692 | */ |
6693 | 6693 | $this->array = \array_reduce( |
6694 | 6694 | \array_keys($array), |
6695 | - static function ($resultArray, $key) use ($array) { |
|
6695 | + static function($resultArray, $key) use ($array) { |
|
6696 | 6696 | if (!\in_array($array[$key], $resultArray, true)) { |
6697 | 6697 | $resultArray[$key] = $array[$key]; |
6698 | 6698 | } |
@@ -6777,7 +6777,7 @@ discard block |
||
6777 | 6777 | public function values(): self |
6778 | 6778 | { |
6779 | 6779 | return static::create( |
6780 | - function () { |
|
6780 | + function() { |
|
6781 | 6781 | /** @noinspection YieldFromCanBeUsedInspection */ |
6782 | 6782 | foreach ($this->getGenerator() as $value) { |
6783 | 6783 | yield $value; |
@@ -6853,7 +6853,7 @@ discard block |
||
6853 | 6853 | public function where(string $keyOrPropertyOrMethod, $value): self |
6854 | 6854 | { |
6855 | 6855 | return $this->filter( |
6856 | - function ($item) use ($keyOrPropertyOrMethod, $value) { |
|
6856 | + function($item) use ($keyOrPropertyOrMethod, $value) { |
|
6857 | 6857 | $accessorValue = $this->extractValue( |
6858 | 6858 | $item, |
6859 | 6859 | $keyOrPropertyOrMethod |
@@ -7143,7 +7143,7 @@ discard block |
||
7143 | 7143 | protected function getPropertiesFromPhpDoc() |
7144 | 7144 | { |
7145 | 7145 | static $PROPERTY_CACHE = []; |
7146 | - $cacheKey = 'Class::' . static::class; |
|
7146 | + $cacheKey = 'Class::'.static::class; |
|
7147 | 7147 | |
7148 | 7148 | if (isset($PROPERTY_CACHE[$cacheKey])) { |
7149 | 7149 | return $PROPERTY_CACHE[$cacheKey]; |
@@ -7449,7 +7449,7 @@ discard block |
||
7449 | 7449 | if ($array === null) { |
7450 | 7450 | $array = []; |
7451 | 7451 | } elseif (!\is_array($array)) { |
7452 | - throw new \RuntimeException('Can not set value at this path "' . $key . '" because (' . \gettype($array) . ')"' . \print_r($array, true) . '" is not an array.'); |
|
7452 | + throw new \RuntimeException('Can not set value at this path "'.$key.'" because ('.\gettype($array).')"'.\print_r($array, true).'" is not an array.'); |
|
7453 | 7453 | } |
7454 | 7454 | |
7455 | 7455 | $array[$key] = $value; |
@@ -7521,7 +7521,7 @@ discard block |
||
7521 | 7521 | && |
7522 | 7522 | \count(\array_diff_key($properties, $data)) > 0 |
7523 | 7523 | ) { |
7524 | - throw new \TypeError('Property mismatch - input: ' . \print_r(\array_keys($data), true) . ' | expected: ' . \print_r(\array_keys($properties), true)); |
|
7524 | + throw new \TypeError('Property mismatch - input: '.\print_r(\array_keys($data), true).' | expected: '.\print_r(\array_keys($properties), true)); |
|
7525 | 7525 | } |
7526 | 7526 | |
7527 | 7527 | foreach ($data as $key => &$valueInner) { |
@@ -7638,7 +7638,7 @@ discard block |
||
7638 | 7638 | * |
7639 | 7639 | * @return void |
7640 | 7640 | */ |
7641 | - static function (&$item) { |
|
7641 | + static function(&$item) { |
|
7642 | 7642 | if ($item instanceof self) { |
7643 | 7643 | $item = $item->getArray(); |
7644 | 7644 | } |
@@ -7663,7 +7663,7 @@ discard block |
||
7663 | 7663 | && |
7664 | 7664 | $this->checkPropertiesMismatch === true |
7665 | 7665 | ) { |
7666 | - throw new \TypeError('The key "' . $key . '" does not exists as "@property" phpdoc. (' . \get_class($this) . ').'); |
|
7666 | + throw new \TypeError('The key "'.$key.'" does not exists as "@property" phpdoc. ('.\get_class($this).').'); |
|
7667 | 7667 | } |
7668 | 7668 | |
7669 | 7669 | 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 | ); |