@@ -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 | } |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | if ($this->generator instanceof ArrayyRewindableGenerator) { |
492 | 492 | $generator = clone $this->generator; |
493 | 493 | $this->generator = new ArrayyRewindableExtendedGenerator( |
494 | - static function () use ($generator): \Generator { |
|
494 | + static function() use ($generator): \Generator { |
|
495 | 495 | yield from $generator; |
496 | 496 | }, |
497 | 497 | null, |
@@ -699,7 +699,7 @@ discard block |
||
699 | 699 | */ |
700 | 700 | $this->callAtPath( |
701 | 701 | $containerPath, |
702 | - static function ($container) use ($lastOffset, &$offsetExists) { |
|
702 | + static function($container) use ($lastOffset, &$offsetExists) { |
|
703 | 703 | $offsetExists = \array_key_exists($lastOffset, $container); |
704 | 704 | } |
705 | 705 | ); |
@@ -802,7 +802,7 @@ discard block |
||
802 | 802 | */ |
803 | 803 | $this->callAtPath( |
804 | 804 | \implode($this->pathSeparator, $path), |
805 | - static function (&$offset) use ($pathToUnset) { |
|
805 | + static function(&$offset) use ($pathToUnset) { |
|
806 | 806 | if (\is_array($offset)) { |
807 | 807 | unset($offset[$pathToUnset]); |
808 | 808 | } else { |
@@ -856,7 +856,7 @@ discard block |
||
856 | 856 | } |
857 | 857 | |
858 | 858 | if (\strpos($iteratorClass, '\\') === 0) { |
859 | - $iteratorClass = '\\' . $iteratorClass; |
|
859 | + $iteratorClass = '\\'.$iteratorClass; |
|
860 | 860 | if (\class_exists($iteratorClass)) { |
861 | 861 | /** |
862 | 862 | * @psalm-suppress PropertyTypeCoercion |
@@ -867,7 +867,7 @@ discard block |
||
867 | 867 | } |
868 | 868 | } |
869 | 869 | |
870 | - throw new \InvalidArgumentException('The iterator class does not exist: ' . $iteratorClass); |
|
870 | + throw new \InvalidArgumentException('The iterator class does not exist: '.$iteratorClass); |
|
871 | 871 | } |
872 | 872 | |
873 | 873 | /** |
@@ -1042,13 +1042,13 @@ discard block |
||
1042 | 1042 | |
1043 | 1043 | foreach ($this->getGenerator() as $key => $item) { |
1044 | 1044 | if ($item instanceof self) { |
1045 | - $result[$prefix . $key] = $item->appendToEachKey($prefix); |
|
1045 | + $result[$prefix.$key] = $item->appendToEachKey($prefix); |
|
1046 | 1046 | } elseif (\is_array($item)) { |
1047 | - $result[$prefix . $key] = self::create($item, $this->iteratorClass, false) |
|
1047 | + $result[$prefix.$key] = self::create($item, $this->iteratorClass, false) |
|
1048 | 1048 | ->appendToEachKey($prefix) |
1049 | 1049 | ->toArray(); |
1050 | 1050 | } else { |
1051 | - $result[$prefix . $key] = $item; |
|
1051 | + $result[$prefix.$key] = $item; |
|
1052 | 1052 | } |
1053 | 1053 | } |
1054 | 1054 | |
@@ -1079,7 +1079,7 @@ discard block |
||
1079 | 1079 | } elseif (\is_object($item) === true) { |
1080 | 1080 | $result[$key] = $item; |
1081 | 1081 | } else { |
1082 | - $result[$key] = $prefix . $item; |
|
1082 | + $result[$key] = $prefix.$item; |
|
1083 | 1083 | } |
1084 | 1084 | } |
1085 | 1085 | |
@@ -1265,7 +1265,7 @@ discard block |
||
1265 | 1265 | public function chunk($size, $preserveKeys = false): self |
1266 | 1266 | { |
1267 | 1267 | if ($preserveKeys) { |
1268 | - $generator = function () use ($size) { |
|
1268 | + $generator = function() use ($size) { |
|
1269 | 1269 | $values = []; |
1270 | 1270 | $tmpCounter = 0; |
1271 | 1271 | foreach ($this->getGenerator() as $key => $value) { |
@@ -1285,7 +1285,7 @@ discard block |
||
1285 | 1285 | } |
1286 | 1286 | }; |
1287 | 1287 | } else { |
1288 | - $generator = function () use ($size) { |
|
1288 | + $generator = function() use ($size) { |
|
1289 | 1289 | $values = []; |
1290 | 1290 | $tmpCounter = 0; |
1291 | 1291 | foreach ($this->getGenerator() as $key => $value) { |
@@ -1329,7 +1329,7 @@ discard block |
||
1329 | 1329 | public function clean(): self |
1330 | 1330 | { |
1331 | 1331 | return $this->filter( |
1332 | - static function ($value) { |
|
1332 | + static function($value) { |
|
1333 | 1333 | return (bool) $value; |
1334 | 1334 | } |
1335 | 1335 | ); |
@@ -1667,9 +1667,9 @@ discard block |
||
1667 | 1667 | |
1668 | 1668 | foreach ($items as $key => $value) { |
1669 | 1669 | if (\is_array($value) && $value !== []) { |
1670 | - $flatten[] = $this->flatten($delimiter, $prepend . $key . $delimiter, $value); |
|
1670 | + $flatten[] = $this->flatten($delimiter, $prepend.$key.$delimiter, $value); |
|
1671 | 1671 | } else { |
1672 | - $flatten[] = [$prepend . $key => $value]; |
|
1672 | + $flatten[] = [$prepend.$key => $value]; |
|
1673 | 1673 | } |
1674 | 1674 | } |
1675 | 1675 | |
@@ -1848,7 +1848,7 @@ discard block |
||
1848 | 1848 | */ |
1849 | 1849 | \array_walk( |
1850 | 1850 | $array, |
1851 | - static function (&$val) { |
|
1851 | + static function(&$val) { |
|
1852 | 1852 | if ((string) $val === $val) { |
1853 | 1853 | $val = \trim($val); |
1854 | 1854 | } |
@@ -2070,7 +2070,7 @@ discard block |
||
2070 | 2070 | $array = $array[0]; |
2071 | 2071 | } |
2072 | 2072 | |
2073 | - $generator = function () use ($array): \Generator { |
|
2073 | + $generator = function() use ($array): \Generator { |
|
2074 | 2074 | foreach ($this->getGenerator() as $key => $value) { |
2075 | 2075 | if (\in_array($value, $array, true) === false) { |
2076 | 2076 | yield $key => $value; |
@@ -2105,7 +2105,7 @@ discard block |
||
2105 | 2105 | $array = $array[0]; |
2106 | 2106 | } |
2107 | 2107 | |
2108 | - $generator = function () use ($array): \Generator { |
|
2108 | + $generator = function() use ($array): \Generator { |
|
2109 | 2109 | foreach ($this->getGenerator() as $key => $value) { |
2110 | 2110 | if (\array_key_exists($key, $array) === false) { |
2111 | 2111 | yield $key => $value; |
@@ -2408,7 +2408,7 @@ discard block |
||
2408 | 2408 | } |
2409 | 2409 | |
2410 | 2410 | if ($flag === \ARRAY_FILTER_USE_KEY) { |
2411 | - $generator = function () use ($closure) { |
|
2411 | + $generator = function() use ($closure) { |
|
2412 | 2412 | foreach ($this->getGenerator() as $key => $value) { |
2413 | 2413 | if ($closure($key) === true) { |
2414 | 2414 | yield $key => $value; |
@@ -2416,7 +2416,7 @@ discard block |
||
2416 | 2416 | } |
2417 | 2417 | }; |
2418 | 2418 | } elseif ($flag === \ARRAY_FILTER_USE_BOTH) { |
2419 | - $generator = function () use ($closure) { |
|
2419 | + $generator = function() use ($closure) { |
|
2420 | 2420 | foreach ($this->getGenerator() as $key => $value) { |
2421 | 2421 | if ($closure($value, $key) === true) { |
2422 | 2422 | yield $key => $value; |
@@ -2424,7 +2424,7 @@ discard block |
||
2424 | 2424 | } |
2425 | 2425 | }; |
2426 | 2426 | } else { |
2427 | - $generator = function () use ($closure) { |
|
2427 | + $generator = function() use ($closure) { |
|
2428 | 2428 | foreach ($this->getGenerator() as $key => $value) { |
2429 | 2429 | if ($closure($value) === true) { |
2430 | 2430 | yield $key => $value; |
@@ -2480,40 +2480,40 @@ discard block |
||
2480 | 2480 | } |
2481 | 2481 | |
2482 | 2482 | $ops = [ |
2483 | - 'eq' => static function ($item, $prop, $value): bool { |
|
2483 | + 'eq' => static function($item, $prop, $value): bool { |
|
2484 | 2484 | return $item[$prop] === $value; |
2485 | 2485 | }, |
2486 | - 'gt' => static function ($item, $prop, $value): bool { |
|
2486 | + 'gt' => static function($item, $prop, $value): bool { |
|
2487 | 2487 | return $item[$prop] > $value; |
2488 | 2488 | }, |
2489 | - 'ge' => static function ($item, $prop, $value): bool { |
|
2489 | + 'ge' => static function($item, $prop, $value): bool { |
|
2490 | 2490 | return $item[$prop] >= $value; |
2491 | 2491 | }, |
2492 | - 'gte' => static function ($item, $prop, $value): bool { |
|
2492 | + 'gte' => static function($item, $prop, $value): bool { |
|
2493 | 2493 | return $item[$prop] >= $value; |
2494 | 2494 | }, |
2495 | - 'lt' => static function ($item, $prop, $value): bool { |
|
2495 | + 'lt' => static function($item, $prop, $value): bool { |
|
2496 | 2496 | return $item[$prop] < $value; |
2497 | 2497 | }, |
2498 | - 'le' => static function ($item, $prop, $value): bool { |
|
2498 | + 'le' => static function($item, $prop, $value): bool { |
|
2499 | 2499 | return $item[$prop] <= $value; |
2500 | 2500 | }, |
2501 | - 'lte' => static function ($item, $prop, $value): bool { |
|
2501 | + 'lte' => static function($item, $prop, $value): bool { |
|
2502 | 2502 | return $item[$prop] <= $value; |
2503 | 2503 | }, |
2504 | - 'ne' => static function ($item, $prop, $value): bool { |
|
2504 | + 'ne' => static function($item, $prop, $value): bool { |
|
2505 | 2505 | return $item[$prop] !== $value; |
2506 | 2506 | }, |
2507 | - 'contains' => static function ($item, $prop, $value): bool { |
|
2507 | + 'contains' => static function($item, $prop, $value): bool { |
|
2508 | 2508 | return \in_array($item[$prop], (array) $value, true); |
2509 | 2509 | }, |
2510 | - 'notContains' => static function ($item, $prop, $value): bool { |
|
2510 | + 'notContains' => static function($item, $prop, $value): bool { |
|
2511 | 2511 | return !\in_array($item[$prop], (array) $value, true); |
2512 | 2512 | }, |
2513 | - 'newer' => static function ($item, $prop, $value): bool { |
|
2513 | + 'newer' => static function($item, $prop, $value): bool { |
|
2514 | 2514 | return \strtotime($item[$prop]) > \strtotime($value); |
2515 | 2515 | }, |
2516 | - 'older' => static function ($item, $prop, $value): bool { |
|
2516 | + 'older' => static function($item, $prop, $value): bool { |
|
2517 | 2517 | return \strtotime($item[$prop]) < \strtotime($value); |
2518 | 2518 | }, |
2519 | 2519 | ]; |
@@ -2521,7 +2521,7 @@ discard block |
||
2521 | 2521 | $result = \array_values( |
2522 | 2522 | \array_filter( |
2523 | 2523 | $this->toArray(false, true), |
2524 | - static function ($item) use ( |
|
2524 | + static function($item) use ( |
|
2525 | 2525 | $property, |
2526 | 2526 | $value, |
2527 | 2527 | $ops, |
@@ -2736,7 +2736,7 @@ discard block |
||
2736 | 2736 | */ |
2737 | 2737 | public function flip(): self |
2738 | 2738 | { |
2739 | - $generator = function (): \Generator { |
|
2739 | + $generator = function(): \Generator { |
|
2740 | 2740 | foreach ($this->getGenerator() as $key => $value) { |
2741 | 2741 | yield (string) $value => $key; |
2742 | 2742 | } |
@@ -3005,9 +3005,9 @@ discard block |
||
3005 | 3005 | $jsonObject = \json_decode($json, false); |
3006 | 3006 | |
3007 | 3007 | $mapper = new \Arrayy\Mapper\Json(); |
3008 | - $mapper->undefinedPropertyHandler = static function ($object, $key, $jsonValue) use ($class) { |
|
3008 | + $mapper->undefinedPropertyHandler = static function($object, $key, $jsonValue) use ($class) { |
|
3009 | 3009 | if ($class->checkPropertiesMismatchInConstructor) { |
3010 | - throw new \TypeError('Property mismatch - input: ' . \print_r(['key' => $key, 'jsonValue' => $jsonValue], true) . ' for object: ' . \get_class($object)); |
|
3010 | + throw new \TypeError('Property mismatch - input: '.\print_r(['key' => $key, 'jsonValue' => $jsonValue], true).' for object: '.\get_class($object)); |
|
3011 | 3011 | } |
3012 | 3012 | }; |
3013 | 3013 | |
@@ -3072,13 +3072,13 @@ discard block |
||
3072 | 3072 | public function getColumn($columnKey = null, $indexKey = null): self |
3073 | 3073 | { |
3074 | 3074 | if ($columnKey === null && $indexKey === null) { |
3075 | - $generator = function () { |
|
3075 | + $generator = function() { |
|
3076 | 3076 | foreach ($this->getGenerator() as $key => $value) { |
3077 | 3077 | yield $value; |
3078 | 3078 | } |
3079 | 3079 | }; |
3080 | 3080 | } else { |
3081 | - $generator = function () use ($columnKey, $indexKey) { |
|
3081 | + $generator = function() use ($columnKey, $indexKey) { |
|
3082 | 3082 | foreach ($this->getGenerator() as $key => $value) { |
3083 | 3083 | // reset |
3084 | 3084 | $newKey = null; |
@@ -3378,7 +3378,7 @@ discard block |
||
3378 | 3378 | |
3379 | 3379 | if ($UN_FOUND === null) { |
3380 | 3380 | // Generate unique string to use as marker. |
3381 | - $UN_FOUND = 'arrayy--' . \uniqid('arrayy', true); |
|
3381 | + $UN_FOUND = 'arrayy--'.\uniqid('arrayy', true); |
|
3382 | 3382 | } |
3383 | 3383 | |
3384 | 3384 | if (\is_array($key)) { |
@@ -3428,7 +3428,7 @@ discard block |
||
3428 | 3428 | */ |
3429 | 3429 | public function implode(string $glue = '', string $prefix = ''): string |
3430 | 3430 | { |
3431 | - return $prefix . $this->implode_recursive($glue, $this->toArray(), false); |
|
3431 | + return $prefix.$this->implode_recursive($glue, $this->toArray(), false); |
|
3432 | 3432 | } |
3433 | 3433 | |
3434 | 3434 | /** |
@@ -3537,7 +3537,7 @@ discard block |
||
3537 | 3537 | \array_uintersect( |
3538 | 3538 | $this->toArray(), |
3539 | 3539 | $search, |
3540 | - static function ($a, $b) { |
|
3540 | + static function($a, $b) { |
|
3541 | 3541 | return $a === $b ? 0 : -1; |
3542 | 3542 | } |
3543 | 3543 | ), |
@@ -3881,13 +3881,13 @@ discard block |
||
3881 | 3881 | // non recursive |
3882 | 3882 | |
3883 | 3883 | if ($search_values === null) { |
3884 | - $arrayFunction = function (): \Generator { |
|
3884 | + $arrayFunction = function(): \Generator { |
|
3885 | 3885 | foreach ($this->getGenerator() as $key => $value) { |
3886 | 3886 | yield $key; |
3887 | 3887 | } |
3888 | 3888 | }; |
3889 | 3889 | } else { |
3890 | - $arrayFunction = function () use ($search_values, $strict): \Generator { |
|
3890 | + $arrayFunction = function() use ($search_values, $strict): \Generator { |
|
3891 | 3891 | $is_array_tmp = \is_array($search_values); |
3892 | 3892 | |
3893 | 3893 | /** @noinspection PhpParameterByRefIsNotUsedAsReferenceInspection */ |
@@ -4131,7 +4131,7 @@ discard block |
||
4131 | 4131 | $useArguments = \func_num_args() > 2; |
4132 | 4132 | |
4133 | 4133 | return static::create( |
4134 | - function () use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
4134 | + function() use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
4135 | 4135 | foreach ($this->getGenerator() as $key => $value) { |
4136 | 4136 | if ($useArguments) { |
4137 | 4137 | if ($useKeyAsSecondParameter) { |
@@ -4618,7 +4618,7 @@ discard block |
||
4618 | 4618 | */ |
4619 | 4619 | public function nth(int $step, int $offset = 0): self |
4620 | 4620 | { |
4621 | - $arrayFunction = function () use ($step, $offset): \Generator { |
|
4621 | + $arrayFunction = function() use ($step, $offset): \Generator { |
|
4622 | 4622 | $position = 0; |
4623 | 4623 | foreach ($this->getGenerator() as $key => $value) { |
4624 | 4624 | if ($position++ % $step !== $offset) { |
@@ -4652,7 +4652,7 @@ discard block |
||
4652 | 4652 | { |
4653 | 4653 | $keys = \array_flip($keys); |
4654 | 4654 | |
4655 | - $generator = function () use ($keys): \Generator { |
|
4655 | + $generator = function() use ($keys): \Generator { |
|
4656 | 4656 | foreach ($this->getGenerator() as $key => $value) { |
4657 | 4657 | if (isset($keys[$key])) { |
4658 | 4658 | yield $key => $value; |
@@ -4782,7 +4782,7 @@ discard block |
||
4782 | 4782 | */ |
4783 | 4783 | public function prependImmutable($value, $key = null) |
4784 | 4784 | { |
4785 | - $generator = function () use ($key, $value): \Generator { |
|
4785 | + $generator = function() use ($key, $value): \Generator { |
|
4786 | 4786 | if ($this->properties !== []) { |
4787 | 4787 | $this->checkType($key, $value); |
4788 | 4788 | } |
@@ -4833,7 +4833,7 @@ discard block |
||
4833 | 4833 | )->prependToEachKey($suffix) |
4834 | 4834 | ->toArray(); |
4835 | 4835 | } else { |
4836 | - $result[$key . $suffix] = $item; |
|
4836 | + $result[$key.$suffix] = $item; |
|
4837 | 4837 | } |
4838 | 4838 | } |
4839 | 4839 | |
@@ -4873,7 +4873,7 @@ discard block |
||
4873 | 4873 | } elseif (\is_object($item) === true) { |
4874 | 4874 | $result[$key] = $item; |
4875 | 4875 | } else { |
4876 | - $result[$key] = $item . $suffix; |
|
4876 | + $result[$key] = $item.$suffix; |
|
4877 | 4877 | } |
4878 | 4878 | } |
4879 | 4879 | |
@@ -5659,7 +5659,7 @@ discard block |
||
5659 | 5659 | * @psalm-suppress MissingClosureParamType |
5660 | 5660 | */ |
5661 | 5661 | return $this->each( |
5662 | - static function ($value) use ($search, $replacement) { |
|
5662 | + static function($value) use ($search, $replacement) { |
|
5663 | 5663 | return \str_replace($search, $replacement, $value); |
5664 | 5664 | } |
5665 | 5665 | ); |
@@ -6343,7 +6343,7 @@ discard block |
||
6343 | 6343 | * @psalm-suppress MissingClosureParamType |
6344 | 6344 | */ |
6345 | 6345 | $results = $arrayy->each( |
6346 | - static function ($value) use ($sorter) { |
|
6346 | + static function($value) use ($sorter) { |
|
6347 | 6347 | if (\is_callable($sorter) === true) { |
6348 | 6348 | return $sorter($value); |
6349 | 6349 | } |
@@ -6416,7 +6416,7 @@ discard block |
||
6416 | 6416 | public function split(int $numberOfPieces = 2, bool $keepKeys = false): self |
6417 | 6417 | { |
6418 | 6418 | if ($keepKeys) { |
6419 | - $generator = function () use ($numberOfPieces) { |
|
6419 | + $generator = function() use ($numberOfPieces) { |
|
6420 | 6420 | $carry = []; |
6421 | 6421 | $i = 1; |
6422 | 6422 | foreach ($this->getGenerator() as $key => $value) { |
@@ -6439,7 +6439,7 @@ discard block |
||
6439 | 6439 | } |
6440 | 6440 | }; |
6441 | 6441 | } else { |
6442 | - $generator = function () use ($numberOfPieces) { |
|
6442 | + $generator = function() use ($numberOfPieces) { |
|
6443 | 6443 | $carry = []; |
6444 | 6444 | $i = 1; |
6445 | 6445 | foreach ($this->getGenerator() as $key => $value) { |
@@ -6486,7 +6486,7 @@ discard block |
||
6486 | 6486 | public function stripEmpty(): self |
6487 | 6487 | { |
6488 | 6488 | return $this->filter( |
6489 | - static function ($item) { |
|
6489 | + static function($item) { |
|
6490 | 6490 | if ($item === null) { |
6491 | 6491 | return false; |
6492 | 6492 | } |
@@ -6689,7 +6689,7 @@ discard block |
||
6689 | 6689 | * @psalm-suppress MissingClosureParamType |
6690 | 6690 | */ |
6691 | 6691 | $this->array = $this->reduce( |
6692 | - static function ($resultArray, $value) { |
|
6692 | + static function($resultArray, $value) { |
|
6693 | 6693 | if (!\in_array($value, $resultArray, true)) { |
6694 | 6694 | $resultArray[] = $value; |
6695 | 6695 | } |
@@ -6728,7 +6728,7 @@ discard block |
||
6728 | 6728 | */ |
6729 | 6729 | $this->array = \array_reduce( |
6730 | 6730 | \array_keys($array), |
6731 | - static function ($resultArray, $key) use ($array) { |
|
6731 | + static function($resultArray, $key) use ($array) { |
|
6732 | 6732 | if (!\in_array($array[$key], $resultArray, true)) { |
6733 | 6733 | $resultArray[$key] = $array[$key]; |
6734 | 6734 | } |
@@ -6823,7 +6823,7 @@ discard block |
||
6823 | 6823 | public function values(): self |
6824 | 6824 | { |
6825 | 6825 | return static::create( |
6826 | - function () { |
|
6826 | + function() { |
|
6827 | 6827 | /** @noinspection YieldFromCanBeUsedInspection */ |
6828 | 6828 | foreach ($this->getGenerator() as $value) { |
6829 | 6829 | yield $value; |
@@ -6899,7 +6899,7 @@ discard block |
||
6899 | 6899 | public function where(string $keyOrPropertyOrMethod, $value): self |
6900 | 6900 | { |
6901 | 6901 | return $this->filter( |
6902 | - function ($item) use ($keyOrPropertyOrMethod, $value) { |
|
6902 | + function($item) use ($keyOrPropertyOrMethod, $value) { |
|
6903 | 6903 | $accessorValue = $this->extractValue( |
6904 | 6904 | $item, |
6905 | 6905 | $keyOrPropertyOrMethod |
@@ -7189,7 +7189,7 @@ discard block |
||
7189 | 7189 | protected function getPropertiesFromPhpDoc() |
7190 | 7190 | { |
7191 | 7191 | static $PROPERTY_CACHE = []; |
7192 | - $cacheKey = 'Class::' . static::class; |
|
7192 | + $cacheKey = 'Class::'.static::class; |
|
7193 | 7193 | |
7194 | 7194 | if (isset($PROPERTY_CACHE[$cacheKey])) { |
7195 | 7195 | return $PROPERTY_CACHE[$cacheKey]; |
@@ -7495,7 +7495,7 @@ discard block |
||
7495 | 7495 | if ($array === null) { |
7496 | 7496 | $array = []; |
7497 | 7497 | } elseif (!\is_array($array)) { |
7498 | - throw new \RuntimeException('Can not set value at this path "' . $key . '" because (' . \gettype($array) . ')"' . \print_r($array, true) . '" is not an array.'); |
|
7498 | + throw new \RuntimeException('Can not set value at this path "'.$key.'" because ('.\gettype($array).')"'.\print_r($array, true).'" is not an array.'); |
|
7499 | 7499 | } |
7500 | 7500 | |
7501 | 7501 | $array[$key] = $value; |
@@ -7567,7 +7567,7 @@ discard block |
||
7567 | 7567 | && |
7568 | 7568 | \count(\array_diff_key($properties, $data)) > 0 |
7569 | 7569 | ) { |
7570 | - throw new \TypeError('Property mismatch - input: ' . \print_r(\array_keys($data), true) . ' | expected: ' . \print_r(\array_keys($properties), true)); |
|
7570 | + throw new \TypeError('Property mismatch - input: '.\print_r(\array_keys($data), true).' | expected: '.\print_r(\array_keys($properties), true)); |
|
7571 | 7571 | } |
7572 | 7572 | |
7573 | 7573 | foreach ($data as $key => &$valueInner) { |
@@ -7684,7 +7684,7 @@ discard block |
||
7684 | 7684 | * |
7685 | 7685 | * @return void |
7686 | 7686 | */ |
7687 | - static function (&$item) { |
|
7687 | + static function(&$item) { |
|
7688 | 7688 | if ($item instanceof self) { |
7689 | 7689 | $item = $item->getArray(); |
7690 | 7690 | } |
@@ -7709,7 +7709,7 @@ discard block |
||
7709 | 7709 | && |
7710 | 7710 | $this->checkPropertiesMismatch === true |
7711 | 7711 | ) { |
7712 | - throw new \TypeError('The key "' . $key . '" does not exists as "@property" phpdoc. (' . \get_class($this) . ').'); |
|
7712 | + throw new \TypeError('The key "'.$key.'" does not exists as "@property" phpdoc. ('.\get_class($this).').'); |
|
7713 | 7713 | } |
7714 | 7714 | |
7715 | 7715 | 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 | ); |