@@ -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, |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | */ |
708 | 708 | $this->callAtPath( |
709 | 709 | $containerPath, |
710 | - static function ($container) use ($lastOffset, &$offsetExists) { |
|
710 | + static function($container) use ($lastOffset, &$offsetExists) { |
|
711 | 711 | $offsetExists = \array_key_exists($lastOffset, $container); |
712 | 712 | } |
713 | 713 | ); |
@@ -810,7 +810,7 @@ discard block |
||
810 | 810 | */ |
811 | 811 | $this->callAtPath( |
812 | 812 | \implode($this->pathSeparator, $path), |
813 | - static function (&$offset) use ($pathToUnset) { |
|
813 | + static function(&$offset) use ($pathToUnset) { |
|
814 | 814 | if (\is_array($offset)) { |
815 | 815 | unset($offset[$pathToUnset]); |
816 | 816 | } else { |
@@ -865,7 +865,7 @@ discard block |
||
865 | 865 | |
866 | 866 | if (\strpos($iteratorClass, '\\') === 0) { |
867 | 867 | /** @var class-string<\Arrayy\ArrayyIterator<TKey,T>> $iteratorClass */ |
868 | - $iteratorClass = '\\' . $iteratorClass; |
|
868 | + $iteratorClass = '\\'.$iteratorClass; |
|
869 | 869 | if (\class_exists($iteratorClass)) { |
870 | 870 | /** |
871 | 871 | * @psalm-suppress PropertyTypeCoercion |
@@ -876,7 +876,7 @@ discard block |
||
876 | 876 | } |
877 | 877 | } |
878 | 878 | |
879 | - throw new \InvalidArgumentException('The iterator class does not exist: ' . $iteratorClass); |
|
879 | + throw new \InvalidArgumentException('The iterator class does not exist: '.$iteratorClass); |
|
880 | 880 | } |
881 | 881 | |
882 | 882 | /** |
@@ -1051,13 +1051,13 @@ discard block |
||
1051 | 1051 | |
1052 | 1052 | foreach ($this->getGenerator() as $key => $item) { |
1053 | 1053 | if ($item instanceof self) { |
1054 | - $result[$prefix . $key] = $item->appendToEachKey($prefix); |
|
1054 | + $result[$prefix.$key] = $item->appendToEachKey($prefix); |
|
1055 | 1055 | } elseif (\is_array($item)) { |
1056 | - $result[$prefix . $key] = self::create($item, $this->iteratorClass, false) |
|
1056 | + $result[$prefix.$key] = self::create($item, $this->iteratorClass, false) |
|
1057 | 1057 | ->appendToEachKey($prefix) |
1058 | 1058 | ->toArray(); |
1059 | 1059 | } else { |
1060 | - $result[$prefix . $key] = $item; |
|
1060 | + $result[$prefix.$key] = $item; |
|
1061 | 1061 | } |
1062 | 1062 | } |
1063 | 1063 | |
@@ -1092,7 +1092,7 @@ discard block |
||
1092 | 1092 | } elseif (\is_object($item) === true) { |
1093 | 1093 | $result[$key] = $item; |
1094 | 1094 | } else { |
1095 | - $result[$key] = $prefix . $item; |
|
1095 | + $result[$key] = $prefix.$item; |
|
1096 | 1096 | } |
1097 | 1097 | } |
1098 | 1098 | |
@@ -1279,7 +1279,7 @@ discard block |
||
1279 | 1279 | public function chunk($size, $preserveKeys = false): self |
1280 | 1280 | { |
1281 | 1281 | if ($preserveKeys) { |
1282 | - $generator = function () use ($size) { |
|
1282 | + $generator = function() use ($size) { |
|
1283 | 1283 | $values = []; |
1284 | 1284 | $tmpCounter = 0; |
1285 | 1285 | foreach ($this->getGenerator() as $key => $value) { |
@@ -1299,7 +1299,7 @@ discard block |
||
1299 | 1299 | } |
1300 | 1300 | }; |
1301 | 1301 | } else { |
1302 | - $generator = function () use ($size) { |
|
1302 | + $generator = function() use ($size) { |
|
1303 | 1303 | $values = []; |
1304 | 1304 | $tmpCounter = 0; |
1305 | 1305 | foreach ($this->getGenerator() as $key => $value) { |
@@ -1343,7 +1343,7 @@ discard block |
||
1343 | 1343 | public function clean(): self |
1344 | 1344 | { |
1345 | 1345 | return $this->filter( |
1346 | - static function ($value) { |
|
1346 | + static function($value) { |
|
1347 | 1347 | return (bool) $value; |
1348 | 1348 | } |
1349 | 1349 | ); |
@@ -1682,9 +1682,9 @@ discard block |
||
1682 | 1682 | |
1683 | 1683 | foreach ($items as $key => $value) { |
1684 | 1684 | if (\is_array($value) && $value !== []) { |
1685 | - $flatten[] = $this->flatten($delimiter, $prepend . $key . $delimiter, $value); |
|
1685 | + $flatten[] = $this->flatten($delimiter, $prepend.$key.$delimiter, $value); |
|
1686 | 1686 | } else { |
1687 | - $flatten[] = [$prepend . $key => $value]; |
|
1687 | + $flatten[] = [$prepend.$key => $value]; |
|
1688 | 1688 | } |
1689 | 1689 | } |
1690 | 1690 | |
@@ -1869,7 +1869,7 @@ discard block |
||
1869 | 1869 | */ |
1870 | 1870 | \array_walk( |
1871 | 1871 | $array, |
1872 | - static function (&$val) { |
|
1872 | + static function(&$val) { |
|
1873 | 1873 | if ((string) $val === $val) { |
1874 | 1874 | $val = \trim($val); |
1875 | 1875 | } |
@@ -2095,7 +2095,7 @@ discard block |
||
2095 | 2095 | $array = $array[0]; |
2096 | 2096 | } |
2097 | 2097 | |
2098 | - $generator = function () use ($array): \Generator { |
|
2098 | + $generator = function() use ($array): \Generator { |
|
2099 | 2099 | foreach ($this->getGenerator() as $key => $value) { |
2100 | 2100 | if (\in_array($value, $array, true) === false) { |
2101 | 2101 | yield $key => $value; |
@@ -2130,7 +2130,7 @@ discard block |
||
2130 | 2130 | $array = $array[0]; |
2131 | 2131 | } |
2132 | 2132 | |
2133 | - $generator = function () use ($array): \Generator { |
|
2133 | + $generator = function() use ($array): \Generator { |
|
2134 | 2134 | foreach ($this->getGenerator() as $key => $value) { |
2135 | 2135 | if (\array_key_exists($key, $array) === false) { |
2136 | 2136 | yield $key => $value; |
@@ -2165,7 +2165,7 @@ discard block |
||
2165 | 2165 | $array = $array[0]; |
2166 | 2166 | } |
2167 | 2167 | |
2168 | - $generator = function () use ($array): \Generator { |
|
2168 | + $generator = function() use ($array): \Generator { |
|
2169 | 2169 | foreach ($this->getGenerator() as $key => $value) { |
2170 | 2170 | $isset = isset($array[$key]); |
2171 | 2171 | |
@@ -2477,7 +2477,7 @@ discard block |
||
2477 | 2477 | /** @phpstan-var \Closure(TKey=):bool $closure */ |
2478 | 2478 | $closure = $closure; |
2479 | 2479 | |
2480 | - $generator = function () use ($closure) { |
|
2480 | + $generator = function() use ($closure) { |
|
2481 | 2481 | foreach ($this->getGenerator() as $key => $value) { |
2482 | 2482 | if ($closure($key) === true) { |
2483 | 2483 | yield $key => $value; |
@@ -2489,7 +2489,7 @@ discard block |
||
2489 | 2489 | /** @phpstan-var \Closure(T=,TKey=):bool $closure */ |
2490 | 2490 | $closure = $closure; |
2491 | 2491 | |
2492 | - $generator = function () use ($closure) { |
|
2492 | + $generator = function() use ($closure) { |
|
2493 | 2493 | foreach ($this->getGenerator() as $key => $value) { |
2494 | 2494 | if ($closure($value, $key) === true) { |
2495 | 2495 | yield $key => $value; |
@@ -2501,7 +2501,7 @@ discard block |
||
2501 | 2501 | /** @phpstan-var \Closure(T=):bool $closure */ |
2502 | 2502 | $closure = $closure; |
2503 | 2503 | |
2504 | - $generator = function () use ($closure) { |
|
2504 | + $generator = function() use ($closure) { |
|
2505 | 2505 | foreach ($this->getGenerator() as $key => $value) { |
2506 | 2506 | if ($closure($value) === true) { |
2507 | 2507 | yield $key => $value; |
@@ -2557,40 +2557,40 @@ discard block |
||
2557 | 2557 | } |
2558 | 2558 | |
2559 | 2559 | $ops = [ |
2560 | - 'eq' => static function ($item, $prop, $value): bool { |
|
2560 | + 'eq' => static function($item, $prop, $value): bool { |
|
2561 | 2561 | return $item[$prop] === $value; |
2562 | 2562 | }, |
2563 | - 'gt' => static function ($item, $prop, $value): bool { |
|
2563 | + 'gt' => static function($item, $prop, $value): bool { |
|
2564 | 2564 | return $item[$prop] > $value; |
2565 | 2565 | }, |
2566 | - 'ge' => static function ($item, $prop, $value): bool { |
|
2566 | + 'ge' => static function($item, $prop, $value): bool { |
|
2567 | 2567 | return $item[$prop] >= $value; |
2568 | 2568 | }, |
2569 | - 'gte' => static function ($item, $prop, $value): bool { |
|
2569 | + 'gte' => static function($item, $prop, $value): bool { |
|
2570 | 2570 | return $item[$prop] >= $value; |
2571 | 2571 | }, |
2572 | - 'lt' => static function ($item, $prop, $value): bool { |
|
2572 | + 'lt' => static function($item, $prop, $value): bool { |
|
2573 | 2573 | return $item[$prop] < $value; |
2574 | 2574 | }, |
2575 | - 'le' => static function ($item, $prop, $value): bool { |
|
2575 | + 'le' => static function($item, $prop, $value): bool { |
|
2576 | 2576 | return $item[$prop] <= $value; |
2577 | 2577 | }, |
2578 | - 'lte' => static function ($item, $prop, $value): bool { |
|
2578 | + 'lte' => static function($item, $prop, $value): bool { |
|
2579 | 2579 | return $item[$prop] <= $value; |
2580 | 2580 | }, |
2581 | - 'ne' => static function ($item, $prop, $value): bool { |
|
2581 | + 'ne' => static function($item, $prop, $value): bool { |
|
2582 | 2582 | return $item[$prop] !== $value; |
2583 | 2583 | }, |
2584 | - 'contains' => static function ($item, $prop, $value): bool { |
|
2584 | + 'contains' => static function($item, $prop, $value): bool { |
|
2585 | 2585 | return \in_array($item[$prop], (array) $value, true); |
2586 | 2586 | }, |
2587 | - 'notContains' => static function ($item, $prop, $value): bool { |
|
2587 | + 'notContains' => static function($item, $prop, $value): bool { |
|
2588 | 2588 | return !\in_array($item[$prop], (array) $value, true); |
2589 | 2589 | }, |
2590 | - 'newer' => static function ($item, $prop, $value): bool { |
|
2590 | + 'newer' => static function($item, $prop, $value): bool { |
|
2591 | 2591 | return \strtotime($item[$prop]) > \strtotime($value); |
2592 | 2592 | }, |
2593 | - 'older' => static function ($item, $prop, $value): bool { |
|
2593 | + 'older' => static function($item, $prop, $value): bool { |
|
2594 | 2594 | return \strtotime($item[$prop]) < \strtotime($value); |
2595 | 2595 | }, |
2596 | 2596 | ]; |
@@ -2598,7 +2598,7 @@ discard block |
||
2598 | 2598 | $result = \array_values( |
2599 | 2599 | \array_filter( |
2600 | 2600 | $this->toArray(false, true), |
2601 | - static function ($item) use ( |
|
2601 | + static function($item) use ( |
|
2602 | 2602 | $property, |
2603 | 2603 | $value, |
2604 | 2604 | $ops, |
@@ -2820,7 +2820,7 @@ discard block |
||
2820 | 2820 | */ |
2821 | 2821 | public function flip(): self |
2822 | 2822 | { |
2823 | - $generator = function (): \Generator { |
|
2823 | + $generator = function(): \Generator { |
|
2824 | 2824 | foreach ($this->getGenerator() as $key => $value) { |
2825 | 2825 | yield (string) $value => $key; |
2826 | 2826 | } |
@@ -3091,9 +3091,9 @@ discard block |
||
3091 | 3091 | $jsonObject = \json_decode($json, false); |
3092 | 3092 | |
3093 | 3093 | $mapper = new \Arrayy\Mapper\Json(); |
3094 | - $mapper->undefinedPropertyHandler = static function ($object, $key, $jsonValue) use ($class) { |
|
3094 | + $mapper->undefinedPropertyHandler = static function($object, $key, $jsonValue) use ($class) { |
|
3095 | 3095 | if ($class->checkPropertiesMismatchInConstructor) { |
3096 | - throw new \TypeError('Property mismatch - input: ' . \print_r(['key' => $key, 'jsonValue' => $jsonValue], true) . ' for object: ' . \get_class($object)); |
|
3096 | + throw new \TypeError('Property mismatch - input: '.\print_r(['key' => $key, 'jsonValue' => $jsonValue], true).' for object: '.\get_class($object)); |
|
3097 | 3097 | } |
3098 | 3098 | }; |
3099 | 3099 | |
@@ -3158,13 +3158,13 @@ discard block |
||
3158 | 3158 | public function getColumn($columnKey = null, $indexKey = null): self |
3159 | 3159 | { |
3160 | 3160 | if ($columnKey === null && $indexKey === null) { |
3161 | - $generator = function () { |
|
3161 | + $generator = function() { |
|
3162 | 3162 | foreach ($this->getGenerator() as $key => $value) { |
3163 | 3163 | yield $value; |
3164 | 3164 | } |
3165 | 3165 | }; |
3166 | 3166 | } else { |
3167 | - $generator = function () use ($columnKey, $indexKey) { |
|
3167 | + $generator = function() use ($columnKey, $indexKey) { |
|
3168 | 3168 | foreach ($this->getGenerator() as $key => $value) { |
3169 | 3169 | // reset |
3170 | 3170 | $newKey = null; |
@@ -3464,7 +3464,7 @@ discard block |
||
3464 | 3464 | |
3465 | 3465 | if ($UN_FOUND === null) { |
3466 | 3466 | // Generate unique string to use as marker. |
3467 | - $UN_FOUND = 'arrayy--' . \uniqid('arrayy', true); |
|
3467 | + $UN_FOUND = 'arrayy--'.\uniqid('arrayy', true); |
|
3468 | 3468 | } |
3469 | 3469 | |
3470 | 3470 | if (\is_array($key)) { |
@@ -3514,7 +3514,7 @@ discard block |
||
3514 | 3514 | */ |
3515 | 3515 | public function implode(string $glue = '', string $prefix = ''): string |
3516 | 3516 | { |
3517 | - return $prefix . $this->implode_recursive($glue, $this->toArray(), false); |
|
3517 | + return $prefix.$this->implode_recursive($glue, $this->toArray(), false); |
|
3518 | 3518 | } |
3519 | 3519 | |
3520 | 3520 | /** |
@@ -3623,7 +3623,7 @@ discard block |
||
3623 | 3623 | \array_uintersect( |
3624 | 3624 | $this->toArray(), |
3625 | 3625 | $search, |
3626 | - static function ($a, $b) { |
|
3626 | + static function($a, $b) { |
|
3627 | 3627 | return $a === $b ? 0 : -1; |
3628 | 3628 | } |
3629 | 3629 | ), |
@@ -3971,13 +3971,13 @@ discard block |
||
3971 | 3971 | // non recursive |
3972 | 3972 | |
3973 | 3973 | if ($search_values === null) { |
3974 | - $arrayFunction = function (): \Generator { |
|
3974 | + $arrayFunction = function(): \Generator { |
|
3975 | 3975 | foreach ($this->getGenerator() as $key => $value) { |
3976 | 3976 | yield $key; |
3977 | 3977 | } |
3978 | 3978 | }; |
3979 | 3979 | } else { |
3980 | - $arrayFunction = function () use ($search_values, $strict): \Generator { |
|
3980 | + $arrayFunction = function() use ($search_values, $strict): \Generator { |
|
3981 | 3981 | $is_array_tmp = \is_array($search_values); |
3982 | 3982 | |
3983 | 3983 | /** @noinspection PhpParameterByRefIsNotUsedAsReferenceInspection */ |
@@ -4226,7 +4226,7 @@ discard block |
||
4226 | 4226 | $useArguments = \func_num_args() > 2; |
4227 | 4227 | |
4228 | 4228 | return static::create( |
4229 | - function () use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
4229 | + function() use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
4230 | 4230 | foreach ($this->getGenerator() as $key => $value) { |
4231 | 4231 | if ($useArguments) { |
4232 | 4232 | if ($useKeyAsSecondParameter) { |
@@ -4727,7 +4727,7 @@ discard block |
||
4727 | 4727 | */ |
4728 | 4728 | public function nth(int $step, int $offset = 0): self |
4729 | 4729 | { |
4730 | - $arrayFunction = function () use ($step, $offset): \Generator { |
|
4730 | + $arrayFunction = function() use ($step, $offset): \Generator { |
|
4731 | 4731 | $position = 0; |
4732 | 4732 | foreach ($this->getGenerator() as $key => $value) { |
4733 | 4733 | if ($position++ % $step !== $offset) { |
@@ -4761,7 +4761,7 @@ discard block |
||
4761 | 4761 | { |
4762 | 4762 | $keys = \array_flip($keys); |
4763 | 4763 | |
4764 | - $generator = function () use ($keys): \Generator { |
|
4764 | + $generator = function() use ($keys): \Generator { |
|
4765 | 4765 | foreach ($this->getGenerator() as $key => $value) { |
4766 | 4766 | if (isset($keys[$key])) { |
4767 | 4767 | yield $key => $value; |
@@ -4898,7 +4898,7 @@ discard block |
||
4898 | 4898 | */ |
4899 | 4899 | public function prependImmutable($value, $key = null) |
4900 | 4900 | { |
4901 | - $generator = function () use ($key, $value): \Generator { |
|
4901 | + $generator = function() use ($key, $value): \Generator { |
|
4902 | 4902 | if ($this->properties !== []) { |
4903 | 4903 | $this->checkType($key, $value); |
4904 | 4904 | } |
@@ -4949,7 +4949,7 @@ discard block |
||
4949 | 4949 | )->prependToEachKey($suffix) |
4950 | 4950 | ->toArray(); |
4951 | 4951 | } else { |
4952 | - $result[$key . $suffix] = $item; |
|
4952 | + $result[$key.$suffix] = $item; |
|
4953 | 4953 | } |
4954 | 4954 | } |
4955 | 4955 | |
@@ -4989,7 +4989,7 @@ discard block |
||
4989 | 4989 | } elseif (\is_object($item) === true) { |
4990 | 4990 | $result[$key] = $item; |
4991 | 4991 | } else { |
4992 | - $result[$key] = $item . $suffix; |
|
4992 | + $result[$key] = $item.$suffix; |
|
4993 | 4993 | } |
4994 | 4994 | } |
4995 | 4995 | |
@@ -5795,7 +5795,7 @@ discard block |
||
5795 | 5795 | */ |
5796 | 5796 | public function replaceValues($search, $replacement = ''): self |
5797 | 5797 | { |
5798 | - $function = static function ($value) use ($search, $replacement) { |
|
5798 | + $function = static function($value) use ($search, $replacement) { |
|
5799 | 5799 | return \str_replace($search, $replacement, $value); |
5800 | 5800 | }; |
5801 | 5801 | |
@@ -6485,7 +6485,7 @@ discard block |
||
6485 | 6485 | * @psalm-suppress MissingClosureParamType |
6486 | 6486 | */ |
6487 | 6487 | $results = $arrayy->each( |
6488 | - static function ($value) use ($sorter) { |
|
6488 | + static function($value) use ($sorter) { |
|
6489 | 6489 | if (\is_callable($sorter) === true) { |
6490 | 6490 | return $sorter($value); |
6491 | 6491 | } |
@@ -6558,7 +6558,7 @@ discard block |
||
6558 | 6558 | public function split(int $numberOfPieces = 2, bool $keepKeys = false): self |
6559 | 6559 | { |
6560 | 6560 | if ($keepKeys) { |
6561 | - $generator = function () use ($numberOfPieces) { |
|
6561 | + $generator = function() use ($numberOfPieces) { |
|
6562 | 6562 | $carry = []; |
6563 | 6563 | $i = 1; |
6564 | 6564 | foreach ($this->getGenerator() as $key => $value) { |
@@ -6581,7 +6581,7 @@ discard block |
||
6581 | 6581 | } |
6582 | 6582 | }; |
6583 | 6583 | } else { |
6584 | - $generator = function () use ($numberOfPieces) { |
|
6584 | + $generator = function() use ($numberOfPieces) { |
|
6585 | 6585 | $carry = []; |
6586 | 6586 | $i = 1; |
6587 | 6587 | foreach ($this->getGenerator() as $key => $value) { |
@@ -6628,7 +6628,7 @@ discard block |
||
6628 | 6628 | public function stripEmpty(): self |
6629 | 6629 | { |
6630 | 6630 | return $this->filter( |
6631 | - static function ($item) { |
|
6631 | + static function($item) { |
|
6632 | 6632 | if ($item === null) { |
6633 | 6633 | return false; |
6634 | 6634 | } |
@@ -6828,7 +6828,7 @@ discard block |
||
6828 | 6828 | // INFO: \array_unique() can't handle e.g. "stdClass"-values in an array |
6829 | 6829 | |
6830 | 6830 | $this->array = $this->reduce( |
6831 | - static function ($resultArray, $value, $key) { |
|
6831 | + static function($resultArray, $value, $key) { |
|
6832 | 6832 | if (!\in_array($value, $resultArray, true)) { |
6833 | 6833 | $resultArray[] = $value; |
6834 | 6834 | } |
@@ -6867,7 +6867,7 @@ discard block |
||
6867 | 6867 | */ |
6868 | 6868 | $this->array = \array_reduce( |
6869 | 6869 | \array_keys($array), |
6870 | - static function ($resultArray, $key) use ($array) { |
|
6870 | + static function($resultArray, $key) use ($array) { |
|
6871 | 6871 | if (!\in_array($array[$key], $resultArray, true)) { |
6872 | 6872 | $resultArray[$key] = $array[$key]; |
6873 | 6873 | } |
@@ -6964,7 +6964,7 @@ discard block |
||
6964 | 6964 | public function values(): self |
6965 | 6965 | { |
6966 | 6966 | return static::create( |
6967 | - function () { |
|
6967 | + function() { |
|
6968 | 6968 | /** @noinspection YieldFromCanBeUsedInspection */ |
6969 | 6969 | foreach ($this->getGenerator() as $value) { |
6970 | 6970 | yield $value; |
@@ -7040,7 +7040,7 @@ discard block |
||
7040 | 7040 | public function where(string $keyOrPropertyOrMethod, $value): self |
7041 | 7041 | { |
7042 | 7042 | return $this->filter( |
7043 | - function ($item) use ($keyOrPropertyOrMethod, $value) { |
|
7043 | + function($item) use ($keyOrPropertyOrMethod, $value) { |
|
7044 | 7044 | $accessorValue = $this->extractValue( |
7045 | 7045 | $item, |
7046 | 7046 | $keyOrPropertyOrMethod |
@@ -7330,7 +7330,7 @@ discard block |
||
7330 | 7330 | protected function getPropertiesFromPhpDoc() |
7331 | 7331 | { |
7332 | 7332 | static $PROPERTY_CACHE = []; |
7333 | - $cacheKey = 'Class::' . static::class; |
|
7333 | + $cacheKey = 'Class::'.static::class; |
|
7334 | 7334 | |
7335 | 7335 | if (isset($PROPERTY_CACHE[$cacheKey])) { |
7336 | 7336 | return $PROPERTY_CACHE[$cacheKey]; |
@@ -7640,7 +7640,7 @@ discard block |
||
7640 | 7640 | if ($array === null) { |
7641 | 7641 | $array = []; |
7642 | 7642 | } elseif (!\is_array($array)) { |
7643 | - throw new \RuntimeException('Can not set value at this path "' . $key . '" because (' . \gettype($array) . ')"' . \print_r($array, true) . '" is not an array.'); |
|
7643 | + throw new \RuntimeException('Can not set value at this path "'.$key.'" because ('.\gettype($array).')"'.\print_r($array, true).'" is not an array.'); |
|
7644 | 7644 | } |
7645 | 7645 | |
7646 | 7646 | $array[$key] = $value; |
@@ -7712,7 +7712,7 @@ discard block |
||
7712 | 7712 | && |
7713 | 7713 | \count(\array_diff_key($properties, $data)) > 0 |
7714 | 7714 | ) { |
7715 | - throw new \TypeError('Property mismatch - input: ' . \print_r(\array_keys($data), true) . ' | expected: ' . \print_r(\array_keys($properties), true)); |
|
7715 | + throw new \TypeError('Property mismatch - input: '.\print_r(\array_keys($data), true).' | expected: '.\print_r(\array_keys($properties), true)); |
|
7716 | 7716 | } |
7717 | 7717 | |
7718 | 7718 | foreach ($data as $key => &$valueInner) { |
@@ -7829,7 +7829,7 @@ discard block |
||
7829 | 7829 | * |
7830 | 7830 | * @return void |
7831 | 7831 | */ |
7832 | - static function (&$item) { |
|
7832 | + static function(&$item) { |
|
7833 | 7833 | if ($item instanceof self) { |
7834 | 7834 | $item = $item->getArray(); |
7835 | 7835 | } |
@@ -7854,7 +7854,7 @@ discard block |
||
7854 | 7854 | && |
7855 | 7855 | $this->checkPropertiesMismatch === true |
7856 | 7856 | ) { |
7857 | - throw new \TypeError('The key "' . $key . '" does not exists as "@property" phpdoc. (' . \get_class($this) . ').'); |
|
7857 | + throw new \TypeError('The key "'.$key.'" does not exists as "@property" phpdoc. ('.\get_class($this).').'); |
|
7858 | 7858 | } |
7859 | 7859 | |
7860 | 7860 | if (isset($this->properties[self::ARRAYY_HELPER_TYPES_FOR_ALL_PROPERTIES])) { |