@@ -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 | /** |
@@ -4439,7 +4439,7 @@ discard block |
||
4439 | 4439 | } |
4440 | 4440 | |
4441 | 4441 | /** |
4442 | - * @param mixed $path |
|
4442 | + * @param string $path |
|
4443 | 4443 | * @param callable $callable |
4444 | 4444 | * @param array|null $currentOffset |
4445 | 4445 | */ |
@@ -4534,7 +4534,7 @@ discard block |
||
4534 | 4534 | } |
4535 | 4535 | |
4536 | 4536 | /** |
4537 | - * @param mixed $glue |
|
4537 | + * @param string $glue |
|
4538 | 4538 | * @param mixed $pieces |
4539 | 4539 | * @param bool $useKeys |
4540 | 4540 | * |
@@ -1003,11 +1003,11 @@ discard block |
||
1003 | 1003 | \array_intersect($needles, $this->keys()->getArray()), |
1004 | 1004 | \COUNT_NORMAL |
1005 | 1005 | ) |
1006 | - === |
|
1007 | - \count( |
|
1008 | - $needles, |
|
1009 | - \COUNT_NORMAL |
|
1010 | - ); |
|
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 | /** |
@@ -2516,15 +2516,15 @@ discard block |
||
2516 | 2516 | |
2517 | 2517 | if ($recursive === true) { |
2518 | 2518 | return $this->array_keys_recursive($this->getArray()) |
2519 | - === |
|
2520 | - \range(0, \count($this->getArray(), \COUNT_RECURSIVE) - 1); |
|
2519 | + === |
|
2520 | + \range(0, \count($this->getArray(), \COUNT_RECURSIVE) - 1); |
|
2521 | 2521 | } |
2522 | 2522 | |
2523 | 2523 | // non recursive |
2524 | 2524 | |
2525 | 2525 | return \array_keys($this->getArray()) |
2526 | - === |
|
2527 | - \range(0, \count($this->getArray(), \COUNT_NORMAL) - 1); |
|
2526 | + === |
|
2527 | + \range(0, \count($this->getArray(), \COUNT_NORMAL) - 1); |
|
2528 | 2528 | } |
2529 | 2529 | |
2530 | 2530 | /** |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | && |
102 | 102 | \count(\array_diff_key($this->properties, $data)) > 0 |
103 | 103 | ) { |
104 | - throw new \InvalidArgumentException('Property mismatch - input: ' . \print_r(\array_keys($data), true) . ' | expected: ' . \print_r(\array_keys($this->properties), true)); |
|
104 | + throw new \InvalidArgumentException('Property mismatch - input: '.\print_r(\array_keys($data), true).' | expected: '.\print_r(\array_keys($this->properties), true)); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** @noinspection AlterInForeachInspection */ |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | |
464 | 464 | $this->callAtPath( |
465 | 465 | $containerPath, |
466 | - static function ($container) use ($lastOffset, &$offsetExists) { |
|
466 | + static function($container) use ($lastOffset, &$offsetExists) { |
|
467 | 467 | $offsetExists = \array_key_exists($lastOffset, $container); |
468 | 468 | } |
469 | 469 | ); |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | |
538 | 538 | $this->callAtPath( |
539 | 539 | \implode($this->pathSeparator, $path), |
540 | - static function (&$offset) use ($pathToUnset) { |
|
540 | + static function(&$offset) use ($pathToUnset) { |
|
541 | 541 | unset($offset[$pathToUnset]); |
542 | 542 | } |
543 | 543 | ); |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | } |
576 | 576 | |
577 | 577 | if (\strpos($class, '\\') === 0) { |
578 | - $class = '\\' . $class; |
|
578 | + $class = '\\'.$class; |
|
579 | 579 | if (\class_exists($class)) { |
580 | 580 | $this->iteratorClass = $class; |
581 | 581 | |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | } |
584 | 584 | } |
585 | 585 | |
586 | - throw new \InvalidArgumentException('The iterator class does not exist: ' . $class); |
|
586 | + throw new \InvalidArgumentException('The iterator class does not exist: '.$class); |
|
587 | 587 | } |
588 | 588 | |
589 | 589 | /** |
@@ -691,13 +691,13 @@ discard block |
||
691 | 691 | |
692 | 692 | foreach ($this->getGenerator() as $key => $item) { |
693 | 693 | if ($item instanceof self) { |
694 | - $result[$prefix . $key] = $item->appendToEachKey($prefix); |
|
694 | + $result[$prefix.$key] = $item->appendToEachKey($prefix); |
|
695 | 695 | } elseif (\is_array($item) === true) { |
696 | - $result[$prefix . $key] = self::create($item, $this->iteratorClass, false) |
|
696 | + $result[$prefix.$key] = self::create($item, $this->iteratorClass, false) |
|
697 | 697 | ->appendToEachKey($prefix) |
698 | 698 | ->toArray(); |
699 | 699 | } else { |
700 | - $result[$prefix . $key] = $item; |
|
700 | + $result[$prefix.$key] = $item; |
|
701 | 701 | } |
702 | 702 | } |
703 | 703 | |
@@ -725,7 +725,7 @@ discard block |
||
725 | 725 | } elseif (\is_object($item) === true) { |
726 | 726 | $result[$key] = $item; |
727 | 727 | } else { |
728 | - $result[$key] = $prefix . $item; |
|
728 | + $result[$key] = $prefix.$item; |
|
729 | 729 | } |
730 | 730 | } |
731 | 731 | |
@@ -874,7 +874,7 @@ discard block |
||
874 | 874 | public function clean(): self |
875 | 875 | { |
876 | 876 | return $this->filter( |
877 | - static function ($value) { |
|
877 | + static function($value) { |
|
878 | 878 | return (bool) $value; |
879 | 879 | } |
880 | 880 | ); |
@@ -1228,7 +1228,7 @@ discard block |
||
1228 | 1228 | // trim all string in the array |
1229 | 1229 | \array_walk( |
1230 | 1230 | $array, |
1231 | - static function (&$val) { |
|
1231 | + static function(&$val) { |
|
1232 | 1232 | if ((string) $val === $val) { |
1233 | 1233 | $val = \trim($val); |
1234 | 1234 | } |
@@ -1617,40 +1617,40 @@ discard block |
||
1617 | 1617 | } |
1618 | 1618 | |
1619 | 1619 | $ops = [ |
1620 | - 'eq' => static function ($item, $prop, $value) { |
|
1620 | + 'eq' => static function($item, $prop, $value) { |
|
1621 | 1621 | return $item[$prop] === $value; |
1622 | 1622 | }, |
1623 | - 'gt' => static function ($item, $prop, $value) { |
|
1623 | + 'gt' => static function($item, $prop, $value) { |
|
1624 | 1624 | return $item[$prop] > $value; |
1625 | 1625 | }, |
1626 | - 'ge' => static function ($item, $prop, $value) { |
|
1626 | + 'ge' => static function($item, $prop, $value) { |
|
1627 | 1627 | return $item[$prop] >= $value; |
1628 | 1628 | }, |
1629 | - 'gte' => static function ($item, $prop, $value) { |
|
1629 | + 'gte' => static function($item, $prop, $value) { |
|
1630 | 1630 | return $item[$prop] >= $value; |
1631 | 1631 | }, |
1632 | - 'lt' => static function ($item, $prop, $value) { |
|
1632 | + 'lt' => static function($item, $prop, $value) { |
|
1633 | 1633 | return $item[$prop] < $value; |
1634 | 1634 | }, |
1635 | - 'le' => static function ($item, $prop, $value) { |
|
1635 | + 'le' => static function($item, $prop, $value) { |
|
1636 | 1636 | return $item[$prop] <= $value; |
1637 | 1637 | }, |
1638 | - 'lte' => static function ($item, $prop, $value) { |
|
1638 | + 'lte' => static function($item, $prop, $value) { |
|
1639 | 1639 | return $item[$prop] <= $value; |
1640 | 1640 | }, |
1641 | - 'ne' => static function ($item, $prop, $value) { |
|
1641 | + 'ne' => static function($item, $prop, $value) { |
|
1642 | 1642 | return $item[$prop] !== $value; |
1643 | 1643 | }, |
1644 | - 'contains' => static function ($item, $prop, $value) { |
|
1644 | + 'contains' => static function($item, $prop, $value) { |
|
1645 | 1645 | return \in_array($item[$prop], (array) $value, true); |
1646 | 1646 | }, |
1647 | - 'notContains' => static function ($item, $prop, $value) { |
|
1647 | + 'notContains' => static function($item, $prop, $value) { |
|
1648 | 1648 | return !\in_array($item[$prop], (array) $value, true); |
1649 | 1649 | }, |
1650 | - 'newer' => static function ($item, $prop, $value) { |
|
1650 | + 'newer' => static function($item, $prop, $value) { |
|
1651 | 1651 | return \strtotime($item[$prop]) > \strtotime($value); |
1652 | 1652 | }, |
1653 | - 'older' => static function ($item, $prop, $value) { |
|
1653 | + 'older' => static function($item, $prop, $value) { |
|
1654 | 1654 | return \strtotime($item[$prop]) < \strtotime($value); |
1655 | 1655 | }, |
1656 | 1656 | ]; |
@@ -1658,7 +1658,7 @@ discard block |
||
1658 | 1658 | $result = \array_values( |
1659 | 1659 | \array_filter( |
1660 | 1660 | $this->getArray(), |
1661 | - static function ($item) use ( |
|
1661 | + static function($item) use ( |
|
1662 | 1662 | $property, |
1663 | 1663 | $value, |
1664 | 1664 | $ops, |
@@ -2261,7 +2261,7 @@ discard block |
||
2261 | 2261 | \array_uintersect( |
2262 | 2262 | $this->array, |
2263 | 2263 | $search, |
2264 | - static function ($a, $b) { |
|
2264 | + static function($a, $b) { |
|
2265 | 2265 | return $a === $b ? 0 : -1; |
2266 | 2266 | } |
2267 | 2267 | ), |
@@ -2509,13 +2509,13 @@ discard block |
||
2509 | 2509 | // non recursive |
2510 | 2510 | |
2511 | 2511 | if ($search_values === null) { |
2512 | - $arrayFunction = function () { |
|
2512 | + $arrayFunction = function() { |
|
2513 | 2513 | foreach ($this->getGenerator() as $key => $value) { |
2514 | 2514 | yield $key; |
2515 | 2515 | } |
2516 | 2516 | }; |
2517 | 2517 | } else { |
2518 | - $arrayFunction = function () use ($search_values, $strict) { |
|
2518 | + $arrayFunction = function() use ($search_values, $strict) { |
|
2519 | 2519 | $is_array_tmp = \is_array($search_values); |
2520 | 2520 | |
2521 | 2521 | foreach ($this->getGenerator() as $key => $value) { |
@@ -2715,7 +2715,7 @@ discard block |
||
2715 | 2715 | $useArguments = \func_num_args() > 2; |
2716 | 2716 | |
2717 | 2717 | return static::create( |
2718 | - function () use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
2718 | + function() use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
2719 | 2719 | foreach ($this->getGenerator() as $key => $value) { |
2720 | 2720 | if ($useArguments) { |
2721 | 2721 | if ($useKeyAsSecondParameter) { |
@@ -3149,7 +3149,7 @@ discard block |
||
3149 | 3149 | )->prependToEachKey($suffix) |
3150 | 3150 | ->toArray(); |
3151 | 3151 | } else { |
3152 | - $result[$key . $suffix] = $item; |
|
3152 | + $result[$key.$suffix] = $item; |
|
3153 | 3153 | } |
3154 | 3154 | } |
3155 | 3155 | |
@@ -3186,7 +3186,7 @@ discard block |
||
3186 | 3186 | } elseif (\is_object($item) === true) { |
3187 | 3187 | $result[$key] = $item; |
3188 | 3188 | } else { |
3189 | - $result[$key] = $item . $suffix; |
|
3189 | + $result[$key] = $item.$suffix; |
|
3190 | 3190 | } |
3191 | 3191 | } |
3192 | 3192 | |
@@ -3776,7 +3776,7 @@ discard block |
||
3776 | 3776 | public function replaceValues($search, $replacement = ''): self |
3777 | 3777 | { |
3778 | 3778 | return $this->each( |
3779 | - static function ($value) use ($search, $replacement) { |
|
3779 | + static function($value) use ($search, $replacement) { |
|
3780 | 3780 | return \str_replace($search, $replacement, $value); |
3781 | 3781 | } |
3782 | 3782 | ); |
@@ -4274,7 +4274,7 @@ discard block |
||
4274 | 4274 | ); |
4275 | 4275 | |
4276 | 4276 | $results = $arrayy->each( |
4277 | - function ($value) use ($sorter) { |
|
4277 | + function($value) use ($sorter) { |
|
4278 | 4278 | if (\is_callable($sorter) === true) { |
4279 | 4279 | return $sorter($value); |
4280 | 4280 | } |
@@ -4336,7 +4336,7 @@ discard block |
||
4336 | 4336 | public function stripEmpty(): self |
4337 | 4337 | { |
4338 | 4338 | return $this->filter( |
4339 | - static function ($item) { |
|
4339 | + static function($item) { |
|
4340 | 4340 | if ($item === null) { |
4341 | 4341 | return false; |
4342 | 4342 | } |
@@ -4420,7 +4420,7 @@ discard block |
||
4420 | 4420 | // INFO: \array_unique() can't handle e.g. "stdClass"-values in an array |
4421 | 4421 | |
4422 | 4422 | $this->array = $this->reduce( |
4423 | - static function ($resultArray, $value) { |
|
4423 | + static function($resultArray, $value) { |
|
4424 | 4424 | if (!\in_array($value, $resultArray, true)) { |
4425 | 4425 | $resultArray[] = $value; |
4426 | 4426 | } |
@@ -4449,7 +4449,7 @@ discard block |
||
4449 | 4449 | |
4450 | 4450 | $this->array = \array_reduce( |
4451 | 4451 | \array_keys($array), |
4452 | - static function ($resultArray, $key) use ($array) { |
|
4452 | + static function($resultArray, $key) use ($array) { |
|
4453 | 4453 | if (!\in_array($array[$key], $resultArray, true)) { |
4454 | 4454 | $resultArray[$key] = $array[$key]; |
4455 | 4455 | } |
@@ -4509,7 +4509,7 @@ discard block |
||
4509 | 4509 | public function values(): self |
4510 | 4510 | { |
4511 | 4511 | return static::create( |
4512 | - function () { |
|
4512 | + function() { |
|
4513 | 4513 | /** @noinspection YieldFromCanBeUsedInspection */ |
4514 | 4514 | foreach ($this->getGenerator() as $value) { |
4515 | 4515 | yield $value; |
@@ -4938,7 +4938,7 @@ discard block |
||
4938 | 4938 | $this->properties !== [] |
4939 | 4939 | ) { |
4940 | 4940 | if (isset($this->properties[$key]) === false) { |
4941 | - throw new \InvalidArgumentException('The key ' . $key . ' does not exists as @property in the class (' . \get_class($this) . ').'); |
|
4941 | + throw new \InvalidArgumentException('The key '.$key.' does not exists as @property in the class ('.\get_class($this).').'); |
|
4942 | 4942 | } |
4943 | 4943 | |
4944 | 4944 | $this->properties[$key]->checkType($value); |
@@ -5094,7 +5094,7 @@ discard block |
||
5094 | 5094 | private function getPropertiesFromPhpDoc() |
5095 | 5095 | { |
5096 | 5096 | static $PROPERTY_CACHE = []; |
5097 | - $cacheKey = 'Class::' . static::class; |
|
5097 | + $cacheKey = 'Class::'.static::class; |
|
5098 | 5098 | |
5099 | 5099 | if (isset($PROPERTY_CACHE[$cacheKey])) { |
5100 | 5100 | return $PROPERTY_CACHE[$cacheKey]; |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | public function where(string $keyOrPropertyOrMethod, $value): CollectionInterface |
196 | 196 | { |
197 | 197 | return $this->filter( |
198 | - function ($item) use ($keyOrPropertyOrMethod, $value) { |
|
198 | + function($item) use ($keyOrPropertyOrMethod, $value) { |
|
199 | 199 | $accessorValue = $this->extractValue( |
200 | 200 | $item, |
201 | 201 | $keyOrPropertyOrMethod |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | { |
238 | 238 | if ($this->checkType($this->collectionType, $value) === false) { |
239 | 239 | throw new \InvalidArgumentException( |
240 | - 'Value must be of type ' . $this->collectionType . '; type is ' . \gettype($value) . ', value is "' . $this->valueToString($value) . '"' |
|
240 | + 'Value must be of type '.$this->collectionType.'; type is '.\gettype($value).', value is "'.$this->valueToString($value).'"' |
|
241 | 241 | ); |
242 | 242 | } |
243 | 243 | } |
@@ -350,10 +350,10 @@ discard block |
||
350 | 350 | |
351 | 351 | // resource |
352 | 352 | if (\is_resource($value)) { |
353 | - return \get_resource_type($value) . ' resource #' . (int) $value; |
|
353 | + return \get_resource_type($value).' resource #'.(int) $value; |
|
354 | 354 | } |
355 | 355 | |
356 | 356 | // object |
357 | - return \get_class($value) . ' Object'; |
|
357 | + return \get_class($value).' Object'; |
|
358 | 358 | } |
359 | 359 | } |