@@ -2893,7 +2893,7 @@ discard block |
||
2893 | 2893 | /** |
2894 | 2894 | * Reduce the current array via callable e.g. anonymous-function. |
2895 | 2895 | * |
2896 | - * @param \callable $callable |
|
2896 | + * @param \Closure $callable |
|
2897 | 2897 | * @param array $init |
2898 | 2898 | * |
2899 | 2899 | * @return static |
@@ -3777,7 +3777,7 @@ discard block |
||
3777 | 3777 | /** |
3778 | 3778 | * Apply the given function to every element in the array, discarding the results. |
3779 | 3779 | * |
3780 | - * @param \callable $callable |
|
3780 | + * @param \Closure $callable |
|
3781 | 3781 | * @param bool $recursive <p>Whether array will be walked recursively or no</p> |
3782 | 3782 | * |
3783 | 3783 | * @return static |
@@ -3875,8 +3875,8 @@ discard block |
||
3875 | 3875 | } |
3876 | 3876 | |
3877 | 3877 | /** |
3878 | - * @param mixed $path |
|
3879 | - * @param \callable $callable |
|
3878 | + * @param string $path |
|
3879 | + * @param \Closure $callable |
|
3880 | 3880 | * @param array|null $currentOffset |
3881 | 3881 | */ |
3882 | 3882 | protected function callAtPath($path, $callable, &$currentOffset = null) |
@@ -4026,7 +4026,7 @@ discard block |
||
4026 | 4026 | } |
4027 | 4027 | |
4028 | 4028 | /** |
4029 | - * @param mixed $glue |
|
4029 | + * @param string $glue |
|
4030 | 4030 | * @param array|static|string $pieces |
4031 | 4031 | * @param bool $useKeys |
4032 | 4032 | * |
@@ -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 | /** |
@@ -104,12 +104,12 @@ discard block |
||
104 | 104 | && |
105 | 105 | \count(\array_diff_key($this->properties, $array)) > 0 |
106 | 106 | ) { |
107 | - throw new \InvalidArgumentException('Property mismatch - input: ' . \print_r(\array_keys($array), true) . ' | expected: ' . \print_r(\array_keys($this->properties), true)); |
|
107 | + throw new \InvalidArgumentException('Property mismatch - input: '.\print_r(\array_keys($array), true).' | expected: '.\print_r(\array_keys($this->properties), true)); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | \array_walk( |
111 | 111 | $array, |
112 | - function (&$value, &$key) { |
|
112 | + function(&$value, &$key) { |
|
113 | 113 | $this->internalSet($key, $value); |
114 | 114 | } |
115 | 115 | ); |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | |
451 | 451 | $this->callAtPath( |
452 | 452 | $containerPath, |
453 | - static function ($container) use ($lastOffset, &$offsetExists) { |
|
453 | + static function($container) use ($lastOffset, &$offsetExists) { |
|
454 | 454 | $offsetExists = \array_key_exists($lastOffset, $container); |
455 | 455 | } |
456 | 456 | ); |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | |
515 | 515 | $this->callAtPath( |
516 | 516 | \implode($this->pathSeparator, $path), |
517 | - static function (&$offset) use ($pathToUnset) { |
|
517 | + static function(&$offset) use ($pathToUnset) { |
|
518 | 518 | unset($offset[$pathToUnset]); |
519 | 519 | } |
520 | 520 | ); |
@@ -551,7 +551,7 @@ discard block |
||
551 | 551 | } |
552 | 552 | |
553 | 553 | if (\strpos($class, '\\') === 0) { |
554 | - $class = '\\' . $class; |
|
554 | + $class = '\\'.$class; |
|
555 | 555 | if (\class_exists($class)) { |
556 | 556 | $this->iteratorClass = $class; |
557 | 557 | |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | } |
560 | 560 | } |
561 | 561 | |
562 | - throw new \InvalidArgumentException('The iterator class does not exist: ' . $class); |
|
562 | + throw new \InvalidArgumentException('The iterator class does not exist: '.$class); |
|
563 | 563 | } |
564 | 564 | |
565 | 565 | /** |
@@ -667,13 +667,13 @@ discard block |
||
667 | 667 | |
668 | 668 | foreach ($this->getGenerator() as $key => $item) { |
669 | 669 | if ($item instanceof self) { |
670 | - $result[$prefix . $key] = $item->appendToEachKey($prefix); |
|
670 | + $result[$prefix.$key] = $item->appendToEachKey($prefix); |
|
671 | 671 | } elseif (\is_array($item)) { |
672 | - $result[$prefix . $key] = self::create($item, $this->iteratorClass, false) |
|
672 | + $result[$prefix.$key] = self::create($item, $this->iteratorClass, false) |
|
673 | 673 | ->appendToEachKey($prefix) |
674 | 674 | ->toArray(); |
675 | 675 | } else { |
676 | - $result[$prefix . $key] = $item; |
|
676 | + $result[$prefix.$key] = $item; |
|
677 | 677 | } |
678 | 678 | } |
679 | 679 | |
@@ -701,7 +701,7 @@ discard block |
||
701 | 701 | } elseif (\is_object($item)) { |
702 | 702 | $result[$key] = $item; |
703 | 703 | } else { |
704 | - $result[$key] = $prefix . $item; |
|
704 | + $result[$key] = $prefix.$item; |
|
705 | 705 | } |
706 | 706 | } |
707 | 707 | |
@@ -852,7 +852,7 @@ discard block |
||
852 | 852 | public function clean(): self |
853 | 853 | { |
854 | 854 | return $this->filter( |
855 | - static function ($value) { |
|
855 | + static function($value) { |
|
856 | 856 | return (bool) $value; |
857 | 857 | } |
858 | 858 | ); |
@@ -905,7 +905,7 @@ discard block |
||
905 | 905 | return $this->in_array_recursive( |
906 | 906 | \mb_strtoupper((string) $value), |
907 | 907 | $this->walk( |
908 | - static function (&$val) { |
|
908 | + static function(&$val) { |
|
909 | 909 | /** @noinspection PhpComposerExtensionStubsInspection */ |
910 | 910 | $val = \mb_strtoupper((string) $val); |
911 | 911 | }, |
@@ -919,7 +919,7 @@ discard block |
||
919 | 919 | return \in_array( |
920 | 920 | \mb_strtoupper((string) $value), |
921 | 921 | $this->walk( |
922 | - static function (&$val) { |
|
922 | + static function(&$val) { |
|
923 | 923 | /** @noinspection PhpComposerExtensionStubsInspection */ |
924 | 924 | $val = \mb_strtoupper((string) $val); |
925 | 925 | }, |
@@ -1096,7 +1096,7 @@ discard block |
||
1096 | 1096 | public static function createFromGeneratorImmutable(\Generator $generator): self |
1097 | 1097 | { |
1098 | 1098 | // init |
1099 | - $array = new static( $generator); |
|
1099 | + $array = new static($generator); |
|
1100 | 1100 | |
1101 | 1101 | return $array; |
1102 | 1102 | } |
@@ -1180,7 +1180,7 @@ discard block |
||
1180 | 1180 | // trim all string in the array |
1181 | 1181 | \array_walk( |
1182 | 1182 | $array, |
1183 | - static function (&$val) { |
|
1183 | + static function(&$val) { |
|
1184 | 1184 | if (\is_string($val)) { |
1185 | 1185 | $val = \trim($val); |
1186 | 1186 | } |
@@ -1496,40 +1496,40 @@ discard block |
||
1496 | 1496 | } |
1497 | 1497 | |
1498 | 1498 | $ops = [ |
1499 | - 'eq' => static function ($item, $prop, $value) { |
|
1499 | + 'eq' => static function($item, $prop, $value) { |
|
1500 | 1500 | return $item[$prop] === $value; |
1501 | 1501 | }, |
1502 | - 'gt' => static function ($item, $prop, $value) { |
|
1502 | + 'gt' => static function($item, $prop, $value) { |
|
1503 | 1503 | return $item[$prop] > $value; |
1504 | 1504 | }, |
1505 | - 'ge' => static function ($item, $prop, $value) { |
|
1505 | + 'ge' => static function($item, $prop, $value) { |
|
1506 | 1506 | return $item[$prop] >= $value; |
1507 | 1507 | }, |
1508 | - 'gte' => static function ($item, $prop, $value) { |
|
1508 | + 'gte' => static function($item, $prop, $value) { |
|
1509 | 1509 | return $item[$prop] >= $value; |
1510 | 1510 | }, |
1511 | - 'lt' => static function ($item, $prop, $value) { |
|
1511 | + 'lt' => static function($item, $prop, $value) { |
|
1512 | 1512 | return $item[$prop] < $value; |
1513 | 1513 | }, |
1514 | - 'le' => static function ($item, $prop, $value) { |
|
1514 | + 'le' => static function($item, $prop, $value) { |
|
1515 | 1515 | return $item[$prop] <= $value; |
1516 | 1516 | }, |
1517 | - 'lte' => static function ($item, $prop, $value) { |
|
1517 | + 'lte' => static function($item, $prop, $value) { |
|
1518 | 1518 | return $item[$prop] <= $value; |
1519 | 1519 | }, |
1520 | - 'ne' => static function ($item, $prop, $value) { |
|
1520 | + 'ne' => static function($item, $prop, $value) { |
|
1521 | 1521 | return $item[$prop] !== $value; |
1522 | 1522 | }, |
1523 | - 'contains' => static function ($item, $prop, $value) { |
|
1523 | + 'contains' => static function($item, $prop, $value) { |
|
1524 | 1524 | return \in_array($item[$prop], (array) $value, true); |
1525 | 1525 | }, |
1526 | - 'notContains' => static function ($item, $prop, $value) { |
|
1526 | + 'notContains' => static function($item, $prop, $value) { |
|
1527 | 1527 | return !\in_array($item[$prop], (array) $value, true); |
1528 | 1528 | }, |
1529 | - 'newer' => static function ($item, $prop, $value) { |
|
1529 | + 'newer' => static function($item, $prop, $value) { |
|
1530 | 1530 | return \strtotime($item[$prop]) > \strtotime($value); |
1531 | 1531 | }, |
1532 | - 'older' => static function ($item, $prop, $value) { |
|
1532 | + 'older' => static function($item, $prop, $value) { |
|
1533 | 1533 | return \strtotime($item[$prop]) < \strtotime($value); |
1534 | 1534 | }, |
1535 | 1535 | ]; |
@@ -1537,7 +1537,7 @@ discard block |
||
1537 | 1537 | $result = \array_values( |
1538 | 1538 | \array_filter( |
1539 | 1539 | $this->getArray(), |
1540 | - static function ($item) use ( |
|
1540 | + static function($item) use ( |
|
1541 | 1541 | $property, |
1542 | 1542 | $value, |
1543 | 1543 | $ops, |
@@ -2668,7 +2668,7 @@ discard block |
||
2668 | 2668 | } elseif (\is_array($item)) { |
2669 | 2669 | $result[$key] = self::create($item, $this->iteratorClass, false)->prependToEachKey($suffix)->toArray(); |
2670 | 2670 | } else { |
2671 | - $result[$key . $suffix] = $item; |
|
2671 | + $result[$key.$suffix] = $item; |
|
2672 | 2672 | } |
2673 | 2673 | } |
2674 | 2674 | |
@@ -2698,7 +2698,7 @@ discard block |
||
2698 | 2698 | } elseif (\is_object($item)) { |
2699 | 2699 | $result[$key] = $item; |
2700 | 2700 | } else { |
2701 | - $result[$key] = $item . $suffix; |
|
2701 | + $result[$key] = $item.$suffix; |
|
2702 | 2702 | } |
2703 | 2703 | } |
2704 | 2704 | |
@@ -2904,7 +2904,7 @@ discard block |
||
2904 | 2904 | if ($this->generator) { |
2905 | 2905 | $result = $init; |
2906 | 2906 | |
2907 | - foreach($this->getGenerator() as $value) { |
|
2907 | + foreach ($this->getGenerator() as $value) { |
|
2908 | 2908 | $result = $callable($result, $value); |
2909 | 2909 | } |
2910 | 2910 | |
@@ -3165,7 +3165,7 @@ discard block |
||
3165 | 3165 | public function replaceValues($search, $replacement = ''): self |
3166 | 3166 | { |
3167 | 3167 | $array = $this->each( |
3168 | - static function ($value) use ($search, $replacement) { |
|
3168 | + static function($value) use ($search, $replacement) { |
|
3169 | 3169 | return \str_replace($search, $replacement, $value); |
3170 | 3170 | } |
3171 | 3171 | ); |
@@ -3553,7 +3553,7 @@ discard block |
||
3553 | 3553 | |
3554 | 3554 | $that = $this; |
3555 | 3555 | $results = $arrayy->each( |
3556 | - static function ($value) use ($sorter, $that) { |
|
3556 | + static function($value) use ($sorter, $that) { |
|
3557 | 3557 | return \is_callable($sorter) ? $sorter($value) : $that->get($sorter, null, $value); |
3558 | 3558 | } |
3559 | 3559 | ); |
@@ -3603,7 +3603,7 @@ discard block |
||
3603 | 3603 | public function stripEmpty(): self |
3604 | 3604 | { |
3605 | 3605 | return $this->filter( |
3606 | - static function ($item) { |
|
3606 | + static function($item) { |
|
3607 | 3607 | if ($item === null) { |
3608 | 3608 | return false; |
3609 | 3609 | } |
@@ -3679,7 +3679,7 @@ discard block |
||
3679 | 3679 | // INFO: \array_unique() can't handle e.g. "stdClass"-values in an array |
3680 | 3680 | |
3681 | 3681 | $this->array = $this->reduce( |
3682 | - static function ($resultArray, $value) { |
|
3682 | + static function($resultArray, $value) { |
|
3683 | 3683 | if (!\in_array($value, $resultArray, true)) { |
3684 | 3684 | $resultArray[] = $value; |
3685 | 3685 | } |
@@ -3708,7 +3708,7 @@ discard block |
||
3708 | 3708 | |
3709 | 3709 | $this->array = \array_reduce( |
3710 | 3710 | \array_keys($array), |
3711 | - static function ($resultArray, $key) use ($array) { |
|
3711 | + static function($resultArray, $key) use ($array) { |
|
3712 | 3712 | if (!\in_array($array[$key], $resultArray, true)) { |
3713 | 3713 | $resultArray[$key] = $array[$key]; |
3714 | 3714 | } |
@@ -3768,7 +3768,7 @@ discard block |
||
3768 | 3768 | public function values(): self |
3769 | 3769 | { |
3770 | 3770 | return static::create( |
3771 | - \array_values( $this->getArray()), |
|
3771 | + \array_values($this->getArray()), |
|
3772 | 3772 | $this->iteratorClass, |
3773 | 3773 | false |
3774 | 3774 | ); |
@@ -4005,7 +4005,7 @@ discard block |
||
4005 | 4005 | protected function getPublicProperties(): array |
4006 | 4006 | { |
4007 | 4007 | static $PROPERTY_CACHE = []; |
4008 | - $cacheKey = 'Class::' . static::class; |
|
4008 | + $cacheKey = 'Class::'.static::class; |
|
4009 | 4009 | |
4010 | 4010 | if (isset($PROPERTY_CACHE[$cacheKey])) { |
4011 | 4011 | return $PROPERTY_CACHE[$cacheKey]; |
@@ -4168,7 +4168,7 @@ discard block |
||
4168 | 4168 | { |
4169 | 4169 | if ($this->checkPropertyTypes === true) { |
4170 | 4170 | if (isset($this->properties[$key]) === false) { |
4171 | - throw new \InvalidArgumentException('The key ' . $key . ' does not exists as @property in the class (' . \get_class($this) . ').'); |
|
4171 | + throw new \InvalidArgumentException('The key '.$key.' does not exists as @property in the class ('.\get_class($this).').'); |
|
4172 | 4172 | } |
4173 | 4173 | |
4174 | 4174 | $this->properties[$key]->checkType($value); |