@@ -635,7 +635,7 @@ discard block |
||
| 635 | 635 | */ |
| 636 | 636 | $this->callAtPath( |
| 637 | 637 | $containerPath, |
| 638 | - static function ($container) use ($lastOffset, &$offsetExists) { |
|
| 638 | + static function($container) use ($lastOffset, &$offsetExists) { |
|
| 639 | 639 | $offsetExists = \array_key_exists($lastOffset, $container); |
| 640 | 640 | } |
| 641 | 641 | ); |
@@ -731,7 +731,7 @@ discard block |
||
| 731 | 731 | */ |
| 732 | 732 | $this->callAtPath( |
| 733 | 733 | \implode($this->pathSeparator, $path), |
| 734 | - static function (&$offset) use ($pathToUnset) { |
|
| 734 | + static function(&$offset) use ($pathToUnset) { |
|
| 735 | 735 | if (\is_array($offset)) { |
| 736 | 736 | unset($offset[$pathToUnset]); |
| 737 | 737 | } else { |
@@ -781,7 +781,7 @@ discard block |
||
| 781 | 781 | } |
| 782 | 782 | |
| 783 | 783 | if (\strpos($iteratorClass, '\\') === 0) { |
| 784 | - $iteratorClass = '\\' . $iteratorClass; |
|
| 784 | + $iteratorClass = '\\'.$iteratorClass; |
|
| 785 | 785 | if (\class_exists($iteratorClass)) { |
| 786 | 786 | /** |
| 787 | 787 | * @psalm-suppress PropertyTypeCoercion |
@@ -792,7 +792,7 @@ discard block |
||
| 792 | 792 | } |
| 793 | 793 | } |
| 794 | 794 | |
| 795 | - throw new \InvalidArgumentException('The iterator class does not exist: ' . $iteratorClass); |
|
| 795 | + throw new \InvalidArgumentException('The iterator class does not exist: '.$iteratorClass); |
|
| 796 | 796 | } |
| 797 | 797 | |
| 798 | 798 | /** |
@@ -958,13 +958,13 @@ discard block |
||
| 958 | 958 | |
| 959 | 959 | foreach ($this->getGenerator() as $key => $item) { |
| 960 | 960 | if ($item instanceof self) { |
| 961 | - $result[$prefix . $key] = $item->appendToEachKey($prefix); |
|
| 961 | + $result[$prefix.$key] = $item->appendToEachKey($prefix); |
|
| 962 | 962 | } elseif (\is_array($item) === true) { |
| 963 | - $result[$prefix . $key] = self::create($item, $this->iteratorClass, false) |
|
| 963 | + $result[$prefix.$key] = self::create($item, $this->iteratorClass, false) |
|
| 964 | 964 | ->appendToEachKey($prefix) |
| 965 | 965 | ->toArray(); |
| 966 | 966 | } else { |
| 967 | - $result[$prefix . $key] = $item; |
|
| 967 | + $result[$prefix.$key] = $item; |
|
| 968 | 968 | } |
| 969 | 969 | } |
| 970 | 970 | |
@@ -995,7 +995,7 @@ discard block |
||
| 995 | 995 | } elseif (\is_object($item) === true) { |
| 996 | 996 | $result[$key] = $item; |
| 997 | 997 | } else { |
| 998 | - $result[$key] = $prefix . $item; |
|
| 998 | + $result[$key] = $prefix.$item; |
|
| 999 | 999 | } |
| 1000 | 1000 | } |
| 1001 | 1001 | |
@@ -1181,7 +1181,7 @@ discard block |
||
| 1181 | 1181 | public function clean(): self |
| 1182 | 1182 | { |
| 1183 | 1183 | return $this->filter( |
| 1184 | - static function ($value) { |
|
| 1184 | + static function($value) { |
|
| 1185 | 1185 | return (bool) $value; |
| 1186 | 1186 | } |
| 1187 | 1187 | ); |
@@ -1476,9 +1476,9 @@ discard block |
||
| 1476 | 1476 | |
| 1477 | 1477 | foreach ($items as $key => $value) { |
| 1478 | 1478 | if (\is_array($value) && !empty($value)) { |
| 1479 | - $flatten[] = $this->flatten($delimiter, $prepend . $key . $delimiter, $value); |
|
| 1479 | + $flatten[] = $this->flatten($delimiter, $prepend.$key.$delimiter, $value); |
|
| 1480 | 1480 | } else { |
| 1481 | - $flatten[] = [$prepend . $key => $value]; |
|
| 1481 | + $flatten[] = [$prepend.$key => $value]; |
|
| 1482 | 1482 | } |
| 1483 | 1483 | } |
| 1484 | 1484 | |
@@ -1656,7 +1656,7 @@ discard block |
||
| 1656 | 1656 | */ |
| 1657 | 1657 | \array_walk( |
| 1658 | 1658 | $array, |
| 1659 | - static function (&$val) { |
|
| 1659 | + static function(&$val) { |
|
| 1660 | 1660 | if ((string) $val === $val) { |
| 1661 | 1661 | $val = \trim($val); |
| 1662 | 1662 | } |
@@ -2168,40 +2168,40 @@ discard block |
||
| 2168 | 2168 | } |
| 2169 | 2169 | |
| 2170 | 2170 | $ops = [ |
| 2171 | - 'eq' => static function ($item, $prop, $value): bool { |
|
| 2171 | + 'eq' => static function($item, $prop, $value): bool { |
|
| 2172 | 2172 | return $item[$prop] === $value; |
| 2173 | 2173 | }, |
| 2174 | - 'gt' => static function ($item, $prop, $value): bool { |
|
| 2174 | + 'gt' => static function($item, $prop, $value): bool { |
|
| 2175 | 2175 | return $item[$prop] > $value; |
| 2176 | 2176 | }, |
| 2177 | - 'ge' => static function ($item, $prop, $value): bool { |
|
| 2177 | + 'ge' => static function($item, $prop, $value): bool { |
|
| 2178 | 2178 | return $item[$prop] >= $value; |
| 2179 | 2179 | }, |
| 2180 | - 'gte' => static function ($item, $prop, $value): bool { |
|
| 2180 | + 'gte' => static function($item, $prop, $value): bool { |
|
| 2181 | 2181 | return $item[$prop] >= $value; |
| 2182 | 2182 | }, |
| 2183 | - 'lt' => static function ($item, $prop, $value): bool { |
|
| 2183 | + 'lt' => static function($item, $prop, $value): bool { |
|
| 2184 | 2184 | return $item[$prop] < $value; |
| 2185 | 2185 | }, |
| 2186 | - 'le' => static function ($item, $prop, $value): bool { |
|
| 2186 | + 'le' => static function($item, $prop, $value): bool { |
|
| 2187 | 2187 | return $item[$prop] <= $value; |
| 2188 | 2188 | }, |
| 2189 | - 'lte' => static function ($item, $prop, $value): bool { |
|
| 2189 | + 'lte' => static function($item, $prop, $value): bool { |
|
| 2190 | 2190 | return $item[$prop] <= $value; |
| 2191 | 2191 | }, |
| 2192 | - 'ne' => static function ($item, $prop, $value): bool { |
|
| 2192 | + 'ne' => static function($item, $prop, $value): bool { |
|
| 2193 | 2193 | return $item[$prop] !== $value; |
| 2194 | 2194 | }, |
| 2195 | - 'contains' => static function ($item, $prop, $value): bool { |
|
| 2195 | + 'contains' => static function($item, $prop, $value): bool { |
|
| 2196 | 2196 | return \in_array($item[$prop], (array) $value, true); |
| 2197 | 2197 | }, |
| 2198 | - 'notContains' => static function ($item, $prop, $value): bool { |
|
| 2198 | + 'notContains' => static function($item, $prop, $value): bool { |
|
| 2199 | 2199 | return !\in_array($item[$prop], (array) $value, true); |
| 2200 | 2200 | }, |
| 2201 | - 'newer' => static function ($item, $prop, $value): bool { |
|
| 2201 | + 'newer' => static function($item, $prop, $value): bool { |
|
| 2202 | 2202 | return \strtotime($item[$prop]) > \strtotime($value); |
| 2203 | 2203 | }, |
| 2204 | - 'older' => static function ($item, $prop, $value): bool { |
|
| 2204 | + 'older' => static function($item, $prop, $value): bool { |
|
| 2205 | 2205 | return \strtotime($item[$prop]) < \strtotime($value); |
| 2206 | 2206 | }, |
| 2207 | 2207 | ]; |
@@ -2209,7 +2209,7 @@ discard block |
||
| 2209 | 2209 | $result = \array_values( |
| 2210 | 2210 | \array_filter( |
| 2211 | 2211 | $this->toArray(false, true), |
| 2212 | - static function ($item) use ( |
|
| 2212 | + static function($item) use ( |
|
| 2213 | 2213 | $property, |
| 2214 | 2214 | $value, |
| 2215 | 2215 | $ops, |
@@ -2963,7 +2963,7 @@ discard block |
||
| 2963 | 2963 | \array_uintersect( |
| 2964 | 2964 | $this->toArray(), |
| 2965 | 2965 | $search, |
| 2966 | - static function ($a, $b) { |
|
| 2966 | + static function($a, $b) { |
|
| 2967 | 2967 | return $a === $b ? 0 : -1; |
| 2968 | 2968 | } |
| 2969 | 2969 | ), |
@@ -3258,13 +3258,13 @@ discard block |
||
| 3258 | 3258 | // non recursive |
| 3259 | 3259 | |
| 3260 | 3260 | if ($search_values === null) { |
| 3261 | - $arrayFunction = function (): \Generator { |
|
| 3261 | + $arrayFunction = function(): \Generator { |
|
| 3262 | 3262 | foreach ($this->getGenerator() as $key => $value) { |
| 3263 | 3263 | yield $key; |
| 3264 | 3264 | } |
| 3265 | 3265 | }; |
| 3266 | 3266 | } else { |
| 3267 | - $arrayFunction = function () use ($search_values, $strict): \Generator { |
|
| 3267 | + $arrayFunction = function() use ($search_values, $strict): \Generator { |
|
| 3268 | 3268 | $is_array_tmp = \is_array($search_values); |
| 3269 | 3269 | |
| 3270 | 3270 | foreach ($this->getGenerator() as $key => $value) { |
@@ -3510,7 +3510,7 @@ discard block |
||
| 3510 | 3510 | $useArguments = \func_num_args() > 2; |
| 3511 | 3511 | |
| 3512 | 3512 | return static::create( |
| 3513 | - function () use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
| 3513 | + function() use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
| 3514 | 3514 | foreach ($this->getGenerator() as $key => $value) { |
| 3515 | 3515 | if ($useArguments) { |
| 3516 | 3516 | if ($useKeyAsSecondParameter) { |
@@ -3930,7 +3930,7 @@ discard block |
||
| 3930 | 3930 | */ |
| 3931 | 3931 | public function nth(int $step, int $offset = 0): self |
| 3932 | 3932 | { |
| 3933 | - $arrayFunction = function () use ($step, $offset): \Generator { |
|
| 3933 | + $arrayFunction = function() use ($step, $offset): \Generator { |
|
| 3934 | 3934 | $position = 0; |
| 3935 | 3935 | foreach ($this->getGenerator() as $key => $value) { |
| 3936 | 3936 | if ($position++ % $step !== $offset) { |
@@ -4090,7 +4090,7 @@ discard block |
||
| 4090 | 4090 | )->prependToEachKey($suffix) |
| 4091 | 4091 | ->toArray(); |
| 4092 | 4092 | } else { |
| 4093 | - $result[$key . $suffix] = $item; |
|
| 4093 | + $result[$key.$suffix] = $item; |
|
| 4094 | 4094 | } |
| 4095 | 4095 | } |
| 4096 | 4096 | |
@@ -4130,7 +4130,7 @@ discard block |
||
| 4130 | 4130 | } elseif (\is_object($item) === true) { |
| 4131 | 4131 | $result[$key] = $item; |
| 4132 | 4132 | } else { |
| 4133 | - $result[$key] = $item . $suffix; |
|
| 4133 | + $result[$key] = $item.$suffix; |
|
| 4134 | 4134 | } |
| 4135 | 4135 | } |
| 4136 | 4136 | |
@@ -4822,7 +4822,7 @@ discard block |
||
| 4822 | 4822 | * @psalm-suppress MissingClosureParamType |
| 4823 | 4823 | */ |
| 4824 | 4824 | return $this->each( |
| 4825 | - static function ($value) use ($search, $replacement) { |
|
| 4825 | + static function($value) use ($search, $replacement) { |
|
| 4826 | 4826 | return \str_replace($search, $replacement, $value); |
| 4827 | 4827 | } |
| 4828 | 4828 | ); |
@@ -5447,7 +5447,7 @@ discard block |
||
| 5447 | 5447 | * @psalm-suppress MissingClosureParamType |
| 5448 | 5448 | */ |
| 5449 | 5449 | $results = $arrayy->each( |
| 5450 | - function ($value) use ($sorter) { |
|
| 5450 | + function($value) use ($sorter) { |
|
| 5451 | 5451 | if (\is_callable($sorter) === true) { |
| 5452 | 5452 | return $sorter($value); |
| 5453 | 5453 | } |
@@ -5545,7 +5545,7 @@ discard block |
||
| 5545 | 5545 | public function stripEmpty(): self |
| 5546 | 5546 | { |
| 5547 | 5547 | return $this->filter( |
| 5548 | - static function ($item) { |
|
| 5548 | + static function($item) { |
|
| 5549 | 5549 | if ($item === null) { |
| 5550 | 5550 | return false; |
| 5551 | 5551 | } |
@@ -5734,7 +5734,7 @@ discard block |
||
| 5734 | 5734 | * @psalm-suppress MissingClosureParamType |
| 5735 | 5735 | */ |
| 5736 | 5736 | $this->array = $this->reduce( |
| 5737 | - static function ($resultArray, $value) { |
|
| 5737 | + static function($resultArray, $value) { |
|
| 5738 | 5738 | if (!\in_array($value, $resultArray, true)) { |
| 5739 | 5739 | $resultArray[] = $value; |
| 5740 | 5740 | } |
@@ -5769,7 +5769,7 @@ discard block |
||
| 5769 | 5769 | */ |
| 5770 | 5770 | $this->array = \array_reduce( |
| 5771 | 5771 | \array_keys($array), |
| 5772 | - static function ($resultArray, $key) use ($array) { |
|
| 5772 | + static function($resultArray, $key) use ($array) { |
|
| 5773 | 5773 | if (!\in_array($array[$key], $resultArray, true)) { |
| 5774 | 5774 | $resultArray[$key] = $array[$key]; |
| 5775 | 5775 | } |
@@ -5849,7 +5849,7 @@ discard block |
||
| 5849 | 5849 | public function values(): self |
| 5850 | 5850 | { |
| 5851 | 5851 | return static::create( |
| 5852 | - function () { |
|
| 5852 | + function() { |
|
| 5853 | 5853 | /** @noinspection YieldFromCanBeUsedInspection */ |
| 5854 | 5854 | foreach ($this->getGenerator() as $value) { |
| 5855 | 5855 | yield $value; |
@@ -5902,7 +5902,7 @@ discard block |
||
| 5902 | 5902 | public function where(string $keyOrPropertyOrMethod, $value): self |
| 5903 | 5903 | { |
| 5904 | 5904 | return $this->filter( |
| 5905 | - function ($item) use ($keyOrPropertyOrMethod, $value) { |
|
| 5905 | + function($item) use ($keyOrPropertyOrMethod, $value) { |
|
| 5906 | 5906 | $accessorValue = $this->extractValue( |
| 5907 | 5907 | $item, |
| 5908 | 5908 | $keyOrPropertyOrMethod |
@@ -6192,7 +6192,7 @@ discard block |
||
| 6192 | 6192 | protected function getPropertiesFromPhpDoc() |
| 6193 | 6193 | { |
| 6194 | 6194 | static $PROPERTY_CACHE = []; |
| 6195 | - $cacheKey = 'Class::' . static::class; |
|
| 6195 | + $cacheKey = 'Class::'.static::class; |
|
| 6196 | 6196 | |
| 6197 | 6197 | if (isset($PROPERTY_CACHE[$cacheKey])) { |
| 6198 | 6198 | return $PROPERTY_CACHE[$cacheKey]; |
@@ -6468,7 +6468,7 @@ discard block |
||
| 6468 | 6468 | if ($array === null) { |
| 6469 | 6469 | $array = []; |
| 6470 | 6470 | } elseif (!\is_array($array)) { |
| 6471 | - throw new \RuntimeException('Can not set value at this path "' . $key . '" because (' . \gettype($array) . ')"' . \print_r($array, true) . '" is not an array.'); |
|
| 6471 | + throw new \RuntimeException('Can not set value at this path "'.$key.'" because ('.\gettype($array).')"'.\print_r($array, true).'" is not an array.'); |
|
| 6472 | 6472 | } |
| 6473 | 6473 | |
| 6474 | 6474 | $array[$key] = $value; |
@@ -6540,7 +6540,7 @@ discard block |
||
| 6540 | 6540 | && |
| 6541 | 6541 | \count(\array_diff_key($properties, $data)) > 0 |
| 6542 | 6542 | ) { |
| 6543 | - throw new \TypeError('Property mismatch - input: ' . \print_r(\array_keys($data), true) . ' | expected: ' . \print_r(\array_keys($properties), true)); |
|
| 6543 | + throw new \TypeError('Property mismatch - input: '.\print_r(\array_keys($data), true).' | expected: '.\print_r(\array_keys($properties), true)); |
|
| 6544 | 6544 | } |
| 6545 | 6545 | |
| 6546 | 6546 | foreach ($data as $key => &$valueInner) { |
@@ -6653,7 +6653,7 @@ discard block |
||
| 6653 | 6653 | * |
| 6654 | 6654 | * @return void |
| 6655 | 6655 | */ |
| 6656 | - static function (&$item) { |
|
| 6656 | + static function(&$item) { |
|
| 6657 | 6657 | if ($item instanceof self) { |
| 6658 | 6658 | $item = $item->getArray(); |
| 6659 | 6659 | } |
@@ -6678,7 +6678,7 @@ discard block |
||
| 6678 | 6678 | && |
| 6679 | 6679 | $this->checkPropertiesMismatch === true |
| 6680 | 6680 | ) { |
| 6681 | - throw new \TypeError('The key ' . $key . ' does not exists in "properties". Maybe because @property was not used for the class (' . \get_class($this) . ').'); |
|
| 6681 | + throw new \TypeError('The key '.$key.' does not exists in "properties". Maybe because @property was not used for the class ('.\get_class($this).').'); |
|
| 6682 | 6682 | } |
| 6683 | 6683 | |
| 6684 | 6684 | if (isset($this->properties[self::ARRAYY_HELPER_TYPES_FOR_ALL_PROPERTIES])) { |