@@ -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 | /** |
@@ -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 | /** |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | && |
106 | 106 | \count(\array_diff_key($this->properties, $data)) > 0 |
107 | 107 | ) { |
108 | - throw new \InvalidArgumentException('Property mismatch - input: ' . \print_r(\array_keys($data), true) . ' | expected: ' . \print_r(\array_keys($this->properties), true)); |
|
108 | + throw new \InvalidArgumentException('Property mismatch - input: '.\print_r(\array_keys($data), true).' | expected: '.\print_r(\array_keys($this->properties), true)); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | foreach ($data as $key => &$value) { |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | |
456 | 456 | $this->callAtPath( |
457 | 457 | $containerPath, |
458 | - static function ($container) use ($lastOffset, &$offsetExists) { |
|
458 | + static function($container) use ($lastOffset, &$offsetExists) { |
|
459 | 459 | $offsetExists = \array_key_exists($lastOffset, $container); |
460 | 460 | } |
461 | 461 | ); |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | |
520 | 520 | $this->callAtPath( |
521 | 521 | \implode($this->pathSeparator, $path), |
522 | - static function (&$offset) use ($pathToUnset) { |
|
522 | + static function(&$offset) use ($pathToUnset) { |
|
523 | 523 | unset($offset[$pathToUnset]); |
524 | 524 | } |
525 | 525 | ); |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | } |
557 | 557 | |
558 | 558 | if (\strpos($class, '\\') === 0) { |
559 | - $class = '\\' . $class; |
|
559 | + $class = '\\'.$class; |
|
560 | 560 | if (\class_exists($class)) { |
561 | 561 | $this->iteratorClass = $class; |
562 | 562 | |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | } |
565 | 565 | } |
566 | 566 | |
567 | - throw new \InvalidArgumentException('The iterator class does not exist: ' . $class); |
|
567 | + throw new \InvalidArgumentException('The iterator class does not exist: '.$class); |
|
568 | 568 | } |
569 | 569 | |
570 | 570 | /** |
@@ -672,13 +672,13 @@ discard block |
||
672 | 672 | |
673 | 673 | foreach ($this->getGenerator() as $key => $item) { |
674 | 674 | if ($item instanceof self) { |
675 | - $result[$prefix . $key] = $item->appendToEachKey($prefix); |
|
675 | + $result[$prefix.$key] = $item->appendToEachKey($prefix); |
|
676 | 676 | } elseif (\is_array($item)) { |
677 | - $result[$prefix . $key] = self::create($item, $this->iteratorClass, false) |
|
677 | + $result[$prefix.$key] = self::create($item, $this->iteratorClass, false) |
|
678 | 678 | ->appendToEachKey($prefix) |
679 | 679 | ->toArray(); |
680 | 680 | } else { |
681 | - $result[$prefix . $key] = $item; |
|
681 | + $result[$prefix.$key] = $item; |
|
682 | 682 | } |
683 | 683 | } |
684 | 684 | |
@@ -706,7 +706,7 @@ discard block |
||
706 | 706 | } elseif (\is_object($item)) { |
707 | 707 | $result[$key] = $item; |
708 | 708 | } else { |
709 | - $result[$key] = $prefix . $item; |
|
709 | + $result[$key] = $prefix.$item; |
|
710 | 710 | } |
711 | 711 | } |
712 | 712 | |
@@ -857,7 +857,7 @@ discard block |
||
857 | 857 | public function clean(): self |
858 | 858 | { |
859 | 859 | return $this->filter( |
860 | - static function ($value) { |
|
860 | + static function($value) { |
|
861 | 861 | return (bool) $value; |
862 | 862 | } |
863 | 863 | ); |
@@ -910,7 +910,7 @@ discard block |
||
910 | 910 | return $this->in_array_recursive( |
911 | 911 | \mb_strtoupper((string) $value), |
912 | 912 | $this->walk( |
913 | - static function (&$val) { |
|
913 | + static function(&$val) { |
|
914 | 914 | /** @noinspection PhpComposerExtensionStubsInspection */ |
915 | 915 | $val = \mb_strtoupper((string) $val); |
916 | 916 | }, |
@@ -924,7 +924,7 @@ discard block |
||
924 | 924 | return \in_array( |
925 | 925 | \mb_strtoupper((string) $value), |
926 | 926 | $this->walk( |
927 | - static function (&$val) { |
|
927 | + static function(&$val) { |
|
928 | 928 | /** @noinspection PhpComposerExtensionStubsInspection */ |
929 | 929 | $val = \mb_strtoupper((string) $val); |
930 | 930 | }, |
@@ -1197,7 +1197,7 @@ discard block |
||
1197 | 1197 | // trim all string in the array |
1198 | 1198 | \array_walk( |
1199 | 1199 | $array, |
1200 | - static function (&$val) { |
|
1200 | + static function(&$val) { |
|
1201 | 1201 | if (\is_string($val)) { |
1202 | 1202 | $val = \trim($val); |
1203 | 1203 | } |
@@ -1525,40 +1525,40 @@ discard block |
||
1525 | 1525 | } |
1526 | 1526 | |
1527 | 1527 | $ops = [ |
1528 | - 'eq' => static function ($item, $prop, $value) { |
|
1528 | + 'eq' => static function($item, $prop, $value) { |
|
1529 | 1529 | return $item[$prop] === $value; |
1530 | 1530 | }, |
1531 | - 'gt' => static function ($item, $prop, $value) { |
|
1531 | + 'gt' => static function($item, $prop, $value) { |
|
1532 | 1532 | return $item[$prop] > $value; |
1533 | 1533 | }, |
1534 | - 'ge' => static function ($item, $prop, $value) { |
|
1534 | + 'ge' => static function($item, $prop, $value) { |
|
1535 | 1535 | return $item[$prop] >= $value; |
1536 | 1536 | }, |
1537 | - 'gte' => static function ($item, $prop, $value) { |
|
1537 | + 'gte' => static function($item, $prop, $value) { |
|
1538 | 1538 | return $item[$prop] >= $value; |
1539 | 1539 | }, |
1540 | - 'lt' => static function ($item, $prop, $value) { |
|
1540 | + 'lt' => static function($item, $prop, $value) { |
|
1541 | 1541 | return $item[$prop] < $value; |
1542 | 1542 | }, |
1543 | - 'le' => static function ($item, $prop, $value) { |
|
1543 | + 'le' => static function($item, $prop, $value) { |
|
1544 | 1544 | return $item[$prop] <= $value; |
1545 | 1545 | }, |
1546 | - 'lte' => static function ($item, $prop, $value) { |
|
1546 | + 'lte' => static function($item, $prop, $value) { |
|
1547 | 1547 | return $item[$prop] <= $value; |
1548 | 1548 | }, |
1549 | - 'ne' => static function ($item, $prop, $value) { |
|
1549 | + 'ne' => static function($item, $prop, $value) { |
|
1550 | 1550 | return $item[$prop] !== $value; |
1551 | 1551 | }, |
1552 | - 'contains' => static function ($item, $prop, $value) { |
|
1552 | + 'contains' => static function($item, $prop, $value) { |
|
1553 | 1553 | return \in_array($item[$prop], (array) $value, true); |
1554 | 1554 | }, |
1555 | - 'notContains' => static function ($item, $prop, $value) { |
|
1555 | + 'notContains' => static function($item, $prop, $value) { |
|
1556 | 1556 | return !\in_array($item[$prop], (array) $value, true); |
1557 | 1557 | }, |
1558 | - 'newer' => static function ($item, $prop, $value) { |
|
1558 | + 'newer' => static function($item, $prop, $value) { |
|
1559 | 1559 | return \strtotime($item[$prop]) > \strtotime($value); |
1560 | 1560 | }, |
1561 | - 'older' => static function ($item, $prop, $value) { |
|
1561 | + 'older' => static function($item, $prop, $value) { |
|
1562 | 1562 | return \strtotime($item[$prop]) < \strtotime($value); |
1563 | 1563 | }, |
1564 | 1564 | ]; |
@@ -1566,7 +1566,7 @@ discard block |
||
1566 | 1566 | $result = \array_values( |
1567 | 1567 | \array_filter( |
1568 | 1568 | $this->getArray(), |
1569 | - static function ($item) use ( |
|
1569 | + static function($item) use ( |
|
1570 | 1570 | $property, |
1571 | 1571 | $value, |
1572 | 1572 | $ops, |
@@ -2073,7 +2073,7 @@ discard block |
||
2073 | 2073 | \array_uintersect( |
2074 | 2074 | $this->array, |
2075 | 2075 | $search, |
2076 | - static function ($a, $b) { |
|
2076 | + static function($a, $b) { |
|
2077 | 2077 | return $a === $b ? 0 : -1; |
2078 | 2078 | } |
2079 | 2079 | ), |
@@ -2776,7 +2776,7 @@ discard block |
||
2776 | 2776 | )->prependToEachKey($suffix) |
2777 | 2777 | ->toArray(); |
2778 | 2778 | } else { |
2779 | - $result[$key . $suffix] = $item; |
|
2779 | + $result[$key.$suffix] = $item; |
|
2780 | 2780 | } |
2781 | 2781 | } |
2782 | 2782 | |
@@ -2813,7 +2813,7 @@ discard block |
||
2813 | 2813 | } elseif (\is_object($item)) { |
2814 | 2814 | $result[$key] = $item; |
2815 | 2815 | } else { |
2816 | - $result[$key] = $item . $suffix; |
|
2816 | + $result[$key] = $item.$suffix; |
|
2817 | 2817 | } |
2818 | 2818 | } |
2819 | 2819 | |
@@ -3344,7 +3344,7 @@ discard block |
||
3344 | 3344 | public function replaceValues($search, $replacement = ''): self |
3345 | 3345 | { |
3346 | 3346 | $array = $this->each( |
3347 | - static function ($value) use ($search, $replacement) { |
|
3347 | + static function($value) use ($search, $replacement) { |
|
3348 | 3348 | return \str_replace($search, $replacement, $value); |
3349 | 3349 | } |
3350 | 3350 | ); |
@@ -3748,7 +3748,7 @@ discard block |
||
3748 | 3748 | |
3749 | 3749 | $that = $this; |
3750 | 3750 | $results = $arrayy->each( |
3751 | - static function ($value) use ($sorter, $that) { |
|
3751 | + static function($value) use ($sorter, $that) { |
|
3752 | 3752 | return \is_callable($sorter) ? $sorter($value) : $that->get($sorter, null, $value); |
3753 | 3753 | } |
3754 | 3754 | ); |
@@ -3806,7 +3806,7 @@ discard block |
||
3806 | 3806 | public function stripEmpty(): self |
3807 | 3807 | { |
3808 | 3808 | return $this->filter( |
3809 | - static function ($item) { |
|
3809 | + static function($item) { |
|
3810 | 3810 | if ($item === null) { |
3811 | 3811 | return false; |
3812 | 3812 | } |
@@ -3886,7 +3886,7 @@ discard block |
||
3886 | 3886 | // INFO: \array_unique() can't handle e.g. "stdClass"-values in an array |
3887 | 3887 | |
3888 | 3888 | $this->array = $this->reduce( |
3889 | - static function ($resultArray, $value) { |
|
3889 | + static function($resultArray, $value) { |
|
3890 | 3890 | if (!\in_array($value, $resultArray, true)) { |
3891 | 3891 | $resultArray[] = $value; |
3892 | 3892 | } |
@@ -3915,7 +3915,7 @@ discard block |
||
3915 | 3915 | |
3916 | 3916 | $this->array = \array_reduce( |
3917 | 3917 | \array_keys($array), |
3918 | - static function ($resultArray, $key) use ($array) { |
|
3918 | + static function($resultArray, $key) use ($array) { |
|
3919 | 3919 | if (!\in_array($array[$key], $resultArray, true)) { |
3920 | 3920 | $resultArray[$key] = $array[$key]; |
3921 | 3921 | } |
@@ -4357,7 +4357,7 @@ discard block |
||
4357 | 4357 | $this->properties !== [] |
4358 | 4358 | ) { |
4359 | 4359 | if (isset($this->properties[$key]) === false) { |
4360 | - throw new \InvalidArgumentException('The key ' . $key . ' does not exists as @property in the class (' . \get_class($this) . ').'); |
|
4360 | + throw new \InvalidArgumentException('The key '.$key.' does not exists as @property in the class ('.\get_class($this).').'); |
|
4361 | 4361 | } |
4362 | 4362 | |
4363 | 4363 | $this->properties[$key]->checkType($value); |
@@ -4497,7 +4497,7 @@ discard block |
||
4497 | 4497 | private function getPropertiesFromPhpDoc(): array |
4498 | 4498 | { |
4499 | 4499 | static $PROPERTY_CACHE = []; |
4500 | - $cacheKey = 'Class::' . static::class; |
|
4500 | + $cacheKey = 'Class::'.static::class; |
|
4501 | 4501 | |
4502 | 4502 | if (isset($PROPERTY_CACHE[$cacheKey])) { |
4503 | 4503 | return $PROPERTY_CACHE[$cacheKey]; |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | { |
90 | 90 | if ($this->checkType($this->collectionType, $value) === false) { |
91 | 91 | throw new \InvalidArgumentException( |
92 | - 'Value must be of type ' . $this->collectionType . '; value is ' . $this->valueToString($value) |
|
92 | + 'Value must be of type '.$this->collectionType.'; value is '.$this->valueToString($value) |
|
93 | 93 | ); |
94 | 94 | } |
95 | 95 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | { |
110 | 110 | if ($this->checkType($this->collectionType, $value) === false) { |
111 | 111 | throw new \InvalidArgumentException( |
112 | - 'Value must be of type ' . $this->collectionType . '; value is ' . $this->valueToString($value) |
|
112 | + 'Value must be of type '.$this->collectionType.'; value is '.$this->valueToString($value) |
|
113 | 113 | ); |
114 | 114 | } |
115 | 115 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | { |
130 | 130 | if ($this->checkType($this->collectionType, $value) === false) { |
131 | 131 | throw new \InvalidArgumentException( |
132 | - 'Value must be of type ' . $this->collectionType . '; value is ' . $this->valueToString($value) |
|
132 | + 'Value must be of type '.$this->collectionType.'; value is '.$this->valueToString($value) |
|
133 | 133 | ); |
134 | 134 | } |
135 | 135 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | public function where(string $keyOrPropertyOrMethod, $value): CollectionInterface |
171 | 171 | { |
172 | 172 | return $this->filter( |
173 | - function ($item) use ($keyOrPropertyOrMethod, $value) { |
|
173 | + function($item) use ($keyOrPropertyOrMethod, $value) { |
|
174 | 174 | $accessorValue = $this->extractValue( |
175 | 175 | $item, |
176 | 176 | $keyOrPropertyOrMethod |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | { |
195 | 195 | if ($this->checkType($this->collectionType, $value) === false) { |
196 | 196 | throw new \InvalidArgumentException( |
197 | - 'Value must be of type ' . $this->collectionType . '; value is ' . $this->valueToString($value) |
|
197 | + 'Value must be of type '.$this->collectionType.'; value is '.$this->valueToString($value) |
|
198 | 198 | ); |
199 | 199 | } |
200 | 200 | |
@@ -303,10 +303,10 @@ discard block |
||
303 | 303 | |
304 | 304 | // resource |
305 | 305 | if (\is_resource($value)) { |
306 | - return \get_resource_type($value) . ' resource #' . (int) $value; |
|
306 | + return \get_resource_type($value).' resource #'.(int) $value; |
|
307 | 307 | } |
308 | 308 | |
309 | 309 | // object |
310 | - return \get_class($value) . ' Object'; |
|
310 | + return \get_class($value).' Object'; |
|
311 | 311 | } |
312 | 312 | } |