@@ -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 | |
@@ -2473,7 +2473,7 @@ discard block |
||
| 2473 | 2473 | } |
| 2474 | 2474 | |
| 2475 | 2475 | if ($flag === \ARRAY_FILTER_USE_KEY) { |
| 2476 | - $generator = function () use ($closure) { |
|
| 2476 | + $generator = function() use ($closure) { |
|
| 2477 | 2477 | foreach ($this->getGenerator() as $key => $value) { |
| 2478 | 2478 | if ($closure($key) === true) { |
| 2479 | 2479 | yield $key => $value; |
@@ -2485,7 +2485,7 @@ discard block |
||
| 2485 | 2485 | /** @phpstan-var \Closure(T=,TKey=):bool $closure */ |
| 2486 | 2486 | $closure = $closure; |
| 2487 | 2487 | |
| 2488 | - $generator = function () use ($closure) { |
|
| 2488 | + $generator = function() use ($closure) { |
|
| 2489 | 2489 | foreach ($this->getGenerator() as $key => $value) { |
| 2490 | 2490 | if ($closure($value, $key) === true) { |
| 2491 | 2491 | yield $key => $value; |
@@ -2493,7 +2493,7 @@ discard block |
||
| 2493 | 2493 | } |
| 2494 | 2494 | }; |
| 2495 | 2495 | } else { |
| 2496 | - $generator = function () use ($closure) { |
|
| 2496 | + $generator = function() use ($closure) { |
|
| 2497 | 2497 | foreach ($this->getGenerator() as $key => $value) { |
| 2498 | 2498 | if ($closure($value) === true) { |
| 2499 | 2499 | yield $key => $value; |
@@ -2549,40 +2549,40 @@ discard block |
||
| 2549 | 2549 | } |
| 2550 | 2550 | |
| 2551 | 2551 | $ops = [ |
| 2552 | - 'eq' => static function ($item, $prop, $value): bool { |
|
| 2552 | + 'eq' => static function($item, $prop, $value): bool { |
|
| 2553 | 2553 | return $item[$prop] === $value; |
| 2554 | 2554 | }, |
| 2555 | - 'gt' => static function ($item, $prop, $value): bool { |
|
| 2555 | + 'gt' => static function($item, $prop, $value): bool { |
|
| 2556 | 2556 | return $item[$prop] > $value; |
| 2557 | 2557 | }, |
| 2558 | - 'ge' => static function ($item, $prop, $value): bool { |
|
| 2558 | + 'ge' => static function($item, $prop, $value): bool { |
|
| 2559 | 2559 | return $item[$prop] >= $value; |
| 2560 | 2560 | }, |
| 2561 | - 'gte' => static function ($item, $prop, $value): bool { |
|
| 2561 | + 'gte' => static function($item, $prop, $value): bool { |
|
| 2562 | 2562 | return $item[$prop] >= $value; |
| 2563 | 2563 | }, |
| 2564 | - 'lt' => static function ($item, $prop, $value): bool { |
|
| 2564 | + 'lt' => static function($item, $prop, $value): bool { |
|
| 2565 | 2565 | return $item[$prop] < $value; |
| 2566 | 2566 | }, |
| 2567 | - 'le' => static function ($item, $prop, $value): bool { |
|
| 2567 | + 'le' => static function($item, $prop, $value): bool { |
|
| 2568 | 2568 | return $item[$prop] <= $value; |
| 2569 | 2569 | }, |
| 2570 | - 'lte' => static function ($item, $prop, $value): bool { |
|
| 2570 | + 'lte' => static function($item, $prop, $value): bool { |
|
| 2571 | 2571 | return $item[$prop] <= $value; |
| 2572 | 2572 | }, |
| 2573 | - 'ne' => static function ($item, $prop, $value): bool { |
|
| 2573 | + 'ne' => static function($item, $prop, $value): bool { |
|
| 2574 | 2574 | return $item[$prop] !== $value; |
| 2575 | 2575 | }, |
| 2576 | - 'contains' => static function ($item, $prop, $value): bool { |
|
| 2576 | + 'contains' => static function($item, $prop, $value): bool { |
|
| 2577 | 2577 | return \in_array($item[$prop], (array) $value, true); |
| 2578 | 2578 | }, |
| 2579 | - 'notContains' => static function ($item, $prop, $value): bool { |
|
| 2579 | + 'notContains' => static function($item, $prop, $value): bool { |
|
| 2580 | 2580 | return !\in_array($item[$prop], (array) $value, true); |
| 2581 | 2581 | }, |
| 2582 | - 'newer' => static function ($item, $prop, $value): bool { |
|
| 2582 | + 'newer' => static function($item, $prop, $value): bool { |
|
| 2583 | 2583 | return \strtotime($item[$prop]) > \strtotime($value); |
| 2584 | 2584 | }, |
| 2585 | - 'older' => static function ($item, $prop, $value): bool { |
|
| 2585 | + 'older' => static function($item, $prop, $value): bool { |
|
| 2586 | 2586 | return \strtotime($item[$prop]) < \strtotime($value); |
| 2587 | 2587 | }, |
| 2588 | 2588 | ]; |
@@ -2590,7 +2590,7 @@ discard block |
||
| 2590 | 2590 | $result = \array_values( |
| 2591 | 2591 | \array_filter( |
| 2592 | 2592 | $this->toArray(false, true), |
| 2593 | - static function ($item) use ( |
|
| 2593 | + static function($item) use ( |
|
| 2594 | 2594 | $property, |
| 2595 | 2595 | $value, |
| 2596 | 2596 | $ops, |
@@ -2812,7 +2812,7 @@ discard block |
||
| 2812 | 2812 | */ |
| 2813 | 2813 | public function flip(): self |
| 2814 | 2814 | { |
| 2815 | - $generator = function (): \Generator { |
|
| 2815 | + $generator = function(): \Generator { |
|
| 2816 | 2816 | foreach ($this->getGenerator() as $key => $value) { |
| 2817 | 2817 | yield (string) $value => $key; |
| 2818 | 2818 | } |
@@ -3083,9 +3083,9 @@ discard block |
||
| 3083 | 3083 | $jsonObject = \json_decode($json, false); |
| 3084 | 3084 | |
| 3085 | 3085 | $mapper = new \Arrayy\Mapper\Json(); |
| 3086 | - $mapper->undefinedPropertyHandler = static function ($object, $key, $jsonValue) use ($class) { |
|
| 3086 | + $mapper->undefinedPropertyHandler = static function($object, $key, $jsonValue) use ($class) { |
|
| 3087 | 3087 | if ($class->checkPropertiesMismatchInConstructor) { |
| 3088 | - throw new \TypeError('Property mismatch - input: ' . \print_r(['key' => $key, 'jsonValue' => $jsonValue], true) . ' for object: ' . \get_class($object)); |
|
| 3088 | + throw new \TypeError('Property mismatch - input: '.\print_r(['key' => $key, 'jsonValue' => $jsonValue], true).' for object: '.\get_class($object)); |
|
| 3089 | 3089 | } |
| 3090 | 3090 | }; |
| 3091 | 3091 | |
@@ -3150,13 +3150,13 @@ discard block |
||
| 3150 | 3150 | public function getColumn($columnKey = null, $indexKey = null): self |
| 3151 | 3151 | { |
| 3152 | 3152 | if ($columnKey === null && $indexKey === null) { |
| 3153 | - $generator = function () { |
|
| 3153 | + $generator = function() { |
|
| 3154 | 3154 | foreach ($this->getGenerator() as $key => $value) { |
| 3155 | 3155 | yield $value; |
| 3156 | 3156 | } |
| 3157 | 3157 | }; |
| 3158 | 3158 | } else { |
| 3159 | - $generator = function () use ($columnKey, $indexKey) { |
|
| 3159 | + $generator = function() use ($columnKey, $indexKey) { |
|
| 3160 | 3160 | foreach ($this->getGenerator() as $key => $value) { |
| 3161 | 3161 | // reset |
| 3162 | 3162 | $newKey = null; |
@@ -3456,7 +3456,7 @@ discard block |
||
| 3456 | 3456 | |
| 3457 | 3457 | if ($UN_FOUND === null) { |
| 3458 | 3458 | // Generate unique string to use as marker. |
| 3459 | - $UN_FOUND = 'arrayy--' . \uniqid('arrayy', true); |
|
| 3459 | + $UN_FOUND = 'arrayy--'.\uniqid('arrayy', true); |
|
| 3460 | 3460 | } |
| 3461 | 3461 | |
| 3462 | 3462 | if (\is_array($key)) { |
@@ -3506,7 +3506,7 @@ discard block |
||
| 3506 | 3506 | */ |
| 3507 | 3507 | public function implode(string $glue = '', string $prefix = ''): string |
| 3508 | 3508 | { |
| 3509 | - return $prefix . $this->implode_recursive($glue, $this->toArray(), false); |
|
| 3509 | + return $prefix.$this->implode_recursive($glue, $this->toArray(), false); |
|
| 3510 | 3510 | } |
| 3511 | 3511 | |
| 3512 | 3512 | /** |
@@ -3615,7 +3615,7 @@ discard block |
||
| 3615 | 3615 | \array_uintersect( |
| 3616 | 3616 | $this->toArray(), |
| 3617 | 3617 | $search, |
| 3618 | - static function ($a, $b) { |
|
| 3618 | + static function($a, $b) { |
|
| 3619 | 3619 | return $a === $b ? 0 : -1; |
| 3620 | 3620 | } |
| 3621 | 3621 | ), |
@@ -3963,13 +3963,13 @@ discard block |
||
| 3963 | 3963 | // non recursive |
| 3964 | 3964 | |
| 3965 | 3965 | if ($search_values === null) { |
| 3966 | - $arrayFunction = function (): \Generator { |
|
| 3966 | + $arrayFunction = function(): \Generator { |
|
| 3967 | 3967 | foreach ($this->getGenerator() as $key => $value) { |
| 3968 | 3968 | yield $key; |
| 3969 | 3969 | } |
| 3970 | 3970 | }; |
| 3971 | 3971 | } else { |
| 3972 | - $arrayFunction = function () use ($search_values, $strict): \Generator { |
|
| 3972 | + $arrayFunction = function() use ($search_values, $strict): \Generator { |
|
| 3973 | 3973 | $is_array_tmp = \is_array($search_values); |
| 3974 | 3974 | |
| 3975 | 3975 | /** @noinspection PhpParameterByRefIsNotUsedAsReferenceInspection */ |
@@ -4218,7 +4218,7 @@ discard block |
||
| 4218 | 4218 | $useArguments = \func_num_args() > 2; |
| 4219 | 4219 | |
| 4220 | 4220 | return static::create( |
| 4221 | - function () use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
| 4221 | + function() use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
| 4222 | 4222 | foreach ($this->getGenerator() as $key => $value) { |
| 4223 | 4223 | if ($useArguments) { |
| 4224 | 4224 | if ($useKeyAsSecondParameter) { |
@@ -4719,7 +4719,7 @@ discard block |
||
| 4719 | 4719 | */ |
| 4720 | 4720 | public function nth(int $step, int $offset = 0): self |
| 4721 | 4721 | { |
| 4722 | - $arrayFunction = function () use ($step, $offset): \Generator { |
|
| 4722 | + $arrayFunction = function() use ($step, $offset): \Generator { |
|
| 4723 | 4723 | $position = 0; |
| 4724 | 4724 | foreach ($this->getGenerator() as $key => $value) { |
| 4725 | 4725 | if ($position++ % $step !== $offset) { |
@@ -4753,7 +4753,7 @@ discard block |
||
| 4753 | 4753 | { |
| 4754 | 4754 | $keys = \array_flip($keys); |
| 4755 | 4755 | |
| 4756 | - $generator = function () use ($keys): \Generator { |
|
| 4756 | + $generator = function() use ($keys): \Generator { |
|
| 4757 | 4757 | foreach ($this->getGenerator() as $key => $value) { |
| 4758 | 4758 | if (isset($keys[$key])) { |
| 4759 | 4759 | yield $key => $value; |
@@ -4890,7 +4890,7 @@ discard block |
||
| 4890 | 4890 | */ |
| 4891 | 4891 | public function prependImmutable($value, $key = null) |
| 4892 | 4892 | { |
| 4893 | - $generator = function () use ($key, $value): \Generator { |
|
| 4893 | + $generator = function() use ($key, $value): \Generator { |
|
| 4894 | 4894 | if ($this->properties !== []) { |
| 4895 | 4895 | $this->checkType($key, $value); |
| 4896 | 4896 | } |
@@ -4941,7 +4941,7 @@ discard block |
||
| 4941 | 4941 | )->prependToEachKey($suffix) |
| 4942 | 4942 | ->toArray(); |
| 4943 | 4943 | } else { |
| 4944 | - $result[$key . $suffix] = $item; |
|
| 4944 | + $result[$key.$suffix] = $item; |
|
| 4945 | 4945 | } |
| 4946 | 4946 | } |
| 4947 | 4947 | |
@@ -4981,7 +4981,7 @@ discard block |
||
| 4981 | 4981 | } elseif (\is_object($item) === true) { |
| 4982 | 4982 | $result[$key] = $item; |
| 4983 | 4983 | } else { |
| 4984 | - $result[$key] = $item . $suffix; |
|
| 4984 | + $result[$key] = $item.$suffix; |
|
| 4985 | 4985 | } |
| 4986 | 4986 | } |
| 4987 | 4987 | |
@@ -5787,7 +5787,7 @@ discard block |
||
| 5787 | 5787 | */ |
| 5788 | 5788 | public function replaceValues($search, $replacement = ''): self |
| 5789 | 5789 | { |
| 5790 | - $function = static function ($value) use ($search, $replacement) { |
|
| 5790 | + $function = static function($value) use ($search, $replacement) { |
|
| 5791 | 5791 | return \str_replace($search, $replacement, $value); |
| 5792 | 5792 | }; |
| 5793 | 5793 | |
@@ -6477,7 +6477,7 @@ discard block |
||
| 6477 | 6477 | * @psalm-suppress MissingClosureParamType |
| 6478 | 6478 | */ |
| 6479 | 6479 | $results = $arrayy->each( |
| 6480 | - static function ($value) use ($sorter) { |
|
| 6480 | + static function($value) use ($sorter) { |
|
| 6481 | 6481 | if (\is_callable($sorter) === true) { |
| 6482 | 6482 | return $sorter($value); |
| 6483 | 6483 | } |
@@ -6550,7 +6550,7 @@ discard block |
||
| 6550 | 6550 | public function split(int $numberOfPieces = 2, bool $keepKeys = false): self |
| 6551 | 6551 | { |
| 6552 | 6552 | if ($keepKeys) { |
| 6553 | - $generator = function () use ($numberOfPieces) { |
|
| 6553 | + $generator = function() use ($numberOfPieces) { |
|
| 6554 | 6554 | $carry = []; |
| 6555 | 6555 | $i = 1; |
| 6556 | 6556 | foreach ($this->getGenerator() as $key => $value) { |
@@ -6573,7 +6573,7 @@ discard block |
||
| 6573 | 6573 | } |
| 6574 | 6574 | }; |
| 6575 | 6575 | } else { |
| 6576 | - $generator = function () use ($numberOfPieces) { |
|
| 6576 | + $generator = function() use ($numberOfPieces) { |
|
| 6577 | 6577 | $carry = []; |
| 6578 | 6578 | $i = 1; |
| 6579 | 6579 | foreach ($this->getGenerator() as $key => $value) { |
@@ -6620,7 +6620,7 @@ discard block |
||
| 6620 | 6620 | public function stripEmpty(): self |
| 6621 | 6621 | { |
| 6622 | 6622 | return $this->filter( |
| 6623 | - static function ($item) { |
|
| 6623 | + static function($item) { |
|
| 6624 | 6624 | if ($item === null) { |
| 6625 | 6625 | return false; |
| 6626 | 6626 | } |
@@ -6820,7 +6820,7 @@ discard block |
||
| 6820 | 6820 | // INFO: \array_unique() can't handle e.g. "stdClass"-values in an array |
| 6821 | 6821 | |
| 6822 | 6822 | $this->array = $this->reduce( |
| 6823 | - static function ($resultArray, $value, $key) { |
|
| 6823 | + static function($resultArray, $value, $key) { |
|
| 6824 | 6824 | if (!\in_array($value, $resultArray, true)) { |
| 6825 | 6825 | $resultArray[] = $value; |
| 6826 | 6826 | } |
@@ -6859,7 +6859,7 @@ discard block |
||
| 6859 | 6859 | */ |
| 6860 | 6860 | $this->array = \array_reduce( |
| 6861 | 6861 | \array_keys($array), |
| 6862 | - static function ($resultArray, $key) use ($array) { |
|
| 6862 | + static function($resultArray, $key) use ($array) { |
|
| 6863 | 6863 | if (!\in_array($array[$key], $resultArray, true)) { |
| 6864 | 6864 | $resultArray[$key] = $array[$key]; |
| 6865 | 6865 | } |
@@ -6956,7 +6956,7 @@ discard block |
||
| 6956 | 6956 | public function values(): self |
| 6957 | 6957 | { |
| 6958 | 6958 | return static::create( |
| 6959 | - function () { |
|
| 6959 | + function() { |
|
| 6960 | 6960 | /** @noinspection YieldFromCanBeUsedInspection */ |
| 6961 | 6961 | foreach ($this->getGenerator() as $value) { |
| 6962 | 6962 | yield $value; |
@@ -7032,7 +7032,7 @@ discard block |
||
| 7032 | 7032 | public function where(string $keyOrPropertyOrMethod, $value): self |
| 7033 | 7033 | { |
| 7034 | 7034 | return $this->filter( |
| 7035 | - function ($item) use ($keyOrPropertyOrMethod, $value) { |
|
| 7035 | + function($item) use ($keyOrPropertyOrMethod, $value) { |
|
| 7036 | 7036 | $accessorValue = $this->extractValue( |
| 7037 | 7037 | $item, |
| 7038 | 7038 | $keyOrPropertyOrMethod |
@@ -7322,7 +7322,7 @@ discard block |
||
| 7322 | 7322 | protected function getPropertiesFromPhpDoc() |
| 7323 | 7323 | { |
| 7324 | 7324 | static $PROPERTY_CACHE = []; |
| 7325 | - $cacheKey = 'Class::' . static::class; |
|
| 7325 | + $cacheKey = 'Class::'.static::class; |
|
| 7326 | 7326 | |
| 7327 | 7327 | if (isset($PROPERTY_CACHE[$cacheKey])) { |
| 7328 | 7328 | return $PROPERTY_CACHE[$cacheKey]; |
@@ -7632,7 +7632,7 @@ discard block |
||
| 7632 | 7632 | if ($array === null) { |
| 7633 | 7633 | $array = []; |
| 7634 | 7634 | } elseif (!\is_array($array)) { |
| 7635 | - throw new \RuntimeException('Can not set value at this path "' . $key . '" because (' . \gettype($array) . ')"' . \print_r($array, true) . '" is not an array.'); |
|
| 7635 | + throw new \RuntimeException('Can not set value at this path "'.$key.'" because ('.\gettype($array).')"'.\print_r($array, true).'" is not an array.'); |
|
| 7636 | 7636 | } |
| 7637 | 7637 | |
| 7638 | 7638 | $array[$key] = $value; |
@@ -7704,7 +7704,7 @@ discard block |
||
| 7704 | 7704 | && |
| 7705 | 7705 | \count(\array_diff_key($properties, $data)) > 0 |
| 7706 | 7706 | ) { |
| 7707 | - throw new \TypeError('Property mismatch - input: ' . \print_r(\array_keys($data), true) . ' | expected: ' . \print_r(\array_keys($properties), true)); |
|
| 7707 | + throw new \TypeError('Property mismatch - input: '.\print_r(\array_keys($data), true).' | expected: '.\print_r(\array_keys($properties), true)); |
|
| 7708 | 7708 | } |
| 7709 | 7709 | |
| 7710 | 7710 | foreach ($data as $key => &$valueInner) { |
@@ -7821,7 +7821,7 @@ discard block |
||
| 7821 | 7821 | * |
| 7822 | 7822 | * @return void |
| 7823 | 7823 | */ |
| 7824 | - static function (&$item) { |
|
| 7824 | + static function(&$item) { |
|
| 7825 | 7825 | if ($item instanceof self) { |
| 7826 | 7826 | $item = $item->getArray(); |
| 7827 | 7827 | } |
@@ -7846,7 +7846,7 @@ discard block |
||
| 7846 | 7846 | && |
| 7847 | 7847 | $this->checkPropertiesMismatch === true |
| 7848 | 7848 | ) { |
| 7849 | - throw new \TypeError('The key "' . $key . '" does not exists as "@property" phpdoc. (' . \get_class($this) . ').'); |
|
| 7849 | + throw new \TypeError('The key "'.$key.'" does not exists as "@property" phpdoc. ('.\get_class($this).').'); |
|
| 7850 | 7850 | } |
| 7851 | 7851 | |
| 7852 | 7852 | if (isset($this->properties[self::ARRAYY_HELPER_TYPES_FOR_ALL_PROPERTIES])) { |