@@ -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); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | |
74 | 74 | $expectedTypes = \implode('|', $this->getTypes()); |
75 | 75 | |
76 | - throw new \InvalidArgumentException("Invalid type: expected {$this->name} to be of type {{$expectedTypes}}, instead got value `" . \print_r($value, true) . "` with type {{$type}}."); |
|
76 | + throw new \InvalidArgumentException("Invalid type: expected {$this->name} to be of type {{$expectedTypes}}, instead got value `".\print_r($value, true)."` with type {{$type}}."); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | public static function fromPhpDocumentorProperty(\phpDocumentor\Reflection\DocBlock\Tags\Property $phpDocumentorReflectionProperty): self |
@@ -137,9 +137,9 @@ discard block |
||
137 | 137 | } |
138 | 138 | |
139 | 139 | if ($type instanceof \phpDocumentor\Reflection\Types\Array_) { |
140 | - $valueTypeTmp = $type->getValueType() . ''; |
|
140 | + $valueTypeTmp = $type->getValueType().''; |
|
141 | 141 | if ($valueTypeTmp !== 'mixed') { |
142 | - return $valueTypeTmp . '[]'; |
|
142 | + return $valueTypeTmp.'[]'; |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | return 'array'; |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | return 'resource'; |
186 | 186 | } |
187 | 187 | |
188 | - return $type . ''; |
|
188 | + return $type.''; |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | /** |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | public function where(string $keyOrPropertyOrMethod, $value): CollectionInterface |
172 | 172 | { |
173 | 173 | return $this->filter( |
174 | - function ($item) use ($keyOrPropertyOrMethod, $value) { |
|
174 | + function($item) use ($keyOrPropertyOrMethod, $value) { |
|
175 | 175 | $accessorValue = $this->extractValue( |
176 | 176 | $item, |
177 | 177 | $keyOrPropertyOrMethod |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | { |
206 | 206 | if ($this->checkType($this->collectionType, $value) === false) { |
207 | 207 | throw new \InvalidArgumentException( |
208 | - 'Value must be of type ' . $this->collectionType . '; value is ' . $this->valueToString($value) |
|
208 | + 'Value must be of type '.$this->collectionType.'; value is '.$this->valueToString($value) |
|
209 | 209 | ); |
210 | 210 | } |
211 | 211 | } |
@@ -318,10 +318,10 @@ discard block |
||
318 | 318 | |
319 | 319 | // resource |
320 | 320 | if (\is_resource($value)) { |
321 | - return \get_resource_type($value) . ' resource #' . (int) $value; |
|
321 | + return \get_resource_type($value).' resource #'.(int) $value; |
|
322 | 322 | } |
323 | 323 | |
324 | 324 | // object |
325 | - return \get_class($value) . ' Object'; |
|
325 | + return \get_class($value).' Object'; |
|
326 | 326 | } |
327 | 327 | } |
@@ -4167,7 +4167,7 @@ discard block |
||
4167 | 4167 | } |
4168 | 4168 | |
4169 | 4169 | /** |
4170 | - * @param mixed $path |
|
4170 | + * @param string $path |
|
4171 | 4171 | * @param callable $callable |
4172 | 4172 | * @param array|null $currentOffset |
4173 | 4173 | */ |
@@ -4300,7 +4300,7 @@ discard block |
||
4300 | 4300 | } |
4301 | 4301 | |
4302 | 4302 | /** |
4303 | - * @param mixed $glue |
|
4303 | + * @param string $glue |
|
4304 | 4304 | * @param array|static|string $pieces |
4305 | 4305 | * @param bool $useKeys |
4306 | 4306 | * |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | && |
106 | 106 | \count(\array_diff_key($this->properties, $data)) > 0 |
107 | 107 | ) { |
108 | - throw new \InvalidArgumentException('Property mismatch - input: ' . \print_r(\array_keys($data), true) . ' | expected: ' . \print_r(\array_keys($this->properties), true)); |
|
108 | + throw new \InvalidArgumentException('Property mismatch - input: '.\print_r(\array_keys($data), true).' | expected: '.\print_r(\array_keys($this->properties), true)); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | /** @noinspection AlterInForeachInspection */ |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | |
468 | 468 | $this->callAtPath( |
469 | 469 | $containerPath, |
470 | - static function ($container) use ($lastOffset, &$offsetExists) { |
|
470 | + static function($container) use ($lastOffset, &$offsetExists) { |
|
471 | 471 | $offsetExists = \array_key_exists($lastOffset, $container); |
472 | 472 | } |
473 | 473 | ); |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | |
542 | 542 | $this->callAtPath( |
543 | 543 | \implode($this->pathSeparator, $path), |
544 | - static function (&$offset) use ($pathToUnset) { |
|
544 | + static function(&$offset) use ($pathToUnset) { |
|
545 | 545 | unset($offset[$pathToUnset]); |
546 | 546 | } |
547 | 547 | ); |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | } |
582 | 582 | |
583 | 583 | if (\strpos($class, '\\') === 0) { |
584 | - $class = '\\' . $class; |
|
584 | + $class = '\\'.$class; |
|
585 | 585 | if (\class_exists($class)) { |
586 | 586 | $this->iteratorClass = $class; |
587 | 587 | |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | } |
590 | 590 | } |
591 | 591 | |
592 | - throw new \InvalidArgumentException('The iterator class does not exist: ' . $class); |
|
592 | + throw new \InvalidArgumentException('The iterator class does not exist: '.$class); |
|
593 | 593 | } |
594 | 594 | |
595 | 595 | /** |
@@ -697,13 +697,13 @@ discard block |
||
697 | 697 | |
698 | 698 | foreach ($this->getGenerator() as $key => $item) { |
699 | 699 | if ($item instanceof self) { |
700 | - $result[$prefix . $key] = $item->appendToEachKey($prefix); |
|
700 | + $result[$prefix.$key] = $item->appendToEachKey($prefix); |
|
701 | 701 | } elseif (\is_array($item)) { |
702 | - $result[$prefix . $key] = self::create($item, $this->iteratorClass, false) |
|
702 | + $result[$prefix.$key] = self::create($item, $this->iteratorClass, false) |
|
703 | 703 | ->appendToEachKey($prefix) |
704 | 704 | ->toArray(); |
705 | 705 | } else { |
706 | - $result[$prefix . $key] = $item; |
|
706 | + $result[$prefix.$key] = $item; |
|
707 | 707 | } |
708 | 708 | } |
709 | 709 | |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | } elseif (\is_object($item)) { |
732 | 732 | $result[$key] = $item; |
733 | 733 | } else { |
734 | - $result[$key] = $prefix . $item; |
|
734 | + $result[$key] = $prefix.$item; |
|
735 | 735 | } |
736 | 736 | } |
737 | 737 | |
@@ -882,7 +882,7 @@ discard block |
||
882 | 882 | public function clean(): self |
883 | 883 | { |
884 | 884 | return $this->filter( |
885 | - static function ($value) { |
|
885 | + static function($value) { |
|
886 | 886 | return (bool) $value; |
887 | 887 | } |
888 | 888 | ); |
@@ -1248,7 +1248,7 @@ discard block |
||
1248 | 1248 | // trim all string in the array |
1249 | 1249 | \array_walk( |
1250 | 1250 | $array, |
1251 | - static function (&$val) { |
|
1251 | + static function(&$val) { |
|
1252 | 1252 | if (\is_string($val)) { |
1253 | 1253 | $val = \trim($val); |
1254 | 1254 | } |
@@ -1576,40 +1576,40 @@ discard block |
||
1576 | 1576 | } |
1577 | 1577 | |
1578 | 1578 | $ops = [ |
1579 | - 'eq' => static function ($item, $prop, $value) { |
|
1579 | + 'eq' => static function($item, $prop, $value) { |
|
1580 | 1580 | return $item[$prop] === $value; |
1581 | 1581 | }, |
1582 | - 'gt' => static function ($item, $prop, $value) { |
|
1582 | + 'gt' => static function($item, $prop, $value) { |
|
1583 | 1583 | return $item[$prop] > $value; |
1584 | 1584 | }, |
1585 | - 'ge' => static function ($item, $prop, $value) { |
|
1585 | + 'ge' => static function($item, $prop, $value) { |
|
1586 | 1586 | return $item[$prop] >= $value; |
1587 | 1587 | }, |
1588 | - 'gte' => static function ($item, $prop, $value) { |
|
1588 | + 'gte' => static function($item, $prop, $value) { |
|
1589 | 1589 | return $item[$prop] >= $value; |
1590 | 1590 | }, |
1591 | - 'lt' => static function ($item, $prop, $value) { |
|
1591 | + 'lt' => static function($item, $prop, $value) { |
|
1592 | 1592 | return $item[$prop] < $value; |
1593 | 1593 | }, |
1594 | - 'le' => static function ($item, $prop, $value) { |
|
1594 | + 'le' => static function($item, $prop, $value) { |
|
1595 | 1595 | return $item[$prop] <= $value; |
1596 | 1596 | }, |
1597 | - 'lte' => static function ($item, $prop, $value) { |
|
1597 | + 'lte' => static function($item, $prop, $value) { |
|
1598 | 1598 | return $item[$prop] <= $value; |
1599 | 1599 | }, |
1600 | - 'ne' => static function ($item, $prop, $value) { |
|
1600 | + 'ne' => static function($item, $prop, $value) { |
|
1601 | 1601 | return $item[$prop] !== $value; |
1602 | 1602 | }, |
1603 | - 'contains' => static function ($item, $prop, $value) { |
|
1603 | + 'contains' => static function($item, $prop, $value) { |
|
1604 | 1604 | return \in_array($item[$prop], (array) $value, true); |
1605 | 1605 | }, |
1606 | - 'notContains' => static function ($item, $prop, $value) { |
|
1606 | + 'notContains' => static function($item, $prop, $value) { |
|
1607 | 1607 | return !\in_array($item[$prop], (array) $value, true); |
1608 | 1608 | }, |
1609 | - 'newer' => static function ($item, $prop, $value) { |
|
1609 | + 'newer' => static function($item, $prop, $value) { |
|
1610 | 1610 | return \strtotime($item[$prop]) > \strtotime($value); |
1611 | 1611 | }, |
1612 | - 'older' => static function ($item, $prop, $value) { |
|
1612 | + 'older' => static function($item, $prop, $value) { |
|
1613 | 1613 | return \strtotime($item[$prop]) < \strtotime($value); |
1614 | 1614 | }, |
1615 | 1615 | ]; |
@@ -1617,7 +1617,7 @@ discard block |
||
1617 | 1617 | $result = \array_values( |
1618 | 1618 | \array_filter( |
1619 | 1619 | $this->getArray(), |
1620 | - static function ($item) use ( |
|
1620 | + static function($item) use ( |
|
1621 | 1621 | $property, |
1622 | 1622 | $value, |
1623 | 1623 | $ops, |
@@ -2165,7 +2165,7 @@ discard block |
||
2165 | 2165 | \array_uintersect( |
2166 | 2166 | $this->array, |
2167 | 2167 | $search, |
2168 | - static function ($a, $b) { |
|
2168 | + static function($a, $b) { |
|
2169 | 2169 | return $a === $b ? 0 : -1; |
2170 | 2170 | } |
2171 | 2171 | ), |
@@ -2382,13 +2382,13 @@ discard block |
||
2382 | 2382 | // non recursive |
2383 | 2383 | |
2384 | 2384 | if ($search_value === null) { |
2385 | - $arrayFunction = function () { |
|
2385 | + $arrayFunction = function() { |
|
2386 | 2386 | foreach ($this->getGenerator() as $key => $value) { |
2387 | 2387 | yield $key; |
2388 | 2388 | } |
2389 | 2389 | }; |
2390 | 2390 | } else { |
2391 | - $arrayFunction = function () use ($search_value, $strict) { |
|
2391 | + $arrayFunction = function() use ($search_value, $strict) { |
|
2392 | 2392 | foreach ($this->getGenerator() as $key => $value) { |
2393 | 2393 | if ($strict) { |
2394 | 2394 | if ($search_value === $value) { |
@@ -2553,7 +2553,7 @@ discard block |
||
2553 | 2553 | $useArguments = \func_num_args() > 2; |
2554 | 2554 | |
2555 | 2555 | return static::create( |
2556 | - function () use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
2556 | + function() use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
2557 | 2557 | foreach ($this->getGenerator() as $key => $value) { |
2558 | 2558 | if ($useArguments) { |
2559 | 2559 | if ($useKeyAsSecondParameter) { |
@@ -2908,7 +2908,7 @@ discard block |
||
2908 | 2908 | )->prependToEachKey($suffix) |
2909 | 2909 | ->toArray(); |
2910 | 2910 | } else { |
2911 | - $result[$key . $suffix] = $item; |
|
2911 | + $result[$key.$suffix] = $item; |
|
2912 | 2912 | } |
2913 | 2913 | } |
2914 | 2914 | |
@@ -2945,7 +2945,7 @@ discard block |
||
2945 | 2945 | } elseif (\is_object($item)) { |
2946 | 2946 | $result[$key] = $item; |
2947 | 2947 | } else { |
2948 | - $result[$key] = $item . $suffix; |
|
2948 | + $result[$key] = $item.$suffix; |
|
2949 | 2949 | } |
2950 | 2950 | } |
2951 | 2951 | |
@@ -3477,7 +3477,7 @@ discard block |
||
3477 | 3477 | public function replaceValues($search, $replacement = ''): self |
3478 | 3478 | { |
3479 | 3479 | $array = $this->each( |
3480 | - static function ($value) use ($search, $replacement) { |
|
3480 | + static function($value) use ($search, $replacement) { |
|
3481 | 3481 | return \str_replace($search, $replacement, $value); |
3482 | 3482 | } |
3483 | 3483 | ); |
@@ -3976,7 +3976,7 @@ discard block |
||
3976 | 3976 | ); |
3977 | 3977 | |
3978 | 3978 | $results = $arrayy->each( |
3979 | - function ($value) use ($sorter) { |
|
3979 | + function($value) use ($sorter) { |
|
3980 | 3980 | if (\is_callable($sorter)) { |
3981 | 3981 | return $sorter($value); |
3982 | 3982 | } |
@@ -4038,7 +4038,7 @@ discard block |
||
4038 | 4038 | public function stripEmpty(): self |
4039 | 4039 | { |
4040 | 4040 | return $this->filter( |
4041 | - static function ($item) { |
|
4041 | + static function($item) { |
|
4042 | 4042 | if ($item === null) { |
4043 | 4043 | return false; |
4044 | 4044 | } |
@@ -4123,7 +4123,7 @@ discard block |
||
4123 | 4123 | // INFO: \array_unique() can't handle e.g. "stdClass"-values in an array |
4124 | 4124 | |
4125 | 4125 | $this->array = $this->reduce( |
4126 | - static function ($resultArray, $value) { |
|
4126 | + static function($resultArray, $value) { |
|
4127 | 4127 | if (!\in_array($value, $resultArray, true)) { |
4128 | 4128 | $resultArray[] = $value; |
4129 | 4129 | } |
@@ -4152,7 +4152,7 @@ discard block |
||
4152 | 4152 | |
4153 | 4153 | $this->array = \array_reduce( |
4154 | 4154 | \array_keys($array), |
4155 | - static function ($resultArray, $key) use ($array) { |
|
4155 | + static function($resultArray, $key) use ($array) { |
|
4156 | 4156 | if (!\in_array($array[$key], $resultArray, true)) { |
4157 | 4157 | $resultArray[$key] = $array[$key]; |
4158 | 4158 | } |
@@ -4237,7 +4237,7 @@ discard block |
||
4237 | 4237 | public function values(): self |
4238 | 4238 | { |
4239 | 4239 | return static::create( |
4240 | - function () { |
|
4240 | + function() { |
|
4241 | 4241 | /** @noinspection YieldFromCanBeUsedInspection */ |
4242 | 4242 | foreach ($this->getGenerator() as $value) { |
4243 | 4243 | yield $value; |
@@ -4643,7 +4643,7 @@ discard block |
||
4643 | 4643 | $this->properties !== [] |
4644 | 4644 | ) { |
4645 | 4645 | if (isset($this->properties[$key]) === false) { |
4646 | - throw new \InvalidArgumentException('The key ' . $key . ' does not exists as @property in the class (' . \get_class($this) . ').'); |
|
4646 | + throw new \InvalidArgumentException('The key '.$key.' does not exists as @property in the class ('.\get_class($this).').'); |
|
4647 | 4647 | } |
4648 | 4648 | |
4649 | 4649 | $this->properties[$key]->checkType($value); |
@@ -4795,7 +4795,7 @@ discard block |
||
4795 | 4795 | private function getPropertiesFromPhpDoc(): array |
4796 | 4796 | { |
4797 | 4797 | static $PROPERTY_CACHE = []; |
4798 | - $cacheKey = 'Class::' . static::class; |
|
4798 | + $cacheKey = 'Class::'.static::class; |
|
4799 | 4799 | |
4800 | 4800 | if (isset($PROPERTY_CACHE[$cacheKey])) { |
4801 | 4801 | return $PROPERTY_CACHE[$cacheKey]; |
@@ -1002,12 +1002,12 @@ discard block |
||
1002 | 1002 | return \count( |
1003 | 1003 | \array_intersect($needles, $this->keys()->getArray()), |
1004 | 1004 | \COUNT_NORMAL |
1005 | - ) |
|
1006 | - === |
|
1007 | - \count( |
|
1008 | - $needles, |
|
1009 | - \COUNT_NORMAL |
|
1010 | - ); |
|
1005 | + ) |
|
1006 | + === |
|
1007 | + \count( |
|
1008 | + $needles, |
|
1009 | + \COUNT_NORMAL |
|
1010 | + ); |
|
1011 | 1011 | } |
1012 | 1012 | |
1013 | 1013 | /** |
@@ -1062,8 +1062,8 @@ discard block |
||
1062 | 1062 | public function containsValues(array $needles): bool |
1063 | 1063 | { |
1064 | 1064 | return \count(\array_intersect($needles, $this->getArray()), \COUNT_NORMAL) |
1065 | - === |
|
1066 | - \count($needles, \COUNT_NORMAL); |
|
1065 | + === |
|
1066 | + \count($needles, \COUNT_NORMAL); |
|
1067 | 1067 | } |
1068 | 1068 | |
1069 | 1069 | /** |
@@ -2364,15 +2364,15 @@ discard block |
||
2364 | 2364 | |
2365 | 2365 | if ($recursive === true) { |
2366 | 2366 | return $this->array_keys_recursive($this->getArray()) |
2367 | - === |
|
2368 | - \range(0, \count($this->getArray(), \COUNT_RECURSIVE) - 1); |
|
2367 | + === |
|
2368 | + \range(0, \count($this->getArray(), \COUNT_RECURSIVE) - 1); |
|
2369 | 2369 | } |
2370 | 2370 | |
2371 | 2371 | // non recursive |
2372 | 2372 | |
2373 | 2373 | return \array_keys($this->getArray()) |
2374 | - === |
|
2375 | - \range(0, \count($this->getArray(), \COUNT_NORMAL) - 1); |
|
2374 | + === |
|
2375 | + \range(0, \count($this->getArray(), \COUNT_NORMAL) - 1); |
|
2376 | 2376 | } |
2377 | 2377 | |
2378 | 2378 | /** |