@@ -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); |
@@ -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 | /** |
@@ -4896,7 +4896,7 @@ discard block |
||
4896 | 4896 | } |
4897 | 4897 | |
4898 | 4898 | /** |
4899 | - * @param mixed $path |
|
4899 | + * @param string $path |
|
4900 | 4900 | * @param callable $callable |
4901 | 4901 | * @param array|null $currentOffset |
4902 | 4902 | * |
@@ -5039,7 +5039,7 @@ discard block |
||
5039 | 5039 | } |
5040 | 5040 | |
5041 | 5041 | /** |
5042 | - * @param mixed $glue |
|
5042 | + * @param string $glue |
|
5043 | 5043 | * @param mixed $pieces |
5044 | 5044 | * @param bool $useKeys |
5045 | 5045 | * |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | |
465 | 465 | $this->callAtPath( |
466 | 466 | $containerPath, |
467 | - static function ($container) use ($lastOffset, &$offsetExists) { |
|
467 | + static function($container) use ($lastOffset, &$offsetExists) { |
|
468 | 468 | $offsetExists = \array_key_exists($lastOffset, $container); |
469 | 469 | } |
470 | 470 | ); |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | |
551 | 551 | $this->callAtPath( |
552 | 552 | \implode($this->pathSeparator, $path), |
553 | - static function (&$offset) use ($pathToUnset) { |
|
553 | + static function(&$offset) use ($pathToUnset) { |
|
554 | 554 | unset($offset[$pathToUnset]); |
555 | 555 | } |
556 | 556 | ); |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | } |
597 | 597 | |
598 | 598 | if (\strpos($iteratorClass, '\\') === 0) { |
599 | - $iteratorClass = '\\' . $iteratorClass; |
|
599 | + $iteratorClass = '\\'.$iteratorClass; |
|
600 | 600 | if (\class_exists($iteratorClass)) { |
601 | 601 | $this->iteratorClass = $iteratorClass; |
602 | 602 | |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | } |
605 | 605 | } |
606 | 606 | |
607 | - throw new \InvalidArgumentException('The iterator class does not exist: ' . $iteratorClass); |
|
607 | + throw new \InvalidArgumentException('The iterator class does not exist: '.$iteratorClass); |
|
608 | 608 | } |
609 | 609 | |
610 | 610 | /** |
@@ -714,13 +714,13 @@ discard block |
||
714 | 714 | |
715 | 715 | foreach ($this->getGenerator() as $key => $item) { |
716 | 716 | if ($item instanceof self) { |
717 | - $result[$prefix . $key] = $item->appendToEachKey($prefix); |
|
717 | + $result[$prefix.$key] = $item->appendToEachKey($prefix); |
|
718 | 718 | } elseif (\is_array($item) === true) { |
719 | - $result[$prefix . $key] = self::create($item, $this->iteratorClass, false) |
|
719 | + $result[$prefix.$key] = self::create($item, $this->iteratorClass, false) |
|
720 | 720 | ->appendToEachKey($prefix) |
721 | 721 | ->toArray(); |
722 | 722 | } else { |
723 | - $result[$prefix . $key] = $item; |
|
723 | + $result[$prefix.$key] = $item; |
|
724 | 724 | } |
725 | 725 | } |
726 | 726 | |
@@ -748,7 +748,7 @@ discard block |
||
748 | 748 | } elseif (\is_object($item) === true) { |
749 | 749 | $result[$key] = $item; |
750 | 750 | } else { |
751 | - $result[$key] = $prefix . $item; |
|
751 | + $result[$key] = $prefix.$item; |
|
752 | 752 | } |
753 | 753 | } |
754 | 754 | |
@@ -897,7 +897,7 @@ discard block |
||
897 | 897 | public function clean(): self |
898 | 898 | { |
899 | 899 | return $this->filter( |
900 | - static function ($value) { |
|
900 | + static function($value) { |
|
901 | 901 | return (bool) $value; |
902 | 902 | } |
903 | 903 | ); |
@@ -1256,7 +1256,7 @@ discard block |
||
1256 | 1256 | // trim all string in the array |
1257 | 1257 | \array_walk( |
1258 | 1258 | $array, |
1259 | - static function (&$val) { |
|
1259 | + static function(&$val) { |
|
1260 | 1260 | if ((string) $val === $val) { |
1261 | 1261 | $val = \trim($val); |
1262 | 1262 | } |
@@ -1663,40 +1663,40 @@ discard block |
||
1663 | 1663 | } |
1664 | 1664 | |
1665 | 1665 | $ops = [ |
1666 | - 'eq' => static function ($item, $prop, $value): bool { |
|
1666 | + 'eq' => static function($item, $prop, $value): bool { |
|
1667 | 1667 | return $item[$prop] === $value; |
1668 | 1668 | }, |
1669 | - 'gt' => static function ($item, $prop, $value): bool { |
|
1669 | + 'gt' => static function($item, $prop, $value): bool { |
|
1670 | 1670 | return $item[$prop] > $value; |
1671 | 1671 | }, |
1672 | - 'ge' => static function ($item, $prop, $value): bool { |
|
1672 | + 'ge' => static function($item, $prop, $value): bool { |
|
1673 | 1673 | return $item[$prop] >= $value; |
1674 | 1674 | }, |
1675 | - 'gte' => static function ($item, $prop, $value): bool { |
|
1675 | + 'gte' => static function($item, $prop, $value): bool { |
|
1676 | 1676 | return $item[$prop] >= $value; |
1677 | 1677 | }, |
1678 | - 'lt' => static function ($item, $prop, $value): bool { |
|
1678 | + 'lt' => static function($item, $prop, $value): bool { |
|
1679 | 1679 | return $item[$prop] < $value; |
1680 | 1680 | }, |
1681 | - 'le' => static function ($item, $prop, $value): bool { |
|
1681 | + 'le' => static function($item, $prop, $value): bool { |
|
1682 | 1682 | return $item[$prop] <= $value; |
1683 | 1683 | }, |
1684 | - 'lte' => static function ($item, $prop, $value): bool { |
|
1684 | + 'lte' => static function($item, $prop, $value): bool { |
|
1685 | 1685 | return $item[$prop] <= $value; |
1686 | 1686 | }, |
1687 | - 'ne' => static function ($item, $prop, $value): bool { |
|
1687 | + 'ne' => static function($item, $prop, $value): bool { |
|
1688 | 1688 | return $item[$prop] !== $value; |
1689 | 1689 | }, |
1690 | - 'contains' => static function ($item, $prop, $value): bool { |
|
1690 | + 'contains' => static function($item, $prop, $value): bool { |
|
1691 | 1691 | return \in_array($item[$prop], (array) $value, true); |
1692 | 1692 | }, |
1693 | - 'notContains' => static function ($item, $prop, $value): bool { |
|
1693 | + 'notContains' => static function($item, $prop, $value): bool { |
|
1694 | 1694 | return !\in_array($item[$prop], (array) $value, true); |
1695 | 1695 | }, |
1696 | - 'newer' => static function ($item, $prop, $value): bool { |
|
1696 | + 'newer' => static function($item, $prop, $value): bool { |
|
1697 | 1697 | return \strtotime($item[$prop]) > \strtotime($value); |
1698 | 1698 | }, |
1699 | - 'older' => static function ($item, $prop, $value): bool { |
|
1699 | + 'older' => static function($item, $prop, $value): bool { |
|
1700 | 1700 | return \strtotime($item[$prop]) < \strtotime($value); |
1701 | 1701 | }, |
1702 | 1702 | ]; |
@@ -1704,7 +1704,7 @@ discard block |
||
1704 | 1704 | $result = \array_values( |
1705 | 1705 | \array_filter( |
1706 | 1706 | $this->getArray(), |
1707 | - static function ($item) use ( |
|
1707 | + static function($item) use ( |
|
1708 | 1708 | $property, |
1709 | 1709 | $value, |
1710 | 1710 | $ops, |
@@ -2382,7 +2382,7 @@ discard block |
||
2382 | 2382 | \array_uintersect( |
2383 | 2383 | $this->array, |
2384 | 2384 | $search, |
2385 | - static function ($a, $b) { |
|
2385 | + static function($a, $b) { |
|
2386 | 2386 | return $a === $b ? 0 : -1; |
2387 | 2387 | } |
2388 | 2388 | ), |
@@ -2657,13 +2657,13 @@ discard block |
||
2657 | 2657 | // non recursive |
2658 | 2658 | |
2659 | 2659 | if ($search_values === null) { |
2660 | - $arrayFunction = function (): \Generator { |
|
2660 | + $arrayFunction = function(): \Generator { |
|
2661 | 2661 | foreach ($this->getGenerator() as $key => $value) { |
2662 | 2662 | yield $key; |
2663 | 2663 | } |
2664 | 2664 | }; |
2665 | 2665 | } else { |
2666 | - $arrayFunction = function () use ($search_values, $strict): \Generator { |
|
2666 | + $arrayFunction = function() use ($search_values, $strict): \Generator { |
|
2667 | 2667 | $is_array_tmp = \is_array($search_values); |
2668 | 2668 | |
2669 | 2669 | foreach ($this->getGenerator() as $key => $value) { |
@@ -2863,7 +2863,7 @@ discard block |
||
2863 | 2863 | $useArguments = \func_num_args() > 2; |
2864 | 2864 | |
2865 | 2865 | return static::create( |
2866 | - function () use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
2866 | + function() use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
2867 | 2867 | foreach ($this->getGenerator() as $key => $value) { |
2868 | 2868 | if ($useArguments) { |
2869 | 2869 | if ($useKeyAsSecondParameter) { |
@@ -3340,7 +3340,7 @@ discard block |
||
3340 | 3340 | )->prependToEachKey($suffix) |
3341 | 3341 | ->toArray(); |
3342 | 3342 | } else { |
3343 | - $result[$key . $suffix] = $item; |
|
3343 | + $result[$key.$suffix] = $item; |
|
3344 | 3344 | } |
3345 | 3345 | } |
3346 | 3346 | |
@@ -3377,7 +3377,7 @@ discard block |
||
3377 | 3377 | } elseif (\is_object($item) === true) { |
3378 | 3378 | $result[$key] = $item; |
3379 | 3379 | } else { |
3380 | - $result[$key] = $item . $suffix; |
|
3380 | + $result[$key] = $item.$suffix; |
|
3381 | 3381 | } |
3382 | 3382 | } |
3383 | 3383 | |
@@ -3987,7 +3987,7 @@ discard block |
||
3987 | 3987 | public function replaceValues($search, $replacement = ''): self |
3988 | 3988 | { |
3989 | 3989 | return $this->each( |
3990 | - static function ($value) use ($search, $replacement) { |
|
3990 | + static function($value) use ($search, $replacement) { |
|
3991 | 3991 | return \str_replace($search, $replacement, $value); |
3992 | 3992 | } |
3993 | 3993 | ); |
@@ -4485,7 +4485,7 @@ discard block |
||
4485 | 4485 | ); |
4486 | 4486 | |
4487 | 4487 | $results = $arrayy->each( |
4488 | - function ($value) use ($sorter) { |
|
4488 | + function($value) use ($sorter) { |
|
4489 | 4489 | if (\is_callable($sorter) === true) { |
4490 | 4490 | return $sorter($value); |
4491 | 4491 | } |
@@ -4568,7 +4568,7 @@ discard block |
||
4568 | 4568 | public function stripEmpty(): self |
4569 | 4569 | { |
4570 | 4570 | return $this->filter( |
4571 | - static function ($item) { |
|
4571 | + static function($item) { |
|
4572 | 4572 | if ($item === null) { |
4573 | 4573 | return false; |
4574 | 4574 | } |
@@ -4656,7 +4656,7 @@ discard block |
||
4656 | 4656 | // INFO: \array_unique() can't handle e.g. "stdClass"-values in an array |
4657 | 4657 | |
4658 | 4658 | $this->array = $this->reduce( |
4659 | - static function ($resultArray, $value) { |
|
4659 | + static function($resultArray, $value) { |
|
4660 | 4660 | if (!\in_array($value, $resultArray, true)) { |
4661 | 4661 | $resultArray[] = $value; |
4662 | 4662 | } |
@@ -4685,7 +4685,7 @@ discard block |
||
4685 | 4685 | |
4686 | 4686 | $this->array = \array_reduce( |
4687 | 4687 | \array_keys($array), |
4688 | - static function ($resultArray, $key) use ($array) { |
|
4688 | + static function($resultArray, $key) use ($array) { |
|
4689 | 4689 | if (!\in_array($array[$key], $resultArray, true)) { |
4690 | 4690 | $resultArray[$key] = $array[$key]; |
4691 | 4691 | } |
@@ -4744,7 +4744,7 @@ discard block |
||
4744 | 4744 | public function values(): self |
4745 | 4745 | { |
4746 | 4746 | return static::create( |
4747 | - function () { |
|
4747 | + function() { |
|
4748 | 4748 | /** @noinspection YieldFromCanBeUsedInspection */ |
4749 | 4749 | foreach ($this->getGenerator() as $value) { |
4750 | 4750 | yield $value; |
@@ -5001,7 +5001,7 @@ discard block |
||
5001 | 5001 | protected function getPropertiesFromPhpDoc() |
5002 | 5002 | { |
5003 | 5003 | static $PROPERTY_CACHE = []; |
5004 | - $cacheKey = 'Class::' . static::class; |
|
5004 | + $cacheKey = 'Class::'.static::class; |
|
5005 | 5005 | |
5006 | 5006 | if (isset($PROPERTY_CACHE[$cacheKey])) { |
5007 | 5007 | return $PROPERTY_CACHE[$cacheKey]; |
@@ -5316,7 +5316,7 @@ discard block |
||
5316 | 5316 | && |
5317 | 5317 | \count(\array_diff_key($this->properties, $data)) > 0 |
5318 | 5318 | ) { |
5319 | - throw new \TypeError('Property mismatch - input: ' . \print_r(\array_keys($data), true) . ' | expected: ' . \print_r(\array_keys($this->properties), true)); |
|
5319 | + throw new \TypeError('Property mismatch - input: '.\print_r(\array_keys($data), true).' | expected: '.\print_r(\array_keys($this->properties), true)); |
|
5320 | 5320 | } |
5321 | 5321 | |
5322 | 5322 | foreach ($data as $key => &$valueInner) { |
@@ -5415,7 +5415,7 @@ discard block |
||
5415 | 5415 | && |
5416 | 5416 | $this->checkPropertiesMismatch === true |
5417 | 5417 | ) { |
5418 | - throw new \TypeError('The key ' . $key . ' does not exists in "properties". Maybe because @property was not used for the class (' . \get_class($this) . ').'); |
|
5418 | + throw new \TypeError('The key '.$key.' does not exists in "properties". Maybe because @property was not used for the class ('.\get_class($this).').'); |
|
5419 | 5419 | } |
5420 | 5420 | |
5421 | 5421 | if (isset($this->properties[self::ARRAYY_HELPER_TYPES_FOR_ALL_PROPERTIES])) { |
@@ -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 ''; |
@@ -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 | /** |
@@ -242,6 +242,7 @@ |
||
242 | 242 | * Merge current items and items of given collections into a new one. |
243 | 243 | * |
244 | 244 | * @param self ...$collections The collections to merge. |
245 | + * @param \self[] $collections |
|
245 | 246 | * |
246 | 247 | * @throws \InvalidArgumentException if any of the given collections are not of the same type |
247 | 248 | * |
@@ -205,7 +205,7 @@ |
||
205 | 205 | public function where(string $keyOrPropertyOrMethod, $value): self |
206 | 206 | { |
207 | 207 | return $this->filter( |
208 | - function ($item) use ($keyOrPropertyOrMethod, $value) { |
|
208 | + function($item) use ($keyOrPropertyOrMethod, $value) { |
|
209 | 209 | $accessorValue = $this->extractValue( |
210 | 210 | $item, |
211 | 211 | $keyOrPropertyOrMethod |