@@ -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 | * |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | |
472 | 472 | $this->callAtPath( |
473 | 473 | $containerPath, |
474 | - static function ($container) use ($lastOffset, &$offsetExists) { |
|
474 | + static function($container) use ($lastOffset, &$offsetExists) { |
|
475 | 475 | $offsetExists = \array_key_exists($lastOffset, $container); |
476 | 476 | } |
477 | 477 | ); |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | |
558 | 558 | $this->callAtPath( |
559 | 559 | \implode($this->pathSeparator, $path), |
560 | - static function (&$offset) use ($pathToUnset) { |
|
560 | + static function(&$offset) use ($pathToUnset) { |
|
561 | 561 | unset($offset[$pathToUnset]); |
562 | 562 | } |
563 | 563 | ); |
@@ -603,7 +603,7 @@ discard block |
||
603 | 603 | } |
604 | 604 | |
605 | 605 | if (\strpos($iteratorClass, '\\') === 0) { |
606 | - $iteratorClass = '\\' . $iteratorClass; |
|
606 | + $iteratorClass = '\\'.$iteratorClass; |
|
607 | 607 | if (\class_exists($iteratorClass)) { |
608 | 608 | $this->iteratorClass = $iteratorClass; |
609 | 609 | |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | } |
612 | 612 | } |
613 | 613 | |
614 | - throw new \InvalidArgumentException('The iterator class does not exist: ' . $iteratorClass); |
|
614 | + throw new \InvalidArgumentException('The iterator class does not exist: '.$iteratorClass); |
|
615 | 615 | } |
616 | 616 | |
617 | 617 | /** |
@@ -721,13 +721,13 @@ discard block |
||
721 | 721 | |
722 | 722 | foreach ($this->getGenerator() as $key => $item) { |
723 | 723 | if ($item instanceof self) { |
724 | - $result[$prefix . $key] = $item->appendToEachKey($prefix); |
|
724 | + $result[$prefix.$key] = $item->appendToEachKey($prefix); |
|
725 | 725 | } elseif (\is_array($item) === true) { |
726 | - $result[$prefix . $key] = self::create($item, $this->iteratorClass, false) |
|
726 | + $result[$prefix.$key] = self::create($item, $this->iteratorClass, false) |
|
727 | 727 | ->appendToEachKey($prefix) |
728 | 728 | ->toArray(); |
729 | 729 | } else { |
730 | - $result[$prefix . $key] = $item; |
|
730 | + $result[$prefix.$key] = $item; |
|
731 | 731 | } |
732 | 732 | } |
733 | 733 | |
@@ -755,7 +755,7 @@ discard block |
||
755 | 755 | } elseif (\is_object($item) === true) { |
756 | 756 | $result[$key] = $item; |
757 | 757 | } else { |
758 | - $result[$key] = $prefix . $item; |
|
758 | + $result[$key] = $prefix.$item; |
|
759 | 759 | } |
760 | 760 | } |
761 | 761 | |
@@ -904,7 +904,7 @@ discard block |
||
904 | 904 | public function clean(): self |
905 | 905 | { |
906 | 906 | return $this->filter( |
907 | - static function ($value) { |
|
907 | + static function($value) { |
|
908 | 908 | return (bool) $value; |
909 | 909 | } |
910 | 910 | ); |
@@ -1263,7 +1263,7 @@ discard block |
||
1263 | 1263 | // trim all string in the array |
1264 | 1264 | \array_walk( |
1265 | 1265 | $array, |
1266 | - static function (&$val) { |
|
1266 | + static function(&$val) { |
|
1267 | 1267 | if ((string) $val === $val) { |
1268 | 1268 | $val = \trim($val); |
1269 | 1269 | } |
@@ -1670,40 +1670,40 @@ discard block |
||
1670 | 1670 | } |
1671 | 1671 | |
1672 | 1672 | $ops = [ |
1673 | - 'eq' => static function ($item, $prop, $value): bool { |
|
1673 | + 'eq' => static function($item, $prop, $value): bool { |
|
1674 | 1674 | return $item[$prop] === $value; |
1675 | 1675 | }, |
1676 | - 'gt' => static function ($item, $prop, $value): bool { |
|
1676 | + 'gt' => static function($item, $prop, $value): bool { |
|
1677 | 1677 | return $item[$prop] > $value; |
1678 | 1678 | }, |
1679 | - 'ge' => static function ($item, $prop, $value): bool { |
|
1679 | + 'ge' => static function($item, $prop, $value): bool { |
|
1680 | 1680 | return $item[$prop] >= $value; |
1681 | 1681 | }, |
1682 | - 'gte' => static function ($item, $prop, $value): bool { |
|
1682 | + 'gte' => static function($item, $prop, $value): bool { |
|
1683 | 1683 | return $item[$prop] >= $value; |
1684 | 1684 | }, |
1685 | - 'lt' => static function ($item, $prop, $value): bool { |
|
1685 | + 'lt' => static function($item, $prop, $value): bool { |
|
1686 | 1686 | return $item[$prop] < $value; |
1687 | 1687 | }, |
1688 | - 'le' => static function ($item, $prop, $value): bool { |
|
1688 | + 'le' => static function($item, $prop, $value): bool { |
|
1689 | 1689 | return $item[$prop] <= $value; |
1690 | 1690 | }, |
1691 | - 'lte' => static function ($item, $prop, $value): bool { |
|
1691 | + 'lte' => static function($item, $prop, $value): bool { |
|
1692 | 1692 | return $item[$prop] <= $value; |
1693 | 1693 | }, |
1694 | - 'ne' => static function ($item, $prop, $value): bool { |
|
1694 | + 'ne' => static function($item, $prop, $value): bool { |
|
1695 | 1695 | return $item[$prop] !== $value; |
1696 | 1696 | }, |
1697 | - 'contains' => static function ($item, $prop, $value): bool { |
|
1697 | + 'contains' => static function($item, $prop, $value): bool { |
|
1698 | 1698 | return \in_array($item[$prop], (array) $value, true); |
1699 | 1699 | }, |
1700 | - 'notContains' => static function ($item, $prop, $value): bool { |
|
1700 | + 'notContains' => static function($item, $prop, $value): bool { |
|
1701 | 1701 | return !\in_array($item[$prop], (array) $value, true); |
1702 | 1702 | }, |
1703 | - 'newer' => static function ($item, $prop, $value): bool { |
|
1703 | + 'newer' => static function($item, $prop, $value): bool { |
|
1704 | 1704 | return \strtotime($item[$prop]) > \strtotime($value); |
1705 | 1705 | }, |
1706 | - 'older' => static function ($item, $prop, $value): bool { |
|
1706 | + 'older' => static function($item, $prop, $value): bool { |
|
1707 | 1707 | return \strtotime($item[$prop]) < \strtotime($value); |
1708 | 1708 | }, |
1709 | 1709 | ]; |
@@ -1711,7 +1711,7 @@ discard block |
||
1711 | 1711 | $result = \array_values( |
1712 | 1712 | \array_filter( |
1713 | 1713 | $this->getArray(), |
1714 | - static function ($item) use ( |
|
1714 | + static function($item) use ( |
|
1715 | 1715 | $property, |
1716 | 1716 | $value, |
1717 | 1717 | $ops, |
@@ -2370,7 +2370,7 @@ discard block |
||
2370 | 2370 | \array_uintersect( |
2371 | 2371 | $this->getArray(), |
2372 | 2372 | $search, |
2373 | - static function ($a, $b) { |
|
2373 | + static function($a, $b) { |
|
2374 | 2374 | return $a === $b ? 0 : -1; |
2375 | 2375 | } |
2376 | 2376 | ), |
@@ -2645,13 +2645,13 @@ discard block |
||
2645 | 2645 | // non recursive |
2646 | 2646 | |
2647 | 2647 | if ($search_values === null) { |
2648 | - $arrayFunction = function (): \Generator { |
|
2648 | + $arrayFunction = function(): \Generator { |
|
2649 | 2649 | foreach ($this->getGenerator() as $key => $value) { |
2650 | 2650 | yield $key; |
2651 | 2651 | } |
2652 | 2652 | }; |
2653 | 2653 | } else { |
2654 | - $arrayFunction = function () use ($search_values, $strict): \Generator { |
|
2654 | + $arrayFunction = function() use ($search_values, $strict): \Generator { |
|
2655 | 2655 | $is_array_tmp = \is_array($search_values); |
2656 | 2656 | |
2657 | 2657 | foreach ($this->getGenerator() as $key => $value) { |
@@ -2851,7 +2851,7 @@ discard block |
||
2851 | 2851 | $useArguments = \func_num_args() > 2; |
2852 | 2852 | |
2853 | 2853 | return static::create( |
2854 | - function () use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
2854 | + function() use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
2855 | 2855 | foreach ($this->getGenerator() as $key => $value) { |
2856 | 2856 | if ($useArguments) { |
2857 | 2857 | if ($useKeyAsSecondParameter) { |
@@ -3231,7 +3231,7 @@ discard block |
||
3231 | 3231 | */ |
3232 | 3232 | public function nth(int $step, int $offset = 0): self |
3233 | 3233 | { |
3234 | - $arrayFunction = function () use ($step, $offset): \Generator { |
|
3234 | + $arrayFunction = function() use ($step, $offset): \Generator { |
|
3235 | 3235 | $position = 0; |
3236 | 3236 | foreach ($this->getGenerator() as $key => $value) { |
3237 | 3237 | if ($position++ % $step !== $offset) { |
@@ -3378,7 +3378,7 @@ discard block |
||
3378 | 3378 | )->prependToEachKey($suffix) |
3379 | 3379 | ->toArray(); |
3380 | 3380 | } else { |
3381 | - $result[$key . $suffix] = $item; |
|
3381 | + $result[$key.$suffix] = $item; |
|
3382 | 3382 | } |
3383 | 3383 | } |
3384 | 3384 | |
@@ -3415,7 +3415,7 @@ discard block |
||
3415 | 3415 | } elseif (\is_object($item) === true) { |
3416 | 3416 | $result[$key] = $item; |
3417 | 3417 | } else { |
3418 | - $result[$key] = $item . $suffix; |
|
3418 | + $result[$key] = $item.$suffix; |
|
3419 | 3419 | } |
3420 | 3420 | } |
3421 | 3421 | |
@@ -4029,7 +4029,7 @@ discard block |
||
4029 | 4029 | public function replaceValues($search, $replacement = ''): self |
4030 | 4030 | { |
4031 | 4031 | return $this->each( |
4032 | - static function ($value) use ($search, $replacement) { |
|
4032 | + static function($value) use ($search, $replacement) { |
|
4033 | 4033 | return \str_replace($search, $replacement, $value); |
4034 | 4034 | } |
4035 | 4035 | ); |
@@ -4527,7 +4527,7 @@ discard block |
||
4527 | 4527 | ); |
4528 | 4528 | |
4529 | 4529 | $results = $arrayy->each( |
4530 | - function ($value) use ($sorter) { |
|
4530 | + function($value) use ($sorter) { |
|
4531 | 4531 | if (\is_callable($sorter) === true) { |
4532 | 4532 | return $sorter($value); |
4533 | 4533 | } |
@@ -4615,7 +4615,7 @@ discard block |
||
4615 | 4615 | public function stripEmpty(): self |
4616 | 4616 | { |
4617 | 4617 | return $this->filter( |
4618 | - static function ($item) { |
|
4618 | + static function($item) { |
|
4619 | 4619 | if ($item === null) { |
4620 | 4620 | return false; |
4621 | 4621 | } |
@@ -4744,7 +4744,7 @@ discard block |
||
4744 | 4744 | // INFO: \array_unique() can't handle e.g. "stdClass"-values in an array |
4745 | 4745 | |
4746 | 4746 | $this->array = $this->reduce( |
4747 | - static function ($resultArray, $value) { |
|
4747 | + static function($resultArray, $value) { |
|
4748 | 4748 | if (!\in_array($value, $resultArray, true)) { |
4749 | 4749 | $resultArray[] = $value; |
4750 | 4750 | } |
@@ -4773,7 +4773,7 @@ discard block |
||
4773 | 4773 | |
4774 | 4774 | $this->array = \array_reduce( |
4775 | 4775 | \array_keys($array), |
4776 | - static function ($resultArray, $key) use ($array) { |
|
4776 | + static function($resultArray, $key) use ($array) { |
|
4777 | 4777 | if (!\in_array($array[$key], $resultArray, true)) { |
4778 | 4778 | $resultArray[$key] = $array[$key]; |
4779 | 4779 | } |
@@ -4851,7 +4851,7 @@ discard block |
||
4851 | 4851 | public function values(): self |
4852 | 4852 | { |
4853 | 4853 | return static::create( |
4854 | - function () { |
|
4854 | + function() { |
|
4855 | 4855 | /** @noinspection YieldFromCanBeUsedInspection */ |
4856 | 4856 | foreach ($this->getGenerator() as $value) { |
4857 | 4857 | yield $value; |
@@ -4899,7 +4899,7 @@ discard block |
||
4899 | 4899 | public function where(string $keyOrPropertyOrMethod, $value): self |
4900 | 4900 | { |
4901 | 4901 | return $this->filter( |
4902 | - function ($item) use ($keyOrPropertyOrMethod, $value) { |
|
4902 | + function($item) use ($keyOrPropertyOrMethod, $value) { |
|
4903 | 4903 | $accessorValue = $this->extractValue( |
4904 | 4904 | $item, |
4905 | 4905 | $keyOrPropertyOrMethod |
@@ -5169,7 +5169,7 @@ discard block |
||
5169 | 5169 | protected function getPropertiesFromPhpDoc() |
5170 | 5170 | { |
5171 | 5171 | static $PROPERTY_CACHE = []; |
5172 | - $cacheKey = 'Class::' . static::class; |
|
5172 | + $cacheKey = 'Class::'.static::class; |
|
5173 | 5173 | |
5174 | 5174 | if (isset($PROPERTY_CACHE[$cacheKey])) { |
5175 | 5175 | return $PROPERTY_CACHE[$cacheKey]; |
@@ -5484,7 +5484,7 @@ discard block |
||
5484 | 5484 | && |
5485 | 5485 | \count(\array_diff_key($this->properties, $data)) > 0 |
5486 | 5486 | ) { |
5487 | - throw new \TypeError('Property mismatch - input: ' . \print_r(\array_keys($data), true) . ' | expected: ' . \print_r(\array_keys($this->properties), true)); |
|
5487 | + throw new \TypeError('Property mismatch - input: '.\print_r(\array_keys($data), true).' | expected: '.\print_r(\array_keys($this->properties), true)); |
|
5488 | 5488 | } |
5489 | 5489 | |
5490 | 5490 | foreach ($data as $key => &$valueInner) { |
@@ -5583,7 +5583,7 @@ discard block |
||
5583 | 5583 | && |
5584 | 5584 | $this->checkPropertiesMismatch === true |
5585 | 5585 | ) { |
5586 | - throw new \TypeError('The key ' . $key . ' does not exists in "properties". Maybe because @property was not used for the class (' . \get_class($this) . ').'); |
|
5586 | + throw new \TypeError('The key '.$key.' does not exists in "properties". Maybe because @property was not used for the class ('.\get_class($this).').'); |
|
5587 | 5587 | } |
5588 | 5588 | |
5589 | 5589 | 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 | /** |
@@ -50,6 +50,7 @@ |
||
50 | 50 | * Merge current items and items of given collections into a new one. |
51 | 51 | * |
52 | 52 | * @param CollectionInterface ...$collections The collections to merge. |
53 | + * @param CollectionInterface[] $collections |
|
53 | 54 | * |
54 | 55 | * @throws \InvalidArgumentException if any of the given collections are not of the same type |
55 | 56 | * |