@@ -42,7 +42,7 @@ |
||
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | if (!isset(static::$methodArgs[$name])) { |
| 45 | - throw new \BadMethodCallException($name . ' is not a valid method'); |
|
| 45 | + throw new \BadMethodCallException($name.' is not a valid method'); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | $numArgs = \count($arguments); |
@@ -90,9 +90,9 @@ discard block |
||
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | if ($type instanceof \phpDocumentor\Reflection\Types\Array_) { |
| 93 | - $valueTypeTmp = $type->getValueType() . ''; |
|
| 93 | + $valueTypeTmp = $type->getValueType().''; |
|
| 94 | 94 | if ($valueTypeTmp !== 'mixed') { |
| 95 | - return $valueTypeTmp . '[]'; |
|
| 95 | + return $valueTypeTmp.'[]'; |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | return 'array'; |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | return 'resource'; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - return $type . ''; |
|
| 141 | + return $type.''; |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | /** |
@@ -150,6 +150,6 @@ discard block |
||
| 150 | 150 | */ |
| 151 | 151 | public function throwException($expectedTypes, $value, $type): \Throwable |
| 152 | 152 | { |
| 153 | - throw new \TypeError("Invalid type: expected \"{$this->property_name}\" to be of type {{$expectedTypes}}, instead got value \"" . $this->valueToString($value) . '" (' . \print_r($value, true) . ") with type {{$type}}."); |
|
| 153 | + throw new \TypeError("Invalid type: expected \"{$this->property_name}\" to be of type {{$expectedTypes}}, instead got value \"".$this->valueToString($value).'" ('.\print_r($value, true).") with type {{$type}}."); |
|
| 154 | 154 | } |
| 155 | 155 | } |
@@ -111,11 +111,11 @@ |
||
| 111 | 111 | |
| 112 | 112 | // resource |
| 113 | 113 | if (\is_resource($value)) { |
| 114 | - return \get_resource_type($value) . ' resource #' . (int) $value; |
|
| 114 | + return \get_resource_type($value).' resource #'.(int) $value; |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | if (\is_object($value)) { |
| 118 | - return \get_class($value) . ' Object'; |
|
| 118 | + return \get_class($value).' Object'; |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | return ''; |
@@ -82,32 +82,32 @@ |
||
| 82 | 82 | \gettype($value) === (self::$typeMapping[$type] ?? $type) |
| 83 | 83 | || |
| 84 | 84 | ( |
| 85 | - $type === 'scalar' |
|
| 85 | + $type === 'scalar' |
|
| 86 | 86 | && |
| 87 | 87 | \is_scalar($value) |
| 88 | - ) |
|
| 88 | + ) |
|
| 89 | 89 | || |
| 90 | 90 | ( |
| 91 | - $type === 'callable' |
|
| 91 | + $type === 'callable' |
|
| 92 | 92 | && |
| 93 | 93 | \is_callable($value) |
| 94 | - ) |
|
| 94 | + ) |
|
| 95 | 95 | || |
| 96 | 96 | ( |
| 97 | - $type === 'numeric' |
|
| 97 | + $type === 'numeric' |
|
| 98 | 98 | && |
| 99 | 99 | ( |
| 100 | - \is_float($value) |
|
| 100 | + \is_float($value) |
|
| 101 | 101 | || |
| 102 | 102 | \is_int($value) |
| 103 | - ) |
|
| 104 | - ) |
|
| 103 | + ) |
|
| 104 | + ) |
|
| 105 | 105 | || |
| 106 | 106 | ( |
| 107 | - $type === 'resource' |
|
| 107 | + $type === 'resource' |
|
| 108 | 108 | && |
| 109 | 109 | \is_resource($value) |
| 110 | - ); |
|
| 110 | + ); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | /** |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | public function throwException($expectedTypes, $value, $type): \Throwable |
| 28 | 28 | { |
| 29 | - throw new \TypeError("Invalid type: expected to be of type {{$expectedTypes}}, instead got value `" . \print_r($value, true) . "` with type {{$type}}."); |
|
| 29 | + throw new \TypeError("Invalid type: expected to be of type {{$expectedTypes}}, instead got value `".\print_r($value, true)."` with type {{$type}}."); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | /** |
@@ -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); |
|
@@ -1542,11 +1542,11 @@ |
||
| 1542 | 1542 | ), |
| 1543 | 1543 | \COUNT_NORMAL |
| 1544 | 1544 | ) |
| 1545 | - === |
|
| 1546 | - \count( |
|
| 1547 | - $needles, |
|
| 1548 | - \COUNT_NORMAL |
|
| 1549 | - ); |
|
| 1545 | + === |
|
| 1546 | + \count( |
|
| 1547 | + $needles, |
|
| 1548 | + \COUNT_NORMAL |
|
| 1549 | + ); |
|
| 1550 | 1550 | } |
| 1551 | 1551 | |
| 1552 | 1552 | /** |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | */ |
| 308 | 308 | public function appendImmutable($value, $key = null): self |
| 309 | 309 | { |
| 310 | - $generator = function () use ($key, $value): \Generator { |
|
| 310 | + $generator = function() use ($key, $value): \Generator { |
|
| 311 | 311 | if ($this->properties !== []) { |
| 312 | 312 | $this->checkType($key, $value); |
| 313 | 313 | } |
@@ -689,7 +689,7 @@ discard block |
||
| 689 | 689 | */ |
| 690 | 690 | $this->callAtPath( |
| 691 | 691 | $containerPath, |
| 692 | - static function ($container) use ($lastOffset, &$offsetExists) { |
|
| 692 | + static function($container) use ($lastOffset, &$offsetExists) { |
|
| 693 | 693 | $offsetExists = \array_key_exists($lastOffset, $container); |
| 694 | 694 | } |
| 695 | 695 | ); |
@@ -792,7 +792,7 @@ discard block |
||
| 792 | 792 | */ |
| 793 | 793 | $this->callAtPath( |
| 794 | 794 | \implode($this->pathSeparator, $path), |
| 795 | - static function (&$offset) use ($pathToUnset) { |
|
| 795 | + static function(&$offset) use ($pathToUnset) { |
|
| 796 | 796 | if (\is_array($offset)) { |
| 797 | 797 | unset($offset[$pathToUnset]); |
| 798 | 798 | } else { |
@@ -846,7 +846,7 @@ discard block |
||
| 846 | 846 | } |
| 847 | 847 | |
| 848 | 848 | if (\strpos($iteratorClass, '\\') === 0) { |
| 849 | - $iteratorClass = '\\' . $iteratorClass; |
|
| 849 | + $iteratorClass = '\\'.$iteratorClass; |
|
| 850 | 850 | if (\class_exists($iteratorClass)) { |
| 851 | 851 | /** |
| 852 | 852 | * @psalm-suppress PropertyTypeCoercion |
@@ -857,7 +857,7 @@ discard block |
||
| 857 | 857 | } |
| 858 | 858 | } |
| 859 | 859 | |
| 860 | - throw new \InvalidArgumentException('The iterator class does not exist: ' . $iteratorClass); |
|
| 860 | + throw new \InvalidArgumentException('The iterator class does not exist: '.$iteratorClass); |
|
| 861 | 861 | } |
| 862 | 862 | |
| 863 | 863 | /** |
@@ -1032,13 +1032,13 @@ discard block |
||
| 1032 | 1032 | |
| 1033 | 1033 | foreach ($this->getGenerator() as $key => $item) { |
| 1034 | 1034 | if ($item instanceof self) { |
| 1035 | - $result[$prefix . $key] = $item->appendToEachKey($prefix); |
|
| 1035 | + $result[$prefix.$key] = $item->appendToEachKey($prefix); |
|
| 1036 | 1036 | } elseif (\is_array($item)) { |
| 1037 | - $result[$prefix . $key] = self::create($item, $this->iteratorClass, false) |
|
| 1037 | + $result[$prefix.$key] = self::create($item, $this->iteratorClass, false) |
|
| 1038 | 1038 | ->appendToEachKey($prefix) |
| 1039 | 1039 | ->toArray(); |
| 1040 | 1040 | } else { |
| 1041 | - $result[$prefix . $key] = $item; |
|
| 1041 | + $result[$prefix.$key] = $item; |
|
| 1042 | 1042 | } |
| 1043 | 1043 | } |
| 1044 | 1044 | |
@@ -1069,7 +1069,7 @@ discard block |
||
| 1069 | 1069 | } elseif (\is_object($item) === true) { |
| 1070 | 1070 | $result[$key] = $item; |
| 1071 | 1071 | } else { |
| 1072 | - $result[$key] = $prefix . $item; |
|
| 1072 | + $result[$key] = $prefix.$item; |
|
| 1073 | 1073 | } |
| 1074 | 1074 | } |
| 1075 | 1075 | |
@@ -1255,7 +1255,7 @@ discard block |
||
| 1255 | 1255 | public function chunk($size, $preserveKeys = false): self |
| 1256 | 1256 | { |
| 1257 | 1257 | if ($preserveKeys) { |
| 1258 | - $generator = function () use ($size) { |
|
| 1258 | + $generator = function() use ($size) { |
|
| 1259 | 1259 | $values = []; |
| 1260 | 1260 | $tmpCounter = 0; |
| 1261 | 1261 | foreach ($this->getGenerator() as $key => $value) { |
@@ -1275,7 +1275,7 @@ discard block |
||
| 1275 | 1275 | } |
| 1276 | 1276 | }; |
| 1277 | 1277 | } else { |
| 1278 | - $generator = function () use ($size) { |
|
| 1278 | + $generator = function() use ($size) { |
|
| 1279 | 1279 | $values = []; |
| 1280 | 1280 | $tmpCounter = 0; |
| 1281 | 1281 | foreach ($this->getGenerator() as $key => $value) { |
@@ -1319,7 +1319,7 @@ discard block |
||
| 1319 | 1319 | public function clean(): self |
| 1320 | 1320 | { |
| 1321 | 1321 | return $this->filter( |
| 1322 | - static function ($value) { |
|
| 1322 | + static function($value) { |
|
| 1323 | 1323 | return (bool) $value; |
| 1324 | 1324 | } |
| 1325 | 1325 | ); |
@@ -1657,9 +1657,9 @@ discard block |
||
| 1657 | 1657 | |
| 1658 | 1658 | foreach ($items as $key => $value) { |
| 1659 | 1659 | if (\is_array($value) && $value !== []) { |
| 1660 | - $flatten[] = $this->flatten($delimiter, $prepend . $key . $delimiter, $value); |
|
| 1660 | + $flatten[] = $this->flatten($delimiter, $prepend.$key.$delimiter, $value); |
|
| 1661 | 1661 | } else { |
| 1662 | - $flatten[] = [$prepend . $key => $value]; |
|
| 1662 | + $flatten[] = [$prepend.$key => $value]; |
|
| 1663 | 1663 | } |
| 1664 | 1664 | } |
| 1665 | 1665 | |
@@ -1837,7 +1837,7 @@ discard block |
||
| 1837 | 1837 | */ |
| 1838 | 1838 | \array_walk( |
| 1839 | 1839 | $array, |
| 1840 | - static function (&$val) { |
|
| 1840 | + static function(&$val) { |
|
| 1841 | 1841 | if ((string) $val === $val) { |
| 1842 | 1842 | $val = \trim($val); |
| 1843 | 1843 | } |
@@ -2059,7 +2059,7 @@ discard block |
||
| 2059 | 2059 | $array = $array[0]; |
| 2060 | 2060 | } |
| 2061 | 2061 | |
| 2062 | - $generator = function () use ($array): \Generator { |
|
| 2062 | + $generator = function() use ($array): \Generator { |
|
| 2063 | 2063 | foreach ($this->getGenerator() as $key => $value) { |
| 2064 | 2064 | if (\in_array($value, $array, true) === false) { |
| 2065 | 2065 | yield $key => $value; |
@@ -2094,7 +2094,7 @@ discard block |
||
| 2094 | 2094 | $array = $array[0]; |
| 2095 | 2095 | } |
| 2096 | 2096 | |
| 2097 | - $generator = function () use ($array): \Generator { |
|
| 2097 | + $generator = function() use ($array): \Generator { |
|
| 2098 | 2098 | foreach ($this->getGenerator() as $key => $value) { |
| 2099 | 2099 | if (\array_key_exists($key, $array) === false) { |
| 2100 | 2100 | yield $key => $value; |
@@ -2397,7 +2397,7 @@ discard block |
||
| 2397 | 2397 | } |
| 2398 | 2398 | |
| 2399 | 2399 | if ($flag === \ARRAY_FILTER_USE_KEY) { |
| 2400 | - $generator = function () use ($closure) { |
|
| 2400 | + $generator = function() use ($closure) { |
|
| 2401 | 2401 | foreach ($this->getGenerator() as $key => $value) { |
| 2402 | 2402 | if ($closure($key) === true) { |
| 2403 | 2403 | yield $key => $value; |
@@ -2405,7 +2405,7 @@ discard block |
||
| 2405 | 2405 | } |
| 2406 | 2406 | }; |
| 2407 | 2407 | } elseif ($flag === \ARRAY_FILTER_USE_BOTH) { |
| 2408 | - $generator = function () use ($closure) { |
|
| 2408 | + $generator = function() use ($closure) { |
|
| 2409 | 2409 | foreach ($this->getGenerator() as $key => $value) { |
| 2410 | 2410 | if ($closure($value, $key) === true) { |
| 2411 | 2411 | yield $key => $value; |
@@ -2413,7 +2413,7 @@ discard block |
||
| 2413 | 2413 | } |
| 2414 | 2414 | }; |
| 2415 | 2415 | } else { |
| 2416 | - $generator = function () use ($closure) { |
|
| 2416 | + $generator = function() use ($closure) { |
|
| 2417 | 2417 | foreach ($this->getGenerator() as $key => $value) { |
| 2418 | 2418 | if ($closure($value) === true) { |
| 2419 | 2419 | yield $key => $value; |
@@ -2469,40 +2469,40 @@ discard block |
||
| 2469 | 2469 | } |
| 2470 | 2470 | |
| 2471 | 2471 | $ops = [ |
| 2472 | - 'eq' => static function ($item, $prop, $value): bool { |
|
| 2472 | + 'eq' => static function($item, $prop, $value): bool { |
|
| 2473 | 2473 | return $item[$prop] === $value; |
| 2474 | 2474 | }, |
| 2475 | - 'gt' => static function ($item, $prop, $value): bool { |
|
| 2475 | + 'gt' => static function($item, $prop, $value): bool { |
|
| 2476 | 2476 | return $item[$prop] > $value; |
| 2477 | 2477 | }, |
| 2478 | - 'ge' => static function ($item, $prop, $value): bool { |
|
| 2478 | + 'ge' => static function($item, $prop, $value): bool { |
|
| 2479 | 2479 | return $item[$prop] >= $value; |
| 2480 | 2480 | }, |
| 2481 | - 'gte' => static function ($item, $prop, $value): bool { |
|
| 2481 | + 'gte' => static function($item, $prop, $value): bool { |
|
| 2482 | 2482 | return $item[$prop] >= $value; |
| 2483 | 2483 | }, |
| 2484 | - 'lt' => static function ($item, $prop, $value): bool { |
|
| 2484 | + 'lt' => static function($item, $prop, $value): bool { |
|
| 2485 | 2485 | return $item[$prop] < $value; |
| 2486 | 2486 | }, |
| 2487 | - 'le' => static function ($item, $prop, $value): bool { |
|
| 2487 | + 'le' => static function($item, $prop, $value): bool { |
|
| 2488 | 2488 | return $item[$prop] <= $value; |
| 2489 | 2489 | }, |
| 2490 | - 'lte' => static function ($item, $prop, $value): bool { |
|
| 2490 | + 'lte' => static function($item, $prop, $value): bool { |
|
| 2491 | 2491 | return $item[$prop] <= $value; |
| 2492 | 2492 | }, |
| 2493 | - 'ne' => static function ($item, $prop, $value): bool { |
|
| 2493 | + 'ne' => static function($item, $prop, $value): bool { |
|
| 2494 | 2494 | return $item[$prop] !== $value; |
| 2495 | 2495 | }, |
| 2496 | - 'contains' => static function ($item, $prop, $value): bool { |
|
| 2496 | + 'contains' => static function($item, $prop, $value): bool { |
|
| 2497 | 2497 | return \in_array($item[$prop], (array) $value, true); |
| 2498 | 2498 | }, |
| 2499 | - 'notContains' => static function ($item, $prop, $value): bool { |
|
| 2499 | + 'notContains' => static function($item, $prop, $value): bool { |
|
| 2500 | 2500 | return !\in_array($item[$prop], (array) $value, true); |
| 2501 | 2501 | }, |
| 2502 | - 'newer' => static function ($item, $prop, $value): bool { |
|
| 2502 | + 'newer' => static function($item, $prop, $value): bool { |
|
| 2503 | 2503 | return \strtotime($item[$prop]) > \strtotime($value); |
| 2504 | 2504 | }, |
| 2505 | - 'older' => static function ($item, $prop, $value): bool { |
|
| 2505 | + 'older' => static function($item, $prop, $value): bool { |
|
| 2506 | 2506 | return \strtotime($item[$prop]) < \strtotime($value); |
| 2507 | 2507 | }, |
| 2508 | 2508 | ]; |
@@ -2510,7 +2510,7 @@ discard block |
||
| 2510 | 2510 | $result = \array_values( |
| 2511 | 2511 | \array_filter( |
| 2512 | 2512 | $this->toArray(false, true), |
| 2513 | - static function ($item) use ( |
|
| 2513 | + static function($item) use ( |
|
| 2514 | 2514 | $property, |
| 2515 | 2515 | $value, |
| 2516 | 2516 | $ops, |
@@ -2725,7 +2725,7 @@ discard block |
||
| 2725 | 2725 | */ |
| 2726 | 2726 | public function flip(): self |
| 2727 | 2727 | { |
| 2728 | - $generator = function (): \Generator { |
|
| 2728 | + $generator = function(): \Generator { |
|
| 2729 | 2729 | foreach ($this->getGenerator() as $key => $value) { |
| 2730 | 2730 | yield (string) $value => $key; |
| 2731 | 2731 | } |
@@ -2986,9 +2986,9 @@ discard block |
||
| 2986 | 2986 | $jsonObject = \json_decode($json, false); |
| 2987 | 2987 | |
| 2988 | 2988 | $mapper = new \Arrayy\Mapper\Json(); |
| 2989 | - $mapper->undefinedPropertyHandler = static function ($object, $key, $jsonValue) use ($class) { |
|
| 2989 | + $mapper->undefinedPropertyHandler = static function($object, $key, $jsonValue) use ($class) { |
|
| 2990 | 2990 | if ($class->checkPropertiesMismatchInConstructor) { |
| 2991 | - throw new \TypeError('Property mismatch - input: ' . \print_r(['key' => $key, 'jsonValue' => $jsonValue], true) . ' for object: ' . \get_class($object)); |
|
| 2991 | + throw new \TypeError('Property mismatch - input: '.\print_r(['key' => $key, 'jsonValue' => $jsonValue], true).' for object: '.\get_class($object)); |
|
| 2992 | 2992 | } |
| 2993 | 2993 | }; |
| 2994 | 2994 | |
@@ -3053,13 +3053,13 @@ discard block |
||
| 3053 | 3053 | public function getColumn($columnKey = null, $indexKey = null): self |
| 3054 | 3054 | { |
| 3055 | 3055 | if ($columnKey === null && $indexKey === null) { |
| 3056 | - $generator = function () { |
|
| 3056 | + $generator = function() { |
|
| 3057 | 3057 | foreach ($this->getGenerator() as $key => $value) { |
| 3058 | 3058 | yield $value; |
| 3059 | 3059 | } |
| 3060 | 3060 | }; |
| 3061 | 3061 | } else { |
| 3062 | - $generator = function () use ($columnKey, $indexKey) { |
|
| 3062 | + $generator = function() use ($columnKey, $indexKey) { |
|
| 3063 | 3063 | foreach ($this->getGenerator() as $key => $value) { |
| 3064 | 3064 | // reset |
| 3065 | 3065 | $newKey = null; |
@@ -3359,7 +3359,7 @@ discard block |
||
| 3359 | 3359 | |
| 3360 | 3360 | if ($UN_FOUND === null) { |
| 3361 | 3361 | // Generate unique string to use as marker. |
| 3362 | - $UN_FOUND = 'arrayy--' . \uniqid('arrayy', true); |
|
| 3362 | + $UN_FOUND = 'arrayy--'.\uniqid('arrayy', true); |
|
| 3363 | 3363 | } |
| 3364 | 3364 | |
| 3365 | 3365 | if (\is_array($key)) { |
@@ -3409,7 +3409,7 @@ discard block |
||
| 3409 | 3409 | */ |
| 3410 | 3410 | public function implode(string $glue = '', string $prefix = ''): string |
| 3411 | 3411 | { |
| 3412 | - return $prefix . $this->implode_recursive($glue, $this->toArray(), false); |
|
| 3412 | + return $prefix.$this->implode_recursive($glue, $this->toArray(), false); |
|
| 3413 | 3413 | } |
| 3414 | 3414 | |
| 3415 | 3415 | /** |
@@ -3518,7 +3518,7 @@ discard block |
||
| 3518 | 3518 | \array_uintersect( |
| 3519 | 3519 | $this->toArray(), |
| 3520 | 3520 | $search, |
| 3521 | - static function ($a, $b) { |
|
| 3521 | + static function($a, $b) { |
|
| 3522 | 3522 | return $a === $b ? 0 : -1; |
| 3523 | 3523 | } |
| 3524 | 3524 | ), |
@@ -3862,13 +3862,13 @@ discard block |
||
| 3862 | 3862 | // non recursive |
| 3863 | 3863 | |
| 3864 | 3864 | if ($search_values === null) { |
| 3865 | - $arrayFunction = function (): \Generator { |
|
| 3865 | + $arrayFunction = function(): \Generator { |
|
| 3866 | 3866 | foreach ($this->getGenerator() as $key => $value) { |
| 3867 | 3867 | yield $key; |
| 3868 | 3868 | } |
| 3869 | 3869 | }; |
| 3870 | 3870 | } else { |
| 3871 | - $arrayFunction = function () use ($search_values, $strict): \Generator { |
|
| 3871 | + $arrayFunction = function() use ($search_values, $strict): \Generator { |
|
| 3872 | 3872 | $is_array_tmp = \is_array($search_values); |
| 3873 | 3873 | |
| 3874 | 3874 | /** @noinspection PhpParameterByRefIsNotUsedAsReferenceInspection */ |
@@ -4112,7 +4112,7 @@ discard block |
||
| 4112 | 4112 | $useArguments = \func_num_args() > 2; |
| 4113 | 4113 | |
| 4114 | 4114 | return static::create( |
| 4115 | - function () use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
| 4115 | + function() use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
| 4116 | 4116 | foreach ($this->getGenerator() as $key => $value) { |
| 4117 | 4117 | if ($useArguments) { |
| 4118 | 4118 | if ($useKeyAsSecondParameter) { |
@@ -4599,7 +4599,7 @@ discard block |
||
| 4599 | 4599 | */ |
| 4600 | 4600 | public function nth(int $step, int $offset = 0): self |
| 4601 | 4601 | { |
| 4602 | - $arrayFunction = function () use ($step, $offset): \Generator { |
|
| 4602 | + $arrayFunction = function() use ($step, $offset): \Generator { |
|
| 4603 | 4603 | $position = 0; |
| 4604 | 4604 | foreach ($this->getGenerator() as $key => $value) { |
| 4605 | 4605 | if ($position++ % $step !== $offset) { |
@@ -4633,7 +4633,7 @@ discard block |
||
| 4633 | 4633 | { |
| 4634 | 4634 | $keys = \array_flip($keys); |
| 4635 | 4635 | |
| 4636 | - $generator = function () use ($keys): \Generator { |
|
| 4636 | + $generator = function() use ($keys): \Generator { |
|
| 4637 | 4637 | foreach ($this->getGenerator() as $key => $value) { |
| 4638 | 4638 | if (isset($keys[$key])) { |
| 4639 | 4639 | yield $key => $value; |
@@ -4763,7 +4763,7 @@ discard block |
||
| 4763 | 4763 | */ |
| 4764 | 4764 | public function prependImmutable($value, $key = null) |
| 4765 | 4765 | { |
| 4766 | - $generator = function () use ($key, $value): \Generator { |
|
| 4766 | + $generator = function() use ($key, $value): \Generator { |
|
| 4767 | 4767 | if ($this->properties !== []) { |
| 4768 | 4768 | $this->checkType($key, $value); |
| 4769 | 4769 | } |
@@ -4814,7 +4814,7 @@ discard block |
||
| 4814 | 4814 | )->prependToEachKey($suffix) |
| 4815 | 4815 | ->toArray(); |
| 4816 | 4816 | } else { |
| 4817 | - $result[$key . $suffix] = $item; |
|
| 4817 | + $result[$key.$suffix] = $item; |
|
| 4818 | 4818 | } |
| 4819 | 4819 | } |
| 4820 | 4820 | |
@@ -4854,7 +4854,7 @@ discard block |
||
| 4854 | 4854 | } elseif (\is_object($item) === true) { |
| 4855 | 4855 | $result[$key] = $item; |
| 4856 | 4856 | } else { |
| 4857 | - $result[$key] = $item . $suffix; |
|
| 4857 | + $result[$key] = $item.$suffix; |
|
| 4858 | 4858 | } |
| 4859 | 4859 | } |
| 4860 | 4860 | |
@@ -5640,7 +5640,7 @@ discard block |
||
| 5640 | 5640 | * @psalm-suppress MissingClosureParamType |
| 5641 | 5641 | */ |
| 5642 | 5642 | return $this->each( |
| 5643 | - static function ($value) use ($search, $replacement) { |
|
| 5643 | + static function($value) use ($search, $replacement) { |
|
| 5644 | 5644 | return \str_replace($search, $replacement, $value); |
| 5645 | 5645 | } |
| 5646 | 5646 | ); |
@@ -6324,7 +6324,7 @@ discard block |
||
| 6324 | 6324 | * @psalm-suppress MissingClosureParamType |
| 6325 | 6325 | */ |
| 6326 | 6326 | $results = $arrayy->each( |
| 6327 | - static function ($value) use ($sorter) { |
|
| 6327 | + static function($value) use ($sorter) { |
|
| 6328 | 6328 | if (\is_callable($sorter) === true) { |
| 6329 | 6329 | return $sorter($value); |
| 6330 | 6330 | } |
@@ -6397,7 +6397,7 @@ discard block |
||
| 6397 | 6397 | public function split(int $numberOfPieces = 2, bool $keepKeys = false): self |
| 6398 | 6398 | { |
| 6399 | 6399 | if ($keepKeys) { |
| 6400 | - $generator = function () use ($numberOfPieces) { |
|
| 6400 | + $generator = function() use ($numberOfPieces) { |
|
| 6401 | 6401 | $carry = []; |
| 6402 | 6402 | $i = 1; |
| 6403 | 6403 | foreach ($this->getGenerator() as $key => $value) { |
@@ -6420,7 +6420,7 @@ discard block |
||
| 6420 | 6420 | } |
| 6421 | 6421 | }; |
| 6422 | 6422 | } else { |
| 6423 | - $generator = function () use ($numberOfPieces) { |
|
| 6423 | + $generator = function() use ($numberOfPieces) { |
|
| 6424 | 6424 | $carry = []; |
| 6425 | 6425 | $i = 1; |
| 6426 | 6426 | foreach ($this->getGenerator() as $key => $value) { |
@@ -6467,7 +6467,7 @@ discard block |
||
| 6467 | 6467 | public function stripEmpty(): self |
| 6468 | 6468 | { |
| 6469 | 6469 | return $this->filter( |
| 6470 | - static function ($item) { |
|
| 6470 | + static function($item) { |
|
| 6471 | 6471 | if ($item === null) { |
| 6472 | 6472 | return false; |
| 6473 | 6473 | } |
@@ -6670,7 +6670,7 @@ discard block |
||
| 6670 | 6670 | * @psalm-suppress MissingClosureParamType |
| 6671 | 6671 | */ |
| 6672 | 6672 | $this->array = $this->reduce( |
| 6673 | - static function ($resultArray, $value) { |
|
| 6673 | + static function($resultArray, $value) { |
|
| 6674 | 6674 | if (!\in_array($value, $resultArray, true)) { |
| 6675 | 6675 | $resultArray[] = $value; |
| 6676 | 6676 | } |
@@ -6709,7 +6709,7 @@ discard block |
||
| 6709 | 6709 | */ |
| 6710 | 6710 | $this->array = \array_reduce( |
| 6711 | 6711 | \array_keys($array), |
| 6712 | - static function ($resultArray, $key) use ($array) { |
|
| 6712 | + static function($resultArray, $key) use ($array) { |
|
| 6713 | 6713 | if (!\in_array($array[$key], $resultArray, true)) { |
| 6714 | 6714 | $resultArray[$key] = $array[$key]; |
| 6715 | 6715 | } |
@@ -6804,7 +6804,7 @@ discard block |
||
| 6804 | 6804 | public function values(): self |
| 6805 | 6805 | { |
| 6806 | 6806 | return static::create( |
| 6807 | - function () { |
|
| 6807 | + function() { |
|
| 6808 | 6808 | /** @noinspection YieldFromCanBeUsedInspection */ |
| 6809 | 6809 | foreach ($this->getGenerator() as $value) { |
| 6810 | 6810 | yield $value; |
@@ -6880,7 +6880,7 @@ discard block |
||
| 6880 | 6880 | public function where(string $keyOrPropertyOrMethod, $value): self |
| 6881 | 6881 | { |
| 6882 | 6882 | return $this->filter( |
| 6883 | - function ($item) use ($keyOrPropertyOrMethod, $value) { |
|
| 6883 | + function($item) use ($keyOrPropertyOrMethod, $value) { |
|
| 6884 | 6884 | $accessorValue = $this->extractValue( |
| 6885 | 6885 | $item, |
| 6886 | 6886 | $keyOrPropertyOrMethod |
@@ -7170,7 +7170,7 @@ discard block |
||
| 7170 | 7170 | protected function getPropertiesFromPhpDoc() |
| 7171 | 7171 | { |
| 7172 | 7172 | static $PROPERTY_CACHE = []; |
| 7173 | - $cacheKey = 'Class::' . static::class; |
|
| 7173 | + $cacheKey = 'Class::'.static::class; |
|
| 7174 | 7174 | |
| 7175 | 7175 | if (isset($PROPERTY_CACHE[$cacheKey])) { |
| 7176 | 7176 | return $PROPERTY_CACHE[$cacheKey]; |
@@ -7476,7 +7476,7 @@ discard block |
||
| 7476 | 7476 | if ($array === null) { |
| 7477 | 7477 | $array = []; |
| 7478 | 7478 | } elseif (!\is_array($array)) { |
| 7479 | - throw new \RuntimeException('Can not set value at this path "' . $key . '" because (' . \gettype($array) . ')"' . \print_r($array, true) . '" is not an array.'); |
|
| 7479 | + throw new \RuntimeException('Can not set value at this path "'.$key.'" because ('.\gettype($array).')"'.\print_r($array, true).'" is not an array.'); |
|
| 7480 | 7480 | } |
| 7481 | 7481 | |
| 7482 | 7482 | $array[$key] = $value; |
@@ -7548,7 +7548,7 @@ discard block |
||
| 7548 | 7548 | && |
| 7549 | 7549 | \count(\array_diff_key($properties, $data)) > 0 |
| 7550 | 7550 | ) { |
| 7551 | - throw new \TypeError('Property mismatch - input: ' . \print_r(\array_keys($data), true) . ' | expected: ' . \print_r(\array_keys($properties), true)); |
|
| 7551 | + throw new \TypeError('Property mismatch - input: '.\print_r(\array_keys($data), true).' | expected: '.\print_r(\array_keys($properties), true)); |
|
| 7552 | 7552 | } |
| 7553 | 7553 | |
| 7554 | 7554 | foreach ($data as $key => &$valueInner) { |
@@ -7665,7 +7665,7 @@ discard block |
||
| 7665 | 7665 | * |
| 7666 | 7666 | * @return void |
| 7667 | 7667 | */ |
| 7668 | - static function (&$item) { |
|
| 7668 | + static function(&$item) { |
|
| 7669 | 7669 | if ($item instanceof self) { |
| 7670 | 7670 | $item = $item->getArray(); |
| 7671 | 7671 | } |
@@ -7690,7 +7690,7 @@ discard block |
||
| 7690 | 7690 | && |
| 7691 | 7691 | $this->checkPropertiesMismatch === true |
| 7692 | 7692 | ) { |
| 7693 | - throw new \TypeError('The key "' . $key . '" does not exists as "@property" phpdoc. (' . \get_class($this) . ').'); |
|
| 7693 | + throw new \TypeError('The key "'.$key.'" does not exists as "@property" phpdoc. ('.\get_class($this).').'); |
|
| 7694 | 7694 | } |
| 7695 | 7695 | |
| 7696 | 7696 | if (isset($this->properties[self::ARRAYY_HELPER_TYPES_FOR_ALL_PROPERTIES])) { |