@@ -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); |
@@ -2,7 +2,7 @@ |
||
2 | 2 | |
3 | 3 | namespace Arrayy\tests; |
4 | 4 | |
5 | -require_once __DIR__ . '/../vendor/autoload.php'; |
|
5 | +require_once __DIR__.'/../vendor/autoload.php'; |
|
6 | 6 | |
7 | 7 | /** |
8 | 8 | * @property string $type |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | /** |
330 | 330 | * @phpstan-return \Generator<TKey,T> $generator |
331 | 331 | */ |
332 | - $generator = function () use ($key, $value): \Generator { |
|
332 | + $generator = function() use ($key, $value): \Generator { |
|
333 | 333 | if ($this->properties !== []) { |
334 | 334 | $this->checkType($key, $value); |
335 | 335 | } |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | |
518 | 518 | /** @phpstan-var \Arrayy\ArrayyRewindableGenerator<TKey,T> */ |
519 | 519 | $generatorTmp = new ArrayyRewindableExtendedGenerator( |
520 | - static function () use ($generator): \Generator { |
|
520 | + static function() use ($generator): \Generator { |
|
521 | 521 | yield from $generator; |
522 | 522 | }, |
523 | 523 | null, |
@@ -725,7 +725,7 @@ discard block |
||
725 | 725 | */ |
726 | 726 | $this->callAtPath( |
727 | 727 | $containerPath, |
728 | - static function ($container) use ($lastOffset, &$offsetExists) { |
|
728 | + static function($container) use ($lastOffset, &$offsetExists) { |
|
729 | 729 | $offsetExists = \array_key_exists($lastOffset, $container); |
730 | 730 | } |
731 | 731 | ); |
@@ -830,7 +830,7 @@ discard block |
||
830 | 830 | */ |
831 | 831 | $this->callAtPath( |
832 | 832 | \implode($this->pathSeparator, $path), |
833 | - static function (&$offset) use ($pathToUnset) { |
|
833 | + static function(&$offset) use ($pathToUnset) { |
|
834 | 834 | if (\is_array($offset)) { |
835 | 835 | unset($offset[$pathToUnset]); |
836 | 836 | } else { |
@@ -885,7 +885,7 @@ discard block |
||
885 | 885 | |
886 | 886 | if (\strpos($iteratorClass, '\\') === 0) { |
887 | 887 | /** @var class-string<\Arrayy\ArrayyIterator<TKey,T>> $iteratorClass */ |
888 | - $iteratorClass = '\\' . $iteratorClass; |
|
888 | + $iteratorClass = '\\'.$iteratorClass; |
|
889 | 889 | if (\class_exists($iteratorClass)) { |
890 | 890 | /** |
891 | 891 | * @psalm-suppress PropertyTypeCoercion |
@@ -896,7 +896,7 @@ discard block |
||
896 | 896 | } |
897 | 897 | } |
898 | 898 | |
899 | - throw new \InvalidArgumentException('The iterator class does not exist: ' . $iteratorClass); |
|
899 | + throw new \InvalidArgumentException('The iterator class does not exist: '.$iteratorClass); |
|
900 | 900 | } |
901 | 901 | |
902 | 902 | /** |
@@ -1071,13 +1071,13 @@ discard block |
||
1071 | 1071 | |
1072 | 1072 | foreach ($this->getGenerator() as $key => $item) { |
1073 | 1073 | if ($item instanceof self) { |
1074 | - $result[$prefix . $key] = $item->appendToEachKey($prefix); |
|
1074 | + $result[$prefix.$key] = $item->appendToEachKey($prefix); |
|
1075 | 1075 | } elseif (\is_array($item)) { |
1076 | - $result[$prefix . $key] = self::create($item, $this->iteratorClass, false) |
|
1076 | + $result[$prefix.$key] = self::create($item, $this->iteratorClass, false) |
|
1077 | 1077 | ->appendToEachKey($prefix) |
1078 | 1078 | ->toArray(); |
1079 | 1079 | } else { |
1080 | - $result[$prefix . $key] = $item; |
|
1080 | + $result[$prefix.$key] = $item; |
|
1081 | 1081 | } |
1082 | 1082 | } |
1083 | 1083 | |
@@ -1112,7 +1112,7 @@ discard block |
||
1112 | 1112 | } elseif (\is_object($item) === true) { |
1113 | 1113 | $result[$key] = $item; |
1114 | 1114 | } else { |
1115 | - $result[$key] = $prefix . $item; |
|
1115 | + $result[$key] = $prefix.$item; |
|
1116 | 1116 | } |
1117 | 1117 | } |
1118 | 1118 | |
@@ -1299,7 +1299,7 @@ discard block |
||
1299 | 1299 | public function chunk($size, $preserveKeys = false): self |
1300 | 1300 | { |
1301 | 1301 | if ($preserveKeys) { |
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) { |
@@ -1319,7 +1319,7 @@ discard block |
||
1319 | 1319 | } |
1320 | 1320 | }; |
1321 | 1321 | } else { |
1322 | - $generator = function () use ($size) { |
|
1322 | + $generator = function() use ($size) { |
|
1323 | 1323 | $values = []; |
1324 | 1324 | $tmpCounter = 0; |
1325 | 1325 | foreach ($this->getGenerator() as $value) { |
@@ -1363,7 +1363,7 @@ discard block |
||
1363 | 1363 | public function clean(): self |
1364 | 1364 | { |
1365 | 1365 | return $this->filter( |
1366 | - static function ($value) { |
|
1366 | + static function($value) { |
|
1367 | 1367 | return (bool) $value; |
1368 | 1368 | } |
1369 | 1369 | ); |
@@ -1701,9 +1701,9 @@ discard block |
||
1701 | 1701 | |
1702 | 1702 | foreach ($items as $key => $value) { |
1703 | 1703 | if (\is_array($value) && $value !== []) { |
1704 | - $flatten[] = $this->flatten($delimiter, $prepend . $key . $delimiter, $value); |
|
1704 | + $flatten[] = $this->flatten($delimiter, $prepend.$key.$delimiter, $value); |
|
1705 | 1705 | } else { |
1706 | - $flatten[] = [$prepend . $key => $value]; |
|
1706 | + $flatten[] = [$prepend.$key => $value]; |
|
1707 | 1707 | } |
1708 | 1708 | } |
1709 | 1709 | |
@@ -1888,7 +1888,7 @@ discard block |
||
1888 | 1888 | */ |
1889 | 1889 | \array_walk( |
1890 | 1890 | $array, |
1891 | - static function (&$val) { |
|
1891 | + static function(&$val) { |
|
1892 | 1892 | if ((string) $val === $val) { |
1893 | 1893 | $val = \trim($val); |
1894 | 1894 | } |
@@ -2114,7 +2114,7 @@ discard block |
||
2114 | 2114 | $array = $array[0]; |
2115 | 2115 | } |
2116 | 2116 | |
2117 | - $generator = function () use ($array): \Generator { |
|
2117 | + $generator = function() use ($array): \Generator { |
|
2118 | 2118 | foreach ($this->getGenerator() as $key => $value) { |
2119 | 2119 | if (\in_array($value, $array, true) === false) { |
2120 | 2120 | yield $key => $value; |
@@ -2149,7 +2149,7 @@ discard block |
||
2149 | 2149 | $array = $array[0]; |
2150 | 2150 | } |
2151 | 2151 | |
2152 | - $generator = function () use ($array): \Generator { |
|
2152 | + $generator = function() use ($array): \Generator { |
|
2153 | 2153 | foreach ($this->getGenerator() as $key => $value) { |
2154 | 2154 | if (\array_key_exists($key, $array) === false) { |
2155 | 2155 | yield $key => $value; |
@@ -2184,7 +2184,7 @@ discard block |
||
2184 | 2184 | $array = $array[0]; |
2185 | 2185 | } |
2186 | 2186 | |
2187 | - $generator = function () use ($array): \Generator { |
|
2187 | + $generator = function() use ($array): \Generator { |
|
2188 | 2188 | foreach ($this->getGenerator() as $key => $value) { |
2189 | 2189 | $isset = isset($array[$key]); |
2190 | 2190 | |
@@ -2493,7 +2493,7 @@ discard block |
||
2493 | 2493 | } |
2494 | 2494 | |
2495 | 2495 | if ($flag === \ARRAY_FILTER_USE_KEY) { |
2496 | - $generator = function () use ($closure) { |
|
2496 | + $generator = function() use ($closure) { |
|
2497 | 2497 | foreach ($this->getGenerator() as $key => $value) { |
2498 | 2498 | if ($closure($key) === true) { |
2499 | 2499 | yield $key => $value; |
@@ -2505,7 +2505,7 @@ discard block |
||
2505 | 2505 | /** @phpstan-var \Closure(T=,TKey=):bool $closure */ |
2506 | 2506 | $closure = $closure; |
2507 | 2507 | |
2508 | - $generator = function () use ($closure) { |
|
2508 | + $generator = function() use ($closure) { |
|
2509 | 2509 | foreach ($this->getGenerator() as $key => $value) { |
2510 | 2510 | if ($closure($value, $key) === true) { |
2511 | 2511 | yield $key => $value; |
@@ -2513,7 +2513,7 @@ discard block |
||
2513 | 2513 | } |
2514 | 2514 | }; |
2515 | 2515 | } else { |
2516 | - $generator = function () use ($closure) { |
|
2516 | + $generator = function() use ($closure) { |
|
2517 | 2517 | foreach ($this->getGenerator() as $key => $value) { |
2518 | 2518 | if ($closure($value) === true) { |
2519 | 2519 | yield $key => $value; |
@@ -2569,40 +2569,40 @@ discard block |
||
2569 | 2569 | } |
2570 | 2570 | |
2571 | 2571 | $ops = [ |
2572 | - 'eq' => static function ($item, $prop, $value): bool { |
|
2572 | + 'eq' => static function($item, $prop, $value): bool { |
|
2573 | 2573 | return $item[$prop] === $value; |
2574 | 2574 | }, |
2575 | - 'gt' => static function ($item, $prop, $value): bool { |
|
2575 | + 'gt' => static function($item, $prop, $value): bool { |
|
2576 | 2576 | return $item[$prop] > $value; |
2577 | 2577 | }, |
2578 | - 'ge' => static function ($item, $prop, $value): bool { |
|
2578 | + 'ge' => static function($item, $prop, $value): bool { |
|
2579 | 2579 | return $item[$prop] >= $value; |
2580 | 2580 | }, |
2581 | - 'gte' => static function ($item, $prop, $value): bool { |
|
2581 | + 'gte' => static function($item, $prop, $value): bool { |
|
2582 | 2582 | return $item[$prop] >= $value; |
2583 | 2583 | }, |
2584 | - 'lt' => static function ($item, $prop, $value): bool { |
|
2584 | + 'lt' => static function($item, $prop, $value): bool { |
|
2585 | 2585 | return $item[$prop] < $value; |
2586 | 2586 | }, |
2587 | - 'le' => static function ($item, $prop, $value): bool { |
|
2587 | + 'le' => static function($item, $prop, $value): bool { |
|
2588 | 2588 | return $item[$prop] <= $value; |
2589 | 2589 | }, |
2590 | - 'lte' => static function ($item, $prop, $value): bool { |
|
2590 | + 'lte' => static function($item, $prop, $value): bool { |
|
2591 | 2591 | return $item[$prop] <= $value; |
2592 | 2592 | }, |
2593 | - 'ne' => static function ($item, $prop, $value): bool { |
|
2593 | + 'ne' => static function($item, $prop, $value): bool { |
|
2594 | 2594 | return $item[$prop] !== $value; |
2595 | 2595 | }, |
2596 | - 'contains' => static function ($item, $prop, $value): bool { |
|
2596 | + 'contains' => static function($item, $prop, $value): bool { |
|
2597 | 2597 | return \in_array($item[$prop], (array) $value, true); |
2598 | 2598 | }, |
2599 | - 'notContains' => static function ($item, $prop, $value): bool { |
|
2599 | + 'notContains' => static function($item, $prop, $value): bool { |
|
2600 | 2600 | return !\in_array($item[$prop], (array) $value, true); |
2601 | 2601 | }, |
2602 | - 'newer' => static function ($item, $prop, $value): bool { |
|
2602 | + 'newer' => static function($item, $prop, $value): bool { |
|
2603 | 2603 | return \strtotime($item[$prop]) > \strtotime($value); |
2604 | 2604 | }, |
2605 | - 'older' => static function ($item, $prop, $value): bool { |
|
2605 | + 'older' => static function($item, $prop, $value): bool { |
|
2606 | 2606 | return \strtotime($item[$prop]) < \strtotime($value); |
2607 | 2607 | }, |
2608 | 2608 | ]; |
@@ -2610,7 +2610,7 @@ discard block |
||
2610 | 2610 | $result = \array_values( |
2611 | 2611 | \array_filter( |
2612 | 2612 | $this->toArray(false, true), |
2613 | - static function ($item) use ( |
|
2613 | + static function($item) use ( |
|
2614 | 2614 | $property, |
2615 | 2615 | $value, |
2616 | 2616 | $ops, |
@@ -2837,7 +2837,7 @@ discard block |
||
2837 | 2837 | */ |
2838 | 2838 | public function flip(): self |
2839 | 2839 | { |
2840 | - $generator = function (): \Generator { |
|
2840 | + $generator = function(): \Generator { |
|
2841 | 2841 | foreach ($this->getGenerator() as $key => $value) { |
2842 | 2842 | yield (string) $value => $key; |
2843 | 2843 | } |
@@ -3110,9 +3110,9 @@ discard block |
||
3110 | 3110 | $jsonObject = \json_decode($json, false); |
3111 | 3111 | |
3112 | 3112 | $mapper = new \Arrayy\Mapper\Json(); |
3113 | - $mapper->undefinedPropertyHandler = static function ($object, $key, $jsonValue) use ($class) { |
|
3113 | + $mapper->undefinedPropertyHandler = static function($object, $key, $jsonValue) use ($class) { |
|
3114 | 3114 | if ($class->checkPropertiesMismatchInConstructor) { |
3115 | - throw new \TypeError('Property mismatch - input: ' . \print_r(['key' => $key, 'jsonValue' => $jsonValue], true) . ' for object: ' . \get_class($object)); |
|
3115 | + throw new \TypeError('Property mismatch - input: '.\print_r(['key' => $key, 'jsonValue' => $jsonValue], true).' for object: '.\get_class($object)); |
|
3116 | 3116 | } |
3117 | 3117 | }; |
3118 | 3118 | |
@@ -3177,13 +3177,13 @@ discard block |
||
3177 | 3177 | public function getColumn($columnKey = null, $indexKey = null): self |
3178 | 3178 | { |
3179 | 3179 | if ($columnKey === null && $indexKey === null) { |
3180 | - $generator = function () { |
|
3180 | + $generator = function() { |
|
3181 | 3181 | foreach ($this->getGenerator() as $value) { |
3182 | 3182 | yield $value; |
3183 | 3183 | } |
3184 | 3184 | }; |
3185 | 3185 | } else { |
3186 | - $generator = function () use ($columnKey, $indexKey) { |
|
3186 | + $generator = function() use ($columnKey, $indexKey) { |
|
3187 | 3187 | foreach ($this->getGenerator() as $value) { |
3188 | 3188 | // reset |
3189 | 3189 | $newKey = null; |
@@ -3486,7 +3486,7 @@ discard block |
||
3486 | 3486 | |
3487 | 3487 | if ($UN_FOUND === null) { |
3488 | 3488 | // Generate unique string to use as marker. |
3489 | - $UN_FOUND = 'arrayy--' . \uniqid('arrayy', true); |
|
3489 | + $UN_FOUND = 'arrayy--'.\uniqid('arrayy', true); |
|
3490 | 3490 | } |
3491 | 3491 | |
3492 | 3492 | if (\is_array($key)) { |
@@ -3538,7 +3538,7 @@ discard block |
||
3538 | 3538 | */ |
3539 | 3539 | public function implode(string $glue = '', string $prefix = ''): string |
3540 | 3540 | { |
3541 | - return $prefix . $this->implode_recursive($glue, $this->toArray(), false); |
|
3541 | + return $prefix.$this->implode_recursive($glue, $this->toArray(), false); |
|
3542 | 3542 | } |
3543 | 3543 | |
3544 | 3544 | /** |
@@ -3652,7 +3652,7 @@ discard block |
||
3652 | 3652 | \array_uintersect( |
3653 | 3653 | $this->toArray(), |
3654 | 3654 | $search, |
3655 | - static function ($a, $b) { |
|
3655 | + static function($a, $b) { |
|
3656 | 3656 | return $a === $b ? 0 : -1; |
3657 | 3657 | } |
3658 | 3658 | ), |
@@ -4003,13 +4003,13 @@ discard block |
||
4003 | 4003 | // non recursive |
4004 | 4004 | |
4005 | 4005 | if ($search_values === null) { |
4006 | - $arrayFunction = function (): \Generator { |
|
4006 | + $arrayFunction = function(): \Generator { |
|
4007 | 4007 | foreach ($this->getGenerator() as $key => $value) { |
4008 | 4008 | yield $key; |
4009 | 4009 | } |
4010 | 4010 | }; |
4011 | 4011 | } else { |
4012 | - $arrayFunction = function () use ($search_values, $strict): \Generator { |
|
4012 | + $arrayFunction = function() use ($search_values, $strict): \Generator { |
|
4013 | 4013 | $is_array_tmp = \is_array($search_values); |
4014 | 4014 | |
4015 | 4015 | /** @noinspection PhpParameterByRefIsNotUsedAsReferenceInspection */ |
@@ -4258,7 +4258,7 @@ discard block |
||
4258 | 4258 | $useArguments = \func_num_args() > 2; |
4259 | 4259 | |
4260 | 4260 | return static::create( |
4261 | - function () use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
4261 | + function() use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
4262 | 4262 | foreach ($this->getGenerator() as $key => $value) { |
4263 | 4263 | if ($useArguments) { |
4264 | 4264 | if ($useKeyAsSecondParameter) { |
@@ -4759,7 +4759,7 @@ discard block |
||
4759 | 4759 | */ |
4760 | 4760 | public function nth(int $step, int $offset = 0): self |
4761 | 4761 | { |
4762 | - $arrayFunction = function () use ($step, $offset): \Generator { |
|
4762 | + $arrayFunction = function() use ($step, $offset): \Generator { |
|
4763 | 4763 | $position = 0; |
4764 | 4764 | foreach ($this->getGenerator() as $key => $value) { |
4765 | 4765 | if ($position++ % $step !== $offset) { |
@@ -4793,7 +4793,7 @@ discard block |
||
4793 | 4793 | { |
4794 | 4794 | $keys = \array_flip($keys); |
4795 | 4795 | |
4796 | - $generator = function () use ($keys): \Generator { |
|
4796 | + $generator = function() use ($keys): \Generator { |
|
4797 | 4797 | foreach ($this->getGenerator() as $key => $value) { |
4798 | 4798 | if (isset($keys[$key])) { |
4799 | 4799 | yield $key => $value; |
@@ -4930,7 +4930,7 @@ discard block |
||
4930 | 4930 | */ |
4931 | 4931 | public function prependImmutable($value, $key = null) |
4932 | 4932 | { |
4933 | - $generator = function () use ($key, $value): \Generator { |
|
4933 | + $generator = function() use ($key, $value): \Generator { |
|
4934 | 4934 | if ($this->properties !== []) { |
4935 | 4935 | $this->checkType($key, $value); |
4936 | 4936 | } |
@@ -4980,7 +4980,7 @@ discard block |
||
4980 | 4980 | )->prependToEachKey($suffix) |
4981 | 4981 | ->toArray(); |
4982 | 4982 | } else { |
4983 | - $result[$key . $suffix] = $item; |
|
4983 | + $result[$key.$suffix] = $item; |
|
4984 | 4984 | } |
4985 | 4985 | } |
4986 | 4986 | |
@@ -5020,7 +5020,7 @@ discard block |
||
5020 | 5020 | } elseif (\is_object($item) === true) { |
5021 | 5021 | $result[$key] = $item; |
5022 | 5022 | } else { |
5023 | - $result[$key] = $item . $suffix; |
|
5023 | + $result[$key] = $item.$suffix; |
|
5024 | 5024 | } |
5025 | 5025 | } |
5026 | 5026 | |
@@ -5826,7 +5826,7 @@ discard block |
||
5826 | 5826 | */ |
5827 | 5827 | public function replaceValues($search, $replacement = ''): self |
5828 | 5828 | { |
5829 | - $function = static function ($value) use ($search, $replacement) { |
|
5829 | + $function = static function($value) use ($search, $replacement) { |
|
5830 | 5830 | return \str_replace($search, $replacement, $value); |
5831 | 5831 | }; |
5832 | 5832 | |
@@ -6523,7 +6523,7 @@ discard block |
||
6523 | 6523 | * @psalm-suppress MissingClosureParamType |
6524 | 6524 | */ |
6525 | 6525 | $results = $arrayy->each( |
6526 | - static function ($value) use ($sorter) { |
|
6526 | + static function($value) use ($sorter) { |
|
6527 | 6527 | if (\is_callable($sorter) === true) { |
6528 | 6528 | return $sorter($value); |
6529 | 6529 | } |
@@ -6596,7 +6596,7 @@ discard block |
||
6596 | 6596 | public function split(int $numberOfPieces = 2, bool $keepKeys = false): self |
6597 | 6597 | { |
6598 | 6598 | if ($keepKeys) { |
6599 | - $generator = function () use ($numberOfPieces) { |
|
6599 | + $generator = function() use ($numberOfPieces) { |
|
6600 | 6600 | $carry = []; |
6601 | 6601 | $i = 1; |
6602 | 6602 | foreach ($this->getGenerator() as $key => $value) { |
@@ -6619,7 +6619,7 @@ discard block |
||
6619 | 6619 | } |
6620 | 6620 | }; |
6621 | 6621 | } else { |
6622 | - $generator = function () use ($numberOfPieces) { |
|
6622 | + $generator = function() use ($numberOfPieces) { |
|
6623 | 6623 | $carry = []; |
6624 | 6624 | $i = 1; |
6625 | 6625 | foreach ($this->getGenerator() as $value) { |
@@ -6666,7 +6666,7 @@ discard block |
||
6666 | 6666 | public function stripEmpty(): self |
6667 | 6667 | { |
6668 | 6668 | return $this->filter( |
6669 | - static function ($item) { |
|
6669 | + static function($item) { |
|
6670 | 6670 | if ($item === null) { |
6671 | 6671 | return false; |
6672 | 6672 | } |
@@ -6866,7 +6866,7 @@ discard block |
||
6866 | 6866 | // INFO: \array_unique() can't handle e.g. "stdClass"-values in an array |
6867 | 6867 | |
6868 | 6868 | $this->array = $this->reduce( |
6869 | - static function ($resultArray, $value, $key) { |
|
6869 | + static function($resultArray, $value, $key) { |
|
6870 | 6870 | if (!\in_array($value, $resultArray, true)) { |
6871 | 6871 | $resultArray[] = $value; |
6872 | 6872 | } |
@@ -6905,7 +6905,7 @@ discard block |
||
6905 | 6905 | */ |
6906 | 6906 | $this->array = \array_reduce( |
6907 | 6907 | \array_keys($array), |
6908 | - static function ($resultArray, $key) use ($array) { |
|
6908 | + static function($resultArray, $key) use ($array) { |
|
6909 | 6909 | if (!\in_array($array[$key], $resultArray, true)) { |
6910 | 6910 | $resultArray[$key] = $array[$key]; |
6911 | 6911 | } |
@@ -7002,7 +7002,7 @@ discard block |
||
7002 | 7002 | public function values(): self |
7003 | 7003 | { |
7004 | 7004 | return static::create( |
7005 | - function () { |
|
7005 | + function() { |
|
7006 | 7006 | foreach ($this->getGenerator() as $value) { |
7007 | 7007 | yield $value; |
7008 | 7008 | } |
@@ -7081,7 +7081,7 @@ discard block |
||
7081 | 7081 | public function where(string $keyOrPropertyOrMethod, $value): self |
7082 | 7082 | { |
7083 | 7083 | return $this->filter( |
7084 | - function ($item) use ($keyOrPropertyOrMethod, $value) { |
|
7084 | + function($item) use ($keyOrPropertyOrMethod, $value) { |
|
7085 | 7085 | $accessorValue = $this->extractValue( |
7086 | 7086 | $item, |
7087 | 7087 | $keyOrPropertyOrMethod |
@@ -7376,7 +7376,7 @@ discard block |
||
7376 | 7376 | protected function getPropertiesFromPhpDoc() |
7377 | 7377 | { |
7378 | 7378 | static $PROPERTY_CACHE = []; |
7379 | - $cacheKey = 'Class::' . static::class; |
|
7379 | + $cacheKey = 'Class::'.static::class; |
|
7380 | 7380 | |
7381 | 7381 | if (isset($PROPERTY_CACHE[$cacheKey])) { |
7382 | 7382 | return $PROPERTY_CACHE[$cacheKey]; |
@@ -7686,7 +7686,7 @@ discard block |
||
7686 | 7686 | if ($array === null) { |
7687 | 7687 | $array = []; |
7688 | 7688 | } elseif (!\is_array($array)) { |
7689 | - throw new \RuntimeException('Can not set value at this path "' . $key . '" because (' . \gettype($array) . ')"' . \print_r($array, true) . '" is not an array.'); |
|
7689 | + throw new \RuntimeException('Can not set value at this path "'.$key.'" because ('.\gettype($array).')"'.\print_r($array, true).'" is not an array.'); |
|
7690 | 7690 | } |
7691 | 7691 | |
7692 | 7692 | $array[$key] = $value; |
@@ -7758,7 +7758,7 @@ discard block |
||
7758 | 7758 | && |
7759 | 7759 | \count(\array_diff_key($properties, $data)) > 0 |
7760 | 7760 | ) { |
7761 | - throw new \TypeError('Property mismatch - input: ' . \print_r(\array_keys($data), true) . ' | expected: ' . \print_r(\array_keys($properties), true)); |
|
7761 | + throw new \TypeError('Property mismatch - input: '.\print_r(\array_keys($data), true).' | expected: '.\print_r(\array_keys($properties), true)); |
|
7762 | 7762 | } |
7763 | 7763 | |
7764 | 7764 | foreach ($data as $key => &$valueInner) { |
@@ -7875,7 +7875,7 @@ discard block |
||
7875 | 7875 | * |
7876 | 7876 | * @return void |
7877 | 7877 | */ |
7878 | - static function (&$item) { |
|
7878 | + static function(&$item) { |
|
7879 | 7879 | if ($item instanceof self) { |
7880 | 7880 | $item = $item->getArray(); |
7881 | 7881 | } |
@@ -7900,7 +7900,7 @@ discard block |
||
7900 | 7900 | && |
7901 | 7901 | $this->checkPropertiesMismatch === true |
7902 | 7902 | ) { |
7903 | - throw new \TypeError('The key "' . $key . '" does not exists as "@property" phpdoc. (' . \get_class($this) . ').'); |
|
7903 | + throw new \TypeError('The key "'.$key.'" does not exists as "@property" phpdoc. ('.\get_class($this).').'); |
|
7904 | 7904 | } |
7905 | 7905 | |
7906 | 7906 | if (isset($this->properties[self::ARRAYY_HELPER_TYPES_FOR_ALL_PROPERTIES])) { |