@@ -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 ''; |
@@ -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 | /** |
@@ -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 | ); |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -require __DIR__ . '/../vendor/autoload.php'; |
|
4 | -require __DIR__ . '/vendor/autoload.php'; |
|
3 | +require __DIR__.'/../vendor/autoload.php'; |
|
4 | +require __DIR__.'/vendor/autoload.php'; |
|
5 | 5 | |
6 | 6 | $readmeText = (new \voku\PhpReadmeHelper\GenerateApi())->generate( |
7 | - __DIR__ . '/../src/Arrayy.php', |
|
8 | - __DIR__ . '/docs/base.md' |
|
7 | + __DIR__.'/../src/Arrayy.php', |
|
8 | + __DIR__.'/docs/base.md' |
|
9 | 9 | ); |
10 | 10 | |
11 | -file_put_contents(__DIR__ . '/../README.md', $readmeText); |
|
11 | +file_put_contents(__DIR__.'/../README.md', $readmeText); |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | */ |
315 | 315 | public function appendImmutable($value, $key = null): self |
316 | 316 | { |
317 | - $generator = function () use ($key, $value): \Generator { |
|
317 | + $generator = function() use ($key, $value): \Generator { |
|
318 | 318 | if ($this->properties !== []) { |
319 | 319 | $this->checkType($key, $value); |
320 | 320 | } |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | if ($this->generator instanceof ArrayyRewindableGenerator) { |
502 | 502 | $generator = clone $this->generator; |
503 | 503 | $this->generator = new ArrayyRewindableExtendedGenerator( |
504 | - static function () use ($generator): \Generator { |
|
504 | + static function() use ($generator): \Generator { |
|
505 | 505 | yield from $generator; |
506 | 506 | }, |
507 | 507 | null, |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | */ |
710 | 710 | $this->callAtPath( |
711 | 711 | $containerPath, |
712 | - static function ($container) use ($lastOffset, &$offsetExists) { |
|
712 | + static function($container) use ($lastOffset, &$offsetExists) { |
|
713 | 713 | $offsetExists = \array_key_exists($lastOffset, $container); |
714 | 714 | } |
715 | 715 | ); |
@@ -812,7 +812,7 @@ discard block |
||
812 | 812 | */ |
813 | 813 | $this->callAtPath( |
814 | 814 | \implode($this->pathSeparator, $path), |
815 | - static function (&$offset) use ($pathToUnset) { |
|
815 | + static function(&$offset) use ($pathToUnset) { |
|
816 | 816 | if (\is_array($offset)) { |
817 | 817 | unset($offset[$pathToUnset]); |
818 | 818 | } else { |
@@ -867,7 +867,7 @@ discard block |
||
867 | 867 | |
868 | 868 | if (\strpos($iteratorClass, '\\') === 0) { |
869 | 869 | /** @var class-string<\Arrayy\ArrayyIterator<TKey,T>> $iteratorClass */ |
870 | - $iteratorClass = '\\' . $iteratorClass; |
|
870 | + $iteratorClass = '\\'.$iteratorClass; |
|
871 | 871 | if (\class_exists($iteratorClass)) { |
872 | 872 | /** |
873 | 873 | * @psalm-suppress PropertyTypeCoercion |
@@ -878,7 +878,7 @@ discard block |
||
878 | 878 | } |
879 | 879 | } |
880 | 880 | |
881 | - throw new \InvalidArgumentException('The iterator class does not exist: ' . $iteratorClass); |
|
881 | + throw new \InvalidArgumentException('The iterator class does not exist: '.$iteratorClass); |
|
882 | 882 | } |
883 | 883 | |
884 | 884 | /** |
@@ -1053,13 +1053,13 @@ discard block |
||
1053 | 1053 | |
1054 | 1054 | foreach ($this->getGenerator() as $key => $item) { |
1055 | 1055 | if ($item instanceof self) { |
1056 | - $result[$prefix . $key] = $item->appendToEachKey($prefix); |
|
1056 | + $result[$prefix.$key] = $item->appendToEachKey($prefix); |
|
1057 | 1057 | } elseif (\is_array($item)) { |
1058 | - $result[$prefix . $key] = self::create($item, $this->iteratorClass, false) |
|
1058 | + $result[$prefix.$key] = self::create($item, $this->iteratorClass, false) |
|
1059 | 1059 | ->appendToEachKey($prefix) |
1060 | 1060 | ->toArray(); |
1061 | 1061 | } else { |
1062 | - $result[$prefix . $key] = $item; |
|
1062 | + $result[$prefix.$key] = $item; |
|
1063 | 1063 | } |
1064 | 1064 | } |
1065 | 1065 | |
@@ -1094,7 +1094,7 @@ discard block |
||
1094 | 1094 | } elseif (\is_object($item) === true) { |
1095 | 1095 | $result[$key] = $item; |
1096 | 1096 | } else { |
1097 | - $result[$key] = $prefix . $item; |
|
1097 | + $result[$key] = $prefix.$item; |
|
1098 | 1098 | } |
1099 | 1099 | } |
1100 | 1100 | |
@@ -1281,7 +1281,7 @@ discard block |
||
1281 | 1281 | public function chunk($size, $preserveKeys = false): self |
1282 | 1282 | { |
1283 | 1283 | if ($preserveKeys) { |
1284 | - $generator = function () use ($size) { |
|
1284 | + $generator = function() use ($size) { |
|
1285 | 1285 | $values = []; |
1286 | 1286 | $tmpCounter = 0; |
1287 | 1287 | foreach ($this->getGenerator() as $key => $value) { |
@@ -1301,7 +1301,7 @@ discard block |
||
1301 | 1301 | } |
1302 | 1302 | }; |
1303 | 1303 | } else { |
1304 | - $generator = function () use ($size) { |
|
1304 | + $generator = function() use ($size) { |
|
1305 | 1305 | $values = []; |
1306 | 1306 | $tmpCounter = 0; |
1307 | 1307 | foreach ($this->getGenerator() as $key => $value) { |
@@ -1345,7 +1345,7 @@ discard block |
||
1345 | 1345 | public function clean(): self |
1346 | 1346 | { |
1347 | 1347 | return $this->filter( |
1348 | - static function ($value) { |
|
1348 | + static function($value) { |
|
1349 | 1349 | return (bool) $value; |
1350 | 1350 | } |
1351 | 1351 | ); |
@@ -1684,9 +1684,9 @@ discard block |
||
1684 | 1684 | |
1685 | 1685 | foreach ($items as $key => $value) { |
1686 | 1686 | if (\is_array($value) && $value !== []) { |
1687 | - $flatten[] = $this->flatten($delimiter, $prepend . $key . $delimiter, $value); |
|
1687 | + $flatten[] = $this->flatten($delimiter, $prepend.$key.$delimiter, $value); |
|
1688 | 1688 | } else { |
1689 | - $flatten[] = [$prepend . $key => $value]; |
|
1689 | + $flatten[] = [$prepend.$key => $value]; |
|
1690 | 1690 | } |
1691 | 1691 | } |
1692 | 1692 | |
@@ -1871,7 +1871,7 @@ discard block |
||
1871 | 1871 | */ |
1872 | 1872 | \array_walk( |
1873 | 1873 | $array, |
1874 | - static function (&$val) { |
|
1874 | + static function(&$val) { |
|
1875 | 1875 | if ((string) $val === $val) { |
1876 | 1876 | $val = \trim($val); |
1877 | 1877 | } |
@@ -2097,7 +2097,7 @@ discard block |
||
2097 | 2097 | $array = $array[0]; |
2098 | 2098 | } |
2099 | 2099 | |
2100 | - $generator = function () use ($array): \Generator { |
|
2100 | + $generator = function() use ($array): \Generator { |
|
2101 | 2101 | foreach ($this->getGenerator() as $key => $value) { |
2102 | 2102 | if (\in_array($value, $array, true) === false) { |
2103 | 2103 | yield $key => $value; |
@@ -2132,7 +2132,7 @@ discard block |
||
2132 | 2132 | $array = $array[0]; |
2133 | 2133 | } |
2134 | 2134 | |
2135 | - $generator = function () use ($array): \Generator { |
|
2135 | + $generator = function() use ($array): \Generator { |
|
2136 | 2136 | foreach ($this->getGenerator() as $key => $value) { |
2137 | 2137 | if (\array_key_exists($key, $array) === false) { |
2138 | 2138 | yield $key => $value; |
@@ -2167,7 +2167,7 @@ discard block |
||
2167 | 2167 | $array = $array[0]; |
2168 | 2168 | } |
2169 | 2169 | |
2170 | - $generator = function () use ($array): \Generator { |
|
2170 | + $generator = function() use ($array): \Generator { |
|
2171 | 2171 | foreach ($this->getGenerator() as $key => $value) { |
2172 | 2172 | $isset = isset($array[$key]); |
2173 | 2173 | |
@@ -2479,7 +2479,7 @@ discard block |
||
2479 | 2479 | /** @phpstan-var \Closure(TKey=):bool $closure */ |
2480 | 2480 | $closure = $closure; |
2481 | 2481 | |
2482 | - $generator = function () use ($closure) { |
|
2482 | + $generator = function() use ($closure) { |
|
2483 | 2483 | foreach ($this->getGenerator() as $key => $value) { |
2484 | 2484 | if ($closure($key) === true) { |
2485 | 2485 | yield $key => $value; |
@@ -2491,7 +2491,7 @@ discard block |
||
2491 | 2491 | /** @phpstan-var \Closure(T=,TKey=):bool $closure */ |
2492 | 2492 | $closure = $closure; |
2493 | 2493 | |
2494 | - $generator = function () use ($closure) { |
|
2494 | + $generator = function() use ($closure) { |
|
2495 | 2495 | foreach ($this->getGenerator() as $key => $value) { |
2496 | 2496 | if ($closure($value, $key) === true) { |
2497 | 2497 | yield $key => $value; |
@@ -2503,7 +2503,7 @@ discard block |
||
2503 | 2503 | /** @phpstan-var \Closure(T=):bool $closure */ |
2504 | 2504 | $closure = $closure; |
2505 | 2505 | |
2506 | - $generator = function () use ($closure) { |
|
2506 | + $generator = function() use ($closure) { |
|
2507 | 2507 | foreach ($this->getGenerator() as $key => $value) { |
2508 | 2508 | if ($closure($value) === true) { |
2509 | 2509 | yield $key => $value; |
@@ -2559,40 +2559,40 @@ discard block |
||
2559 | 2559 | } |
2560 | 2560 | |
2561 | 2561 | $ops = [ |
2562 | - 'eq' => static function ($item, $prop, $value): bool { |
|
2562 | + 'eq' => static function($item, $prop, $value): bool { |
|
2563 | 2563 | return $item[$prop] === $value; |
2564 | 2564 | }, |
2565 | - 'gt' => static function ($item, $prop, $value): bool { |
|
2565 | + 'gt' => static function($item, $prop, $value): bool { |
|
2566 | 2566 | return $item[$prop] > $value; |
2567 | 2567 | }, |
2568 | - 'ge' => static function ($item, $prop, $value): bool { |
|
2568 | + 'ge' => static function($item, $prop, $value): bool { |
|
2569 | 2569 | return $item[$prop] >= $value; |
2570 | 2570 | }, |
2571 | - 'gte' => static function ($item, $prop, $value): bool { |
|
2571 | + 'gte' => static function($item, $prop, $value): bool { |
|
2572 | 2572 | return $item[$prop] >= $value; |
2573 | 2573 | }, |
2574 | - 'lt' => static function ($item, $prop, $value): bool { |
|
2574 | + 'lt' => static function($item, $prop, $value): bool { |
|
2575 | 2575 | return $item[$prop] < $value; |
2576 | 2576 | }, |
2577 | - 'le' => static function ($item, $prop, $value): bool { |
|
2577 | + 'le' => static function($item, $prop, $value): bool { |
|
2578 | 2578 | return $item[$prop] <= $value; |
2579 | 2579 | }, |
2580 | - 'lte' => static function ($item, $prop, $value): bool { |
|
2580 | + 'lte' => static function($item, $prop, $value): bool { |
|
2581 | 2581 | return $item[$prop] <= $value; |
2582 | 2582 | }, |
2583 | - 'ne' => static function ($item, $prop, $value): bool { |
|
2583 | + 'ne' => static function($item, $prop, $value): bool { |
|
2584 | 2584 | return $item[$prop] !== $value; |
2585 | 2585 | }, |
2586 | - 'contains' => static function ($item, $prop, $value): bool { |
|
2586 | + 'contains' => static function($item, $prop, $value): bool { |
|
2587 | 2587 | return \in_array($item[$prop], (array) $value, true); |
2588 | 2588 | }, |
2589 | - 'notContains' => static function ($item, $prop, $value): bool { |
|
2589 | + 'notContains' => static function($item, $prop, $value): bool { |
|
2590 | 2590 | return !\in_array($item[$prop], (array) $value, true); |
2591 | 2591 | }, |
2592 | - 'newer' => static function ($item, $prop, $value): bool { |
|
2592 | + 'newer' => static function($item, $prop, $value): bool { |
|
2593 | 2593 | return \strtotime($item[$prop]) > \strtotime($value); |
2594 | 2594 | }, |
2595 | - 'older' => static function ($item, $prop, $value): bool { |
|
2595 | + 'older' => static function($item, $prop, $value): bool { |
|
2596 | 2596 | return \strtotime($item[$prop]) < \strtotime($value); |
2597 | 2597 | }, |
2598 | 2598 | ]; |
@@ -2600,7 +2600,7 @@ discard block |
||
2600 | 2600 | $result = \array_values( |
2601 | 2601 | \array_filter( |
2602 | 2602 | $this->toArray(false, true), |
2603 | - static function ($item) use ( |
|
2603 | + static function($item) use ( |
|
2604 | 2604 | $property, |
2605 | 2605 | $value, |
2606 | 2606 | $ops, |
@@ -2822,7 +2822,7 @@ discard block |
||
2822 | 2822 | */ |
2823 | 2823 | public function flip(): self |
2824 | 2824 | { |
2825 | - $generator = function (): \Generator { |
|
2825 | + $generator = function(): \Generator { |
|
2826 | 2826 | foreach ($this->getGenerator() as $key => $value) { |
2827 | 2827 | yield (string) $value => $key; |
2828 | 2828 | } |
@@ -3093,9 +3093,9 @@ discard block |
||
3093 | 3093 | $jsonObject = \json_decode($json, false); |
3094 | 3094 | |
3095 | 3095 | $mapper = new \Arrayy\Mapper\Json(); |
3096 | - $mapper->undefinedPropertyHandler = static function ($object, $key, $jsonValue) use ($class) { |
|
3096 | + $mapper->undefinedPropertyHandler = static function($object, $key, $jsonValue) use ($class) { |
|
3097 | 3097 | if ($class->checkPropertiesMismatchInConstructor) { |
3098 | - throw new \TypeError('Property mismatch - input: ' . \print_r(['key' => $key, 'jsonValue' => $jsonValue], true) . ' for object: ' . \get_class($object)); |
|
3098 | + throw new \TypeError('Property mismatch - input: '.\print_r(['key' => $key, 'jsonValue' => $jsonValue], true).' for object: '.\get_class($object)); |
|
3099 | 3099 | } |
3100 | 3100 | }; |
3101 | 3101 | |
@@ -3160,13 +3160,13 @@ discard block |
||
3160 | 3160 | public function getColumn($columnKey = null, $indexKey = null): self |
3161 | 3161 | { |
3162 | 3162 | if ($columnKey === null && $indexKey === null) { |
3163 | - $generator = function () { |
|
3163 | + $generator = function() { |
|
3164 | 3164 | foreach ($this->getGenerator() as $key => $value) { |
3165 | 3165 | yield $value; |
3166 | 3166 | } |
3167 | 3167 | }; |
3168 | 3168 | } else { |
3169 | - $generator = function () use ($columnKey, $indexKey) { |
|
3169 | + $generator = function() use ($columnKey, $indexKey) { |
|
3170 | 3170 | foreach ($this->getGenerator() as $key => $value) { |
3171 | 3171 | // reset |
3172 | 3172 | $newKey = null; |
@@ -3466,7 +3466,7 @@ discard block |
||
3466 | 3466 | |
3467 | 3467 | if ($UN_FOUND === null) { |
3468 | 3468 | // Generate unique string to use as marker. |
3469 | - $UN_FOUND = 'arrayy--' . \uniqid('arrayy', true); |
|
3469 | + $UN_FOUND = 'arrayy--'.\uniqid('arrayy', true); |
|
3470 | 3470 | } |
3471 | 3471 | |
3472 | 3472 | if (\is_array($key)) { |
@@ -3516,7 +3516,7 @@ discard block |
||
3516 | 3516 | */ |
3517 | 3517 | public function implode(string $glue = '', string $prefix = ''): string |
3518 | 3518 | { |
3519 | - return $prefix . $this->implode_recursive($glue, $this->toArray(), false); |
|
3519 | + return $prefix.$this->implode_recursive($glue, $this->toArray(), false); |
|
3520 | 3520 | } |
3521 | 3521 | |
3522 | 3522 | /** |
@@ -3625,7 +3625,7 @@ discard block |
||
3625 | 3625 | \array_uintersect( |
3626 | 3626 | $this->toArray(), |
3627 | 3627 | $search, |
3628 | - static function ($a, $b) { |
|
3628 | + static function($a, $b) { |
|
3629 | 3629 | return $a === $b ? 0 : -1; |
3630 | 3630 | } |
3631 | 3631 | ), |
@@ -3973,13 +3973,13 @@ discard block |
||
3973 | 3973 | // non recursive |
3974 | 3974 | |
3975 | 3975 | if ($search_values === null) { |
3976 | - $arrayFunction = function (): \Generator { |
|
3976 | + $arrayFunction = function(): \Generator { |
|
3977 | 3977 | foreach ($this->getGenerator() as $key => $value) { |
3978 | 3978 | yield $key; |
3979 | 3979 | } |
3980 | 3980 | }; |
3981 | 3981 | } else { |
3982 | - $arrayFunction = function () use ($search_values, $strict): \Generator { |
|
3982 | + $arrayFunction = function() use ($search_values, $strict): \Generator { |
|
3983 | 3983 | $is_array_tmp = \is_array($search_values); |
3984 | 3984 | |
3985 | 3985 | /** @noinspection PhpParameterByRefIsNotUsedAsReferenceInspection */ |
@@ -4225,7 +4225,7 @@ discard block |
||
4225 | 4225 | $useArguments = \func_num_args() > 2; |
4226 | 4226 | |
4227 | 4227 | return static::create( |
4228 | - function () use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
4228 | + function() use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
4229 | 4229 | foreach ($this->getGenerator() as $key => $value) { |
4230 | 4230 | if ($useArguments) { |
4231 | 4231 | if ($useKeyAsSecondParameter) { |
@@ -4726,7 +4726,7 @@ discard block |
||
4726 | 4726 | */ |
4727 | 4727 | public function nth(int $step, int $offset = 0): self |
4728 | 4728 | { |
4729 | - $arrayFunction = function () use ($step, $offset): \Generator { |
|
4729 | + $arrayFunction = function() use ($step, $offset): \Generator { |
|
4730 | 4730 | $position = 0; |
4731 | 4731 | foreach ($this->getGenerator() as $key => $value) { |
4732 | 4732 | if ($position++ % $step !== $offset) { |
@@ -4760,7 +4760,7 @@ discard block |
||
4760 | 4760 | { |
4761 | 4761 | $keys = \array_flip($keys); |
4762 | 4762 | |
4763 | - $generator = function () use ($keys): \Generator { |
|
4763 | + $generator = function() use ($keys): \Generator { |
|
4764 | 4764 | foreach ($this->getGenerator() as $key => $value) { |
4765 | 4765 | if (isset($keys[$key])) { |
4766 | 4766 | yield $key => $value; |
@@ -4897,7 +4897,7 @@ discard block |
||
4897 | 4897 | */ |
4898 | 4898 | public function prependImmutable($value, $key = null) |
4899 | 4899 | { |
4900 | - $generator = function () use ($key, $value): \Generator { |
|
4900 | + $generator = function() use ($key, $value): \Generator { |
|
4901 | 4901 | if ($this->properties !== []) { |
4902 | 4902 | $this->checkType($key, $value); |
4903 | 4903 | } |
@@ -4948,7 +4948,7 @@ discard block |
||
4948 | 4948 | )->prependToEachKey($suffix) |
4949 | 4949 | ->toArray(); |
4950 | 4950 | } else { |
4951 | - $result[$key . $suffix] = $item; |
|
4951 | + $result[$key.$suffix] = $item; |
|
4952 | 4952 | } |
4953 | 4953 | } |
4954 | 4954 | |
@@ -4988,7 +4988,7 @@ discard block |
||
4988 | 4988 | } elseif (\is_object($item) === true) { |
4989 | 4989 | $result[$key] = $item; |
4990 | 4990 | } else { |
4991 | - $result[$key] = $item . $suffix; |
|
4991 | + $result[$key] = $item.$suffix; |
|
4992 | 4992 | } |
4993 | 4993 | } |
4994 | 4994 | |
@@ -5788,7 +5788,7 @@ discard block |
||
5788 | 5788 | */ |
5789 | 5789 | public function replaceValues($search, $replacement = ''): self |
5790 | 5790 | { |
5791 | - $function = static function ($value) use ($search, $replacement) { |
|
5791 | + $function = static function($value) use ($search, $replacement) { |
|
5792 | 5792 | return \str_replace($search, $replacement, $value); |
5793 | 5793 | }; |
5794 | 5794 | |
@@ -6478,7 +6478,7 @@ discard block |
||
6478 | 6478 | * @psalm-suppress MissingClosureParamType |
6479 | 6479 | */ |
6480 | 6480 | $results = $arrayy->each( |
6481 | - static function ($value) use ($sorter) { |
|
6481 | + static function($value) use ($sorter) { |
|
6482 | 6482 | if (\is_callable($sorter) === true) { |
6483 | 6483 | return $sorter($value); |
6484 | 6484 | } |
@@ -6551,7 +6551,7 @@ discard block |
||
6551 | 6551 | public function split(int $numberOfPieces = 2, bool $keepKeys = false): self |
6552 | 6552 | { |
6553 | 6553 | if ($keepKeys) { |
6554 | - $generator = function () use ($numberOfPieces) { |
|
6554 | + $generator = function() use ($numberOfPieces) { |
|
6555 | 6555 | $carry = []; |
6556 | 6556 | $i = 1; |
6557 | 6557 | foreach ($this->getGenerator() as $key => $value) { |
@@ -6574,7 +6574,7 @@ discard block |
||
6574 | 6574 | } |
6575 | 6575 | }; |
6576 | 6576 | } else { |
6577 | - $generator = function () use ($numberOfPieces) { |
|
6577 | + $generator = function() use ($numberOfPieces) { |
|
6578 | 6578 | $carry = []; |
6579 | 6579 | $i = 1; |
6580 | 6580 | foreach ($this->getGenerator() as $key => $value) { |
@@ -6621,7 +6621,7 @@ discard block |
||
6621 | 6621 | public function stripEmpty(): self |
6622 | 6622 | { |
6623 | 6623 | return $this->filter( |
6624 | - static function ($item) { |
|
6624 | + static function($item) { |
|
6625 | 6625 | if ($item === null) { |
6626 | 6626 | return false; |
6627 | 6627 | } |
@@ -6825,7 +6825,7 @@ discard block |
||
6825 | 6825 | * @psalm-suppress MissingClosureParamType |
6826 | 6826 | */ |
6827 | 6827 | $this->array = $this->reduce( |
6828 | - static function ($resultArray, $value) { |
|
6828 | + static function($resultArray, $value) { |
|
6829 | 6829 | if (!\in_array($value, $resultArray, true)) { |
6830 | 6830 | $resultArray[] = $value; |
6831 | 6831 | } |
@@ -6864,7 +6864,7 @@ discard block |
||
6864 | 6864 | */ |
6865 | 6865 | $this->array = \array_reduce( |
6866 | 6866 | \array_keys($array), |
6867 | - static function ($resultArray, $key) use ($array) { |
|
6867 | + static function($resultArray, $key) use ($array) { |
|
6868 | 6868 | if (!\in_array($array[$key], $resultArray, true)) { |
6869 | 6869 | $resultArray[$key] = $array[$key]; |
6870 | 6870 | } |
@@ -6961,7 +6961,7 @@ discard block |
||
6961 | 6961 | public function values(): self |
6962 | 6962 | { |
6963 | 6963 | return static::create( |
6964 | - function () { |
|
6964 | + function() { |
|
6965 | 6965 | /** @noinspection YieldFromCanBeUsedInspection */ |
6966 | 6966 | foreach ($this->getGenerator() as $value) { |
6967 | 6967 | yield $value; |
@@ -7037,7 +7037,7 @@ discard block |
||
7037 | 7037 | public function where(string $keyOrPropertyOrMethod, $value): self |
7038 | 7038 | { |
7039 | 7039 | return $this->filter( |
7040 | - function ($item) use ($keyOrPropertyOrMethod, $value) { |
|
7040 | + function($item) use ($keyOrPropertyOrMethod, $value) { |
|
7041 | 7041 | $accessorValue = $this->extractValue( |
7042 | 7042 | $item, |
7043 | 7043 | $keyOrPropertyOrMethod |
@@ -7327,7 +7327,7 @@ discard block |
||
7327 | 7327 | protected function getPropertiesFromPhpDoc() |
7328 | 7328 | { |
7329 | 7329 | static $PROPERTY_CACHE = []; |
7330 | - $cacheKey = 'Class::' . static::class; |
|
7330 | + $cacheKey = 'Class::'.static::class; |
|
7331 | 7331 | |
7332 | 7332 | if (isset($PROPERTY_CACHE[$cacheKey])) { |
7333 | 7333 | return $PROPERTY_CACHE[$cacheKey]; |
@@ -7637,7 +7637,7 @@ discard block |
||
7637 | 7637 | if ($array === null) { |
7638 | 7638 | $array = []; |
7639 | 7639 | } elseif (!\is_array($array)) { |
7640 | - throw new \RuntimeException('Can not set value at this path "' . $key . '" because (' . \gettype($array) . ')"' . \print_r($array, true) . '" is not an array.'); |
|
7640 | + throw new \RuntimeException('Can not set value at this path "'.$key.'" because ('.\gettype($array).')"'.\print_r($array, true).'" is not an array.'); |
|
7641 | 7641 | } |
7642 | 7642 | |
7643 | 7643 | $array[$key] = $value; |
@@ -7709,7 +7709,7 @@ discard block |
||
7709 | 7709 | && |
7710 | 7710 | \count(\array_diff_key($properties, $data)) > 0 |
7711 | 7711 | ) { |
7712 | - throw new \TypeError('Property mismatch - input: ' . \print_r(\array_keys($data), true) . ' | expected: ' . \print_r(\array_keys($properties), true)); |
|
7712 | + throw new \TypeError('Property mismatch - input: '.\print_r(\array_keys($data), true).' | expected: '.\print_r(\array_keys($properties), true)); |
|
7713 | 7713 | } |
7714 | 7714 | |
7715 | 7715 | foreach ($data as $key => &$valueInner) { |
@@ -7826,7 +7826,7 @@ discard block |
||
7826 | 7826 | * |
7827 | 7827 | * @return void |
7828 | 7828 | */ |
7829 | - static function (&$item) { |
|
7829 | + static function(&$item) { |
|
7830 | 7830 | if ($item instanceof self) { |
7831 | 7831 | $item = $item->getArray(); |
7832 | 7832 | } |
@@ -7851,7 +7851,7 @@ discard block |
||
7851 | 7851 | && |
7852 | 7852 | $this->checkPropertiesMismatch === true |
7853 | 7853 | ) { |
7854 | - throw new \TypeError('The key "' . $key . '" does not exists as "@property" phpdoc. (' . \get_class($this) . ').'); |
|
7854 | + throw new \TypeError('The key "'.$key.'" does not exists as "@property" phpdoc. ('.\get_class($this).').'); |
|
7855 | 7855 | } |
7856 | 7856 | |
7857 | 7857 | if (isset($this->properties[self::ARRAYY_HELPER_TYPES_FOR_ALL_PROPERTIES])) { |