@@ -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 | * |
@@ -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 | ); |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | |
550 | 550 | $this->callAtPath( |
551 | 551 | \implode($this->pathSeparator, $path), |
552 | - static function (&$offset) use ($pathToUnset) { |
|
552 | + static function(&$offset) use ($pathToUnset) { |
|
553 | 553 | unset($offset[$pathToUnset]); |
554 | 554 | } |
555 | 555 | ); |
@@ -595,7 +595,7 @@ discard block |
||
595 | 595 | } |
596 | 596 | |
597 | 597 | if (\strpos($iteratorClass, '\\') === 0) { |
598 | - $iteratorClass = '\\' . $iteratorClass; |
|
598 | + $iteratorClass = '\\'.$iteratorClass; |
|
599 | 599 | if (\class_exists($iteratorClass)) { |
600 | 600 | $this->iteratorClass = $iteratorClass; |
601 | 601 | |
@@ -603,7 +603,7 @@ discard block |
||
603 | 603 | } |
604 | 604 | } |
605 | 605 | |
606 | - throw new \InvalidArgumentException('The iterator class does not exist: ' . $iteratorClass); |
|
606 | + throw new \InvalidArgumentException('The iterator class does not exist: '.$iteratorClass); |
|
607 | 607 | } |
608 | 608 | |
609 | 609 | /** |
@@ -713,13 +713,13 @@ discard block |
||
713 | 713 | |
714 | 714 | foreach ($this->getGenerator() as $key => $item) { |
715 | 715 | if ($item instanceof self) { |
716 | - $result[$prefix . $key] = $item->appendToEachKey($prefix); |
|
716 | + $result[$prefix.$key] = $item->appendToEachKey($prefix); |
|
717 | 717 | } elseif (\is_array($item) === true) { |
718 | - $result[$prefix . $key] = self::create($item, $this->iteratorClass, false) |
|
718 | + $result[$prefix.$key] = self::create($item, $this->iteratorClass, false) |
|
719 | 719 | ->appendToEachKey($prefix) |
720 | 720 | ->toArray(); |
721 | 721 | } else { |
722 | - $result[$prefix . $key] = $item; |
|
722 | + $result[$prefix.$key] = $item; |
|
723 | 723 | } |
724 | 724 | } |
725 | 725 | |
@@ -747,7 +747,7 @@ discard block |
||
747 | 747 | } elseif (\is_object($item) === true) { |
748 | 748 | $result[$key] = $item; |
749 | 749 | } else { |
750 | - $result[$key] = $prefix . $item; |
|
750 | + $result[$key] = $prefix.$item; |
|
751 | 751 | } |
752 | 752 | } |
753 | 753 | |
@@ -896,7 +896,7 @@ discard block |
||
896 | 896 | public function clean(): self |
897 | 897 | { |
898 | 898 | return $this->filter( |
899 | - static function ($value) { |
|
899 | + static function($value) { |
|
900 | 900 | return (bool) $value; |
901 | 901 | } |
902 | 902 | ); |
@@ -1255,7 +1255,7 @@ discard block |
||
1255 | 1255 | // trim all string in the array |
1256 | 1256 | \array_walk( |
1257 | 1257 | $array, |
1258 | - static function (&$val) { |
|
1258 | + static function(&$val) { |
|
1259 | 1259 | if ((string) $val === $val) { |
1260 | 1260 | $val = \trim($val); |
1261 | 1261 | } |
@@ -1662,40 +1662,40 @@ discard block |
||
1662 | 1662 | } |
1663 | 1663 | |
1664 | 1664 | $ops = [ |
1665 | - 'eq' => static function ($item, $prop, $value): bool { |
|
1665 | + 'eq' => static function($item, $prop, $value): bool { |
|
1666 | 1666 | return $item[$prop] === $value; |
1667 | 1667 | }, |
1668 | - 'gt' => static function ($item, $prop, $value): bool { |
|
1668 | + 'gt' => static function($item, $prop, $value): bool { |
|
1669 | 1669 | return $item[$prop] > $value; |
1670 | 1670 | }, |
1671 | - 'ge' => static function ($item, $prop, $value): bool { |
|
1671 | + 'ge' => static function($item, $prop, $value): bool { |
|
1672 | 1672 | return $item[$prop] >= $value; |
1673 | 1673 | }, |
1674 | - 'gte' => static function ($item, $prop, $value): bool { |
|
1674 | + 'gte' => static function($item, $prop, $value): bool { |
|
1675 | 1675 | return $item[$prop] >= $value; |
1676 | 1676 | }, |
1677 | - 'lt' => static function ($item, $prop, $value): bool { |
|
1677 | + 'lt' => static function($item, $prop, $value): bool { |
|
1678 | 1678 | return $item[$prop] < $value; |
1679 | 1679 | }, |
1680 | - 'le' => static function ($item, $prop, $value): bool { |
|
1680 | + 'le' => static function($item, $prop, $value): bool { |
|
1681 | 1681 | return $item[$prop] <= $value; |
1682 | 1682 | }, |
1683 | - 'lte' => static function ($item, $prop, $value): bool { |
|
1683 | + 'lte' => static function($item, $prop, $value): bool { |
|
1684 | 1684 | return $item[$prop] <= $value; |
1685 | 1685 | }, |
1686 | - 'ne' => static function ($item, $prop, $value): bool { |
|
1686 | + 'ne' => static function($item, $prop, $value): bool { |
|
1687 | 1687 | return $item[$prop] !== $value; |
1688 | 1688 | }, |
1689 | - 'contains' => static function ($item, $prop, $value): bool { |
|
1689 | + 'contains' => static function($item, $prop, $value): bool { |
|
1690 | 1690 | return \in_array($item[$prop], (array) $value, true); |
1691 | 1691 | }, |
1692 | - 'notContains' => static function ($item, $prop, $value): bool { |
|
1692 | + 'notContains' => static function($item, $prop, $value): bool { |
|
1693 | 1693 | return !\in_array($item[$prop], (array) $value, true); |
1694 | 1694 | }, |
1695 | - 'newer' => static function ($item, $prop, $value): bool { |
|
1695 | + 'newer' => static function($item, $prop, $value): bool { |
|
1696 | 1696 | return \strtotime($item[$prop]) > \strtotime($value); |
1697 | 1697 | }, |
1698 | - 'older' => static function ($item, $prop, $value): bool { |
|
1698 | + 'older' => static function($item, $prop, $value): bool { |
|
1699 | 1699 | return \strtotime($item[$prop]) < \strtotime($value); |
1700 | 1700 | }, |
1701 | 1701 | ]; |
@@ -1703,7 +1703,7 @@ discard block |
||
1703 | 1703 | $result = \array_values( |
1704 | 1704 | \array_filter( |
1705 | 1705 | $this->getArray(), |
1706 | - static function ($item) use ( |
|
1706 | + static function($item) use ( |
|
1707 | 1707 | $property, |
1708 | 1708 | $value, |
1709 | 1709 | $ops, |
@@ -2381,7 +2381,7 @@ discard block |
||
2381 | 2381 | \array_uintersect( |
2382 | 2382 | $this->array, |
2383 | 2383 | $search, |
2384 | - static function ($a, $b) { |
|
2384 | + static function($a, $b) { |
|
2385 | 2385 | return $a === $b ? 0 : -1; |
2386 | 2386 | } |
2387 | 2387 | ), |
@@ -2656,13 +2656,13 @@ discard block |
||
2656 | 2656 | // non recursive |
2657 | 2657 | |
2658 | 2658 | if ($search_values === null) { |
2659 | - $arrayFunction = function (): \Generator { |
|
2659 | + $arrayFunction = function(): \Generator { |
|
2660 | 2660 | foreach ($this->getGenerator() as $key => $value) { |
2661 | 2661 | yield $key; |
2662 | 2662 | } |
2663 | 2663 | }; |
2664 | 2664 | } else { |
2665 | - $arrayFunction = function () use ($search_values, $strict): \Generator { |
|
2665 | + $arrayFunction = function() use ($search_values, $strict): \Generator { |
|
2666 | 2666 | $is_array_tmp = \is_array($search_values); |
2667 | 2667 | |
2668 | 2668 | foreach ($this->getGenerator() as $key => $value) { |
@@ -2862,7 +2862,7 @@ discard block |
||
2862 | 2862 | $useArguments = \func_num_args() > 2; |
2863 | 2863 | |
2864 | 2864 | return static::create( |
2865 | - function () use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
2865 | + function() use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
2866 | 2866 | foreach ($this->getGenerator() as $key => $value) { |
2867 | 2867 | if ($useArguments) { |
2868 | 2868 | if ($useKeyAsSecondParameter) { |
@@ -3339,7 +3339,7 @@ discard block |
||
3339 | 3339 | )->prependToEachKey($suffix) |
3340 | 3340 | ->toArray(); |
3341 | 3341 | } else { |
3342 | - $result[$key . $suffix] = $item; |
|
3342 | + $result[$key.$suffix] = $item; |
|
3343 | 3343 | } |
3344 | 3344 | } |
3345 | 3345 | |
@@ -3376,7 +3376,7 @@ discard block |
||
3376 | 3376 | } elseif (\is_object($item) === true) { |
3377 | 3377 | $result[$key] = $item; |
3378 | 3378 | } else { |
3379 | - $result[$key] = $item . $suffix; |
|
3379 | + $result[$key] = $item.$suffix; |
|
3380 | 3380 | } |
3381 | 3381 | } |
3382 | 3382 | |
@@ -3986,7 +3986,7 @@ discard block |
||
3986 | 3986 | public function replaceValues($search, $replacement = ''): self |
3987 | 3987 | { |
3988 | 3988 | return $this->each( |
3989 | - static function ($value) use ($search, $replacement) { |
|
3989 | + static function($value) use ($search, $replacement) { |
|
3990 | 3990 | return \str_replace($search, $replacement, $value); |
3991 | 3991 | } |
3992 | 3992 | ); |
@@ -4484,7 +4484,7 @@ discard block |
||
4484 | 4484 | ); |
4485 | 4485 | |
4486 | 4486 | $results = $arrayy->each( |
4487 | - function ($value) use ($sorter) { |
|
4487 | + function($value) use ($sorter) { |
|
4488 | 4488 | if (\is_callable($sorter) === true) { |
4489 | 4489 | return $sorter($value); |
4490 | 4490 | } |
@@ -4567,7 +4567,7 @@ discard block |
||
4567 | 4567 | public function stripEmpty(): self |
4568 | 4568 | { |
4569 | 4569 | return $this->filter( |
4570 | - static function ($item) { |
|
4570 | + static function($item) { |
|
4571 | 4571 | if ($item === null) { |
4572 | 4572 | return false; |
4573 | 4573 | } |
@@ -4655,7 +4655,7 @@ discard block |
||
4655 | 4655 | // INFO: \array_unique() can't handle e.g. "stdClass"-values in an array |
4656 | 4656 | |
4657 | 4657 | $this->array = $this->reduce( |
4658 | - static function ($resultArray, $value) { |
|
4658 | + static function($resultArray, $value) { |
|
4659 | 4659 | if (!\in_array($value, $resultArray, true)) { |
4660 | 4660 | $resultArray[] = $value; |
4661 | 4661 | } |
@@ -4684,7 +4684,7 @@ discard block |
||
4684 | 4684 | |
4685 | 4685 | $this->array = \array_reduce( |
4686 | 4686 | \array_keys($array), |
4687 | - static function ($resultArray, $key) use ($array) { |
|
4687 | + static function($resultArray, $key) use ($array) { |
|
4688 | 4688 | if (!\in_array($array[$key], $resultArray, true)) { |
4689 | 4689 | $resultArray[$key] = $array[$key]; |
4690 | 4690 | } |
@@ -4743,7 +4743,7 @@ discard block |
||
4743 | 4743 | public function values(): self |
4744 | 4744 | { |
4745 | 4745 | return static::create( |
4746 | - function () { |
|
4746 | + function() { |
|
4747 | 4747 | /** @noinspection YieldFromCanBeUsedInspection */ |
4748 | 4748 | foreach ($this->getGenerator() as $value) { |
4749 | 4749 | yield $value; |
@@ -4791,7 +4791,7 @@ discard block |
||
4791 | 4791 | public function where(string $keyOrPropertyOrMethod, $value): self |
4792 | 4792 | { |
4793 | 4793 | return $this->filter( |
4794 | - function ($item) use ($keyOrPropertyOrMethod, $value) { |
|
4794 | + function($item) use ($keyOrPropertyOrMethod, $value) { |
|
4795 | 4795 | $accessorValue = $this->extractValue( |
4796 | 4796 | $item, |
4797 | 4797 | $keyOrPropertyOrMethod |
@@ -5026,7 +5026,7 @@ discard block |
||
5026 | 5026 | protected function getPropertiesFromPhpDoc() |
5027 | 5027 | { |
5028 | 5028 | static $PROPERTY_CACHE = []; |
5029 | - $cacheKey = 'Class::' . static::class; |
|
5029 | + $cacheKey = 'Class::'.static::class; |
|
5030 | 5030 | |
5031 | 5031 | if (isset($PROPERTY_CACHE[$cacheKey])) { |
5032 | 5032 | return $PROPERTY_CACHE[$cacheKey]; |
@@ -5341,7 +5341,7 @@ discard block |
||
5341 | 5341 | && |
5342 | 5342 | \count(\array_diff_key($this->properties, $data)) > 0 |
5343 | 5343 | ) { |
5344 | - throw new \TypeError('Property mismatch - input: ' . \print_r(\array_keys($data), true) . ' | expected: ' . \print_r(\array_keys($this->properties), true)); |
|
5344 | + throw new \TypeError('Property mismatch - input: '.\print_r(\array_keys($data), true).' | expected: '.\print_r(\array_keys($this->properties), true)); |
|
5345 | 5345 | } |
5346 | 5346 | |
5347 | 5347 | foreach ($data as $key => &$valueInner) { |
@@ -5475,7 +5475,7 @@ discard block |
||
5475 | 5475 | && |
5476 | 5476 | $this->checkPropertiesMismatch === true |
5477 | 5477 | ) { |
5478 | - throw new \TypeError('The key ' . $key . ' does not exists in "properties". Maybe because @property was not used for the class (' . \get_class($this) . ').'); |
|
5478 | + throw new \TypeError('The key '.$key.' does not exists in "properties". Maybe because @property was not used for the class ('.\get_class($this).').'); |
|
5479 | 5479 | } |
5480 | 5480 | |
5481 | 5481 | if (isset($this->properties[self::ARRAYY_HELPER_TYPES_FOR_ALL_PROPERTIES])) { |