@@ -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 | /** |
@@ -955,25 +955,25 @@ discard block |
||
955 | 955 | { |
956 | 956 | if ($recursive === true) { |
957 | 957 | return \count( |
958 | - \array_intersect($needles, $this->keys(true)->getArray()), |
|
959 | - \COUNT_RECURSIVE |
|
960 | - ) |
|
961 | - === |
|
962 | - \count( |
|
963 | - $needles, |
|
964 | - \COUNT_RECURSIVE |
|
965 | - ); |
|
958 | + \array_intersect($needles, $this->keys(true)->getArray()), |
|
959 | + \COUNT_RECURSIVE |
|
960 | + ) |
|
961 | + === |
|
962 | + \count( |
|
963 | + $needles, |
|
964 | + \COUNT_RECURSIVE |
|
965 | + ); |
|
966 | 966 | } |
967 | 967 | |
968 | 968 | return \count( |
969 | - \array_intersect($needles, $this->keys()->getArray()), |
|
970 | - \COUNT_NORMAL |
|
971 | - ) |
|
972 | - === |
|
973 | - \count( |
|
974 | - $needles, |
|
975 | - \COUNT_NORMAL |
|
976 | - ); |
|
969 | + \array_intersect($needles, $this->keys()->getArray()), |
|
970 | + \COUNT_NORMAL |
|
971 | + ) |
|
972 | + === |
|
973 | + \count( |
|
974 | + $needles, |
|
975 | + \COUNT_NORMAL |
|
976 | + ); |
|
977 | 977 | } |
978 | 978 | |
979 | 979 | /** |
@@ -1028,8 +1028,8 @@ discard block |
||
1028 | 1028 | public function containsValues(array $needles): bool |
1029 | 1029 | { |
1030 | 1030 | return \count(\array_intersect($needles, $this->getArray()), \COUNT_NORMAL) |
1031 | - === |
|
1032 | - \count($needles, \COUNT_NORMAL); |
|
1031 | + === |
|
1032 | + \count($needles, \COUNT_NORMAL); |
|
1033 | 1033 | } |
1034 | 1034 | |
1035 | 1035 | /** |
@@ -2170,15 +2170,15 @@ discard block |
||
2170 | 2170 | |
2171 | 2171 | if ($recursive === true) { |
2172 | 2172 | return $this->array_keys_recursive($this->getArray()) |
2173 | - === |
|
2174 | - \range(0, \count($this->getArray(), \COUNT_RECURSIVE) - 1); |
|
2173 | + === |
|
2174 | + \range(0, \count($this->getArray(), \COUNT_RECURSIVE) - 1); |
|
2175 | 2175 | } |
2176 | 2176 | |
2177 | 2177 | // non recursive |
2178 | 2178 | |
2179 | 2179 | return \array_keys($this->getArray()) |
2180 | - === |
|
2181 | - \range(0, \count($this->getArray(), \COUNT_NORMAL) - 1); |
|
2180 | + === |
|
2181 | + \range(0, \count($this->getArray(), \COUNT_NORMAL) - 1); |
|
2182 | 2182 | } |
2183 | 2183 | |
2184 | 2184 | /** |
@@ -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 | ); |
@@ -948,7 +948,7 @@ discard block |
||
948 | 948 | return $this->in_array_recursive( |
949 | 949 | \mb_strtoupper((string) $value), |
950 | 950 | $this->walk( |
951 | - static function (&$val) { |
|
951 | + static function(&$val) { |
|
952 | 952 | /** @noinspection PhpComposerExtensionStubsInspection */ |
953 | 953 | $val = \mb_strtoupper((string) $val); |
954 | 954 | }, |
@@ -962,7 +962,7 @@ discard block |
||
962 | 962 | return \in_array( |
963 | 963 | \mb_strtoupper((string) $value), |
964 | 964 | $this->walk( |
965 | - static function (&$val) { |
|
965 | + static function(&$val) { |
|
966 | 966 | /** @noinspection PhpComposerExtensionStubsInspection */ |
967 | 967 | $val = \mb_strtoupper((string) $val); |
968 | 968 | }, |
@@ -1253,7 +1253,7 @@ discard block |
||
1253 | 1253 | // trim all string in the array |
1254 | 1254 | \array_walk( |
1255 | 1255 | $array, |
1256 | - static function (&$val) { |
|
1256 | + static function(&$val) { |
|
1257 | 1257 | if (\is_string($val)) { |
1258 | 1258 | $val = \trim($val); |
1259 | 1259 | } |
@@ -1581,40 +1581,40 @@ discard block |
||
1581 | 1581 | } |
1582 | 1582 | |
1583 | 1583 | $ops = [ |
1584 | - 'eq' => static function ($item, $prop, $value) { |
|
1584 | + 'eq' => static function($item, $prop, $value) { |
|
1585 | 1585 | return $item[$prop] === $value; |
1586 | 1586 | }, |
1587 | - 'gt' => static function ($item, $prop, $value) { |
|
1587 | + 'gt' => static function($item, $prop, $value) { |
|
1588 | 1588 | return $item[$prop] > $value; |
1589 | 1589 | }, |
1590 | - 'ge' => static function ($item, $prop, $value) { |
|
1590 | + 'ge' => static function($item, $prop, $value) { |
|
1591 | 1591 | return $item[$prop] >= $value; |
1592 | 1592 | }, |
1593 | - 'gte' => static function ($item, $prop, $value) { |
|
1593 | + 'gte' => static function($item, $prop, $value) { |
|
1594 | 1594 | return $item[$prop] >= $value; |
1595 | 1595 | }, |
1596 | - 'lt' => static function ($item, $prop, $value) { |
|
1596 | + 'lt' => static function($item, $prop, $value) { |
|
1597 | 1597 | return $item[$prop] < $value; |
1598 | 1598 | }, |
1599 | - 'le' => static function ($item, $prop, $value) { |
|
1599 | + 'le' => static function($item, $prop, $value) { |
|
1600 | 1600 | return $item[$prop] <= $value; |
1601 | 1601 | }, |
1602 | - 'lte' => static function ($item, $prop, $value) { |
|
1602 | + 'lte' => static function($item, $prop, $value) { |
|
1603 | 1603 | return $item[$prop] <= $value; |
1604 | 1604 | }, |
1605 | - 'ne' => static function ($item, $prop, $value) { |
|
1605 | + 'ne' => static function($item, $prop, $value) { |
|
1606 | 1606 | return $item[$prop] !== $value; |
1607 | 1607 | }, |
1608 | - 'contains' => static function ($item, $prop, $value) { |
|
1608 | + 'contains' => static function($item, $prop, $value) { |
|
1609 | 1609 | return \in_array($item[$prop], (array) $value, true); |
1610 | 1610 | }, |
1611 | - 'notContains' => static function ($item, $prop, $value) { |
|
1611 | + 'notContains' => static function($item, $prop, $value) { |
|
1612 | 1612 | return !\in_array($item[$prop], (array) $value, true); |
1613 | 1613 | }, |
1614 | - 'newer' => static function ($item, $prop, $value) { |
|
1614 | + 'newer' => static function($item, $prop, $value) { |
|
1615 | 1615 | return \strtotime($item[$prop]) > \strtotime($value); |
1616 | 1616 | }, |
1617 | - 'older' => static function ($item, $prop, $value) { |
|
1617 | + 'older' => static function($item, $prop, $value) { |
|
1618 | 1618 | return \strtotime($item[$prop]) < \strtotime($value); |
1619 | 1619 | }, |
1620 | 1620 | ]; |
@@ -1622,7 +1622,7 @@ discard block |
||
1622 | 1622 | $result = \array_values( |
1623 | 1623 | \array_filter( |
1624 | 1624 | $this->getArray(), |
1625 | - static function ($item) use ( |
|
1625 | + static function($item) use ( |
|
1626 | 1626 | $property, |
1627 | 1627 | $value, |
1628 | 1628 | $ops, |
@@ -2170,7 +2170,7 @@ discard block |
||
2170 | 2170 | \array_uintersect( |
2171 | 2171 | $this->array, |
2172 | 2172 | $search, |
2173 | - static function ($a, $b) { |
|
2173 | + static function($a, $b) { |
|
2174 | 2174 | return $a === $b ? 0 : -1; |
2175 | 2175 | } |
2176 | 2176 | ), |
@@ -2387,13 +2387,13 @@ discard block |
||
2387 | 2387 | // non recursive |
2388 | 2388 | |
2389 | 2389 | if ($search_value === null) { |
2390 | - $arrayFunction = function () { |
|
2390 | + $arrayFunction = function() { |
|
2391 | 2391 | foreach ($this->array as $key => $value) { |
2392 | 2392 | yield $key; |
2393 | 2393 | } |
2394 | 2394 | }; |
2395 | 2395 | } else { |
2396 | - $arrayFunction = function () use ($search_value, $strict) { |
|
2396 | + $arrayFunction = function() use ($search_value, $strict) { |
|
2397 | 2397 | foreach ($this->array as $key => $value) { |
2398 | 2398 | if ($strict) { |
2399 | 2399 | if ($search_value === $value) { |
@@ -2892,7 +2892,7 @@ discard block |
||
2892 | 2892 | )->prependToEachKey($suffix) |
2893 | 2893 | ->toArray(); |
2894 | 2894 | } else { |
2895 | - $result[$key . $suffix] = $item; |
|
2895 | + $result[$key.$suffix] = $item; |
|
2896 | 2896 | } |
2897 | 2897 | } |
2898 | 2898 | |
@@ -2929,7 +2929,7 @@ discard block |
||
2929 | 2929 | } elseif (\is_object($item)) { |
2930 | 2930 | $result[$key] = $item; |
2931 | 2931 | } else { |
2932 | - $result[$key] = $item . $suffix; |
|
2932 | + $result[$key] = $item.$suffix; |
|
2933 | 2933 | } |
2934 | 2934 | } |
2935 | 2935 | |
@@ -3461,7 +3461,7 @@ discard block |
||
3461 | 3461 | public function replaceValues($search, $replacement = ''): self |
3462 | 3462 | { |
3463 | 3463 | $array = $this->each( |
3464 | - static function ($value) use ($search, $replacement) { |
|
3464 | + static function($value) use ($search, $replacement) { |
|
3465 | 3465 | return \str_replace($search, $replacement, $value); |
3466 | 3466 | } |
3467 | 3467 | ); |
@@ -3960,7 +3960,7 @@ discard block |
||
3960 | 3960 | ); |
3961 | 3961 | |
3962 | 3962 | $results = $arrayy->each( |
3963 | - function ($value) use ($sorter) { |
|
3963 | + function($value) use ($sorter) { |
|
3964 | 3964 | if (\is_callable($sorter)) { |
3965 | 3965 | return $sorter($value); |
3966 | 3966 | } |
@@ -4022,7 +4022,7 @@ discard block |
||
4022 | 4022 | public function stripEmpty(): self |
4023 | 4023 | { |
4024 | 4024 | return $this->filter( |
4025 | - static function ($item) { |
|
4025 | + static function($item) { |
|
4026 | 4026 | if ($item === null) { |
4027 | 4027 | return false; |
4028 | 4028 | } |
@@ -4107,7 +4107,7 @@ discard block |
||
4107 | 4107 | // INFO: \array_unique() can't handle e.g. "stdClass"-values in an array |
4108 | 4108 | |
4109 | 4109 | $this->array = $this->reduce( |
4110 | - static function ($resultArray, $value) { |
|
4110 | + static function($resultArray, $value) { |
|
4111 | 4111 | if (!\in_array($value, $resultArray, true)) { |
4112 | 4112 | $resultArray[] = $value; |
4113 | 4113 | } |
@@ -4136,7 +4136,7 @@ discard block |
||
4136 | 4136 | |
4137 | 4137 | $this->array = \array_reduce( |
4138 | 4138 | \array_keys($array), |
4139 | - static function ($resultArray, $key) use ($array) { |
|
4139 | + static function($resultArray, $key) use ($array) { |
|
4140 | 4140 | if (!\in_array($array[$key], $resultArray, true)) { |
4141 | 4141 | $resultArray[$key] = $array[$key]; |
4142 | 4142 | } |
@@ -4221,7 +4221,7 @@ discard block |
||
4221 | 4221 | public function values(): self |
4222 | 4222 | { |
4223 | 4223 | return static::create( |
4224 | - function () { |
|
4224 | + function() { |
|
4225 | 4225 | /** @noinspection YieldFromCanBeUsedInspection */ |
4226 | 4226 | foreach ($this->getGenerator() as $value) { |
4227 | 4227 | yield $value; |
@@ -4622,7 +4622,7 @@ discard block |
||
4622 | 4622 | $this->properties !== [] |
4623 | 4623 | ) { |
4624 | 4624 | if (isset($this->properties[$key]) === false) { |
4625 | - throw new \InvalidArgumentException('The key ' . $key . ' does not exists as @property in the class (' . \get_class($this) . ').'); |
|
4625 | + throw new \InvalidArgumentException('The key '.$key.' does not exists as @property in the class ('.\get_class($this).').'); |
|
4626 | 4626 | } |
4627 | 4627 | |
4628 | 4628 | $this->properties[$key]->checkType($value); |
@@ -4774,7 +4774,7 @@ discard block |
||
4774 | 4774 | private function getPropertiesFromPhpDoc(): array |
4775 | 4775 | { |
4776 | 4776 | static $PROPERTY_CACHE = []; |
4777 | - $cacheKey = 'Class::' . static::class; |
|
4777 | + $cacheKey = 'Class::'.static::class; |
|
4778 | 4778 | |
4779 | 4779 | if (isset($PROPERTY_CACHE[$cacheKey])) { |
4780 | 4780 | return $PROPERTY_CACHE[$cacheKey]; |
@@ -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 | } |