@@ -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); |
@@ -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 ''; |
@@ -82,32 +82,32 @@ |
||
82 | 82 | \gettype($value) === (self::$typeMapping[$type] ?? $type) |
83 | 83 | || |
84 | 84 | ( |
85 | - $type === 'scalar' |
|
85 | + $type === 'scalar' |
|
86 | 86 | && |
87 | 87 | \is_scalar($value) |
88 | - ) |
|
88 | + ) |
|
89 | 89 | || |
90 | 90 | ( |
91 | - $type === 'callable' |
|
91 | + $type === 'callable' |
|
92 | 92 | && |
93 | 93 | \is_callable($value) |
94 | - ) |
|
94 | + ) |
|
95 | 95 | || |
96 | 96 | ( |
97 | - $type === 'numeric' |
|
97 | + $type === 'numeric' |
|
98 | 98 | && |
99 | 99 | ( |
100 | - \is_float($value) |
|
100 | + \is_float($value) |
|
101 | 101 | || |
102 | 102 | \is_int($value) |
103 | - ) |
|
104 | - ) |
|
103 | + ) |
|
104 | + ) |
|
105 | 105 | || |
106 | 106 | ( |
107 | - $type === 'resource' |
|
107 | + $type === 'resource' |
|
108 | 108 | && |
109 | 109 | \is_resource($value) |
110 | - ); |
|
110 | + ); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -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 | * |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | /** |
30 | 30 | * @param array<mixed> $array |
31 | 31 | * |
32 | - * @return int|string|null |
|
32 | + * @return integer|null |
|
33 | 33 | */ |
34 | 34 | function array_key_first(array $array) |
35 | 35 | { |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | /** |
46 | 46 | * @param array<mixed> $array |
47 | 47 | * |
48 | - * @return int|string|null |
|
48 | + * @return null|integer |
|
49 | 49 | */ |
50 | 50 | function array_key_last(array $array) |
51 | 51 | { |
@@ -1565,7 +1565,7 @@ discard block |
||
1565 | 1565 | * |
1566 | 1566 | * @param float|int|string $low <p>First value of the sequence.</p> |
1567 | 1567 | * @param float|int|string $high <p>The sequence is ended upon reaching the end value.</p> |
1568 | - * @param float|int $step <p>Used as the increment between elements in the sequence.</p> |
|
1568 | + * @param integer $step <p>Used as the increment between elements in the sequence.</p> |
|
1569 | 1569 | * |
1570 | 1570 | * @return static |
1571 | 1571 | * <p>(Immutable) Returns an new instance of the Arrayy object.</p> |
@@ -2162,7 +2162,7 @@ discard block |
||
2162 | 2162 | /** |
2163 | 2163 | * Get the first key from the current array. |
2164 | 2164 | * |
2165 | - * @return mixed |
|
2165 | + * @return integer|null |
|
2166 | 2166 | * <p>Return null if there wasn't a element.</p> |
2167 | 2167 | * @psalm-mutation-free |
2168 | 2168 | */ |
@@ -3230,7 +3230,7 @@ discard block |
||
3230 | 3230 | /** |
3231 | 3231 | * Get the last key from the current array. |
3232 | 3232 | * |
3233 | - * @return mixed|null |
|
3233 | + * @return null|integer |
|
3234 | 3234 | * <p>Return null if there wasn't a element.</p> |
3235 | 3235 | * @psalm-mutation-free |
3236 | 3236 | */ |
@@ -3622,7 +3622,7 @@ discard block |
||
3622 | 3622 | /** |
3623 | 3623 | * Get the most used value from the array. |
3624 | 3624 | * |
3625 | - * @return mixed|null |
|
3625 | + * @return integer|null |
|
3626 | 3626 | * <p>(Immutable) Return null if there wasn't a element.</p> |
3627 | 3627 | * @psalm-mutation-free |
3628 | 3628 | */ |
@@ -5874,7 +5874,7 @@ discard block |
||
5874 | 5874 | } |
5875 | 5875 | |
5876 | 5876 | /** |
5877 | - * @param mixed $path |
|
5877 | + * @param string $path |
|
5878 | 5878 | * @param callable $callable |
5879 | 5879 | * @param array|null $currentOffset |
5880 | 5880 | * |
@@ -6065,7 +6065,7 @@ discard block |
||
6065 | 6065 | } |
6066 | 6066 | |
6067 | 6067 | /** |
6068 | - * @param mixed $glue |
|
6068 | + * @param string $glue |
|
6069 | 6069 | * @param mixed $pieces |
6070 | 6070 | * @param bool $useKeys |
6071 | 6071 | * |
@@ -1267,11 +1267,11 @@ discard block |
||
1267 | 1267 | \array_intersect($needles, $this->keys()->toArray()), |
1268 | 1268 | \COUNT_NORMAL |
1269 | 1269 | ) |
1270 | - === |
|
1271 | - \count( |
|
1272 | - $needles, |
|
1273 | - \COUNT_NORMAL |
|
1274 | - ); |
|
1270 | + === |
|
1271 | + \count( |
|
1272 | + $needles, |
|
1273 | + \COUNT_NORMAL |
|
1274 | + ); |
|
1275 | 1275 | } |
1276 | 1276 | |
1277 | 1277 | /** |
@@ -1334,8 +1334,8 @@ discard block |
||
1334 | 1334 | public function containsValues(array $needles): bool |
1335 | 1335 | { |
1336 | 1336 | return \count(\array_intersect($needles, $this->toArray()), \COUNT_NORMAL) |
1337 | - === |
|
1338 | - \count($needles, \COUNT_NORMAL); |
|
1337 | + === |
|
1338 | + \count($needles, \COUNT_NORMAL); |
|
1339 | 1339 | } |
1340 | 1340 | |
1341 | 1341 | /** |
@@ -3024,15 +3024,15 @@ discard block |
||
3024 | 3024 | |
3025 | 3025 | if ($recursive === true) { |
3026 | 3026 | return $this->array_keys_recursive($this->toArray()) |
3027 | - === |
|
3028 | - \range(0, \count($this->toArray(), \COUNT_RECURSIVE) - 1); |
|
3027 | + === |
|
3028 | + \range(0, \count($this->toArray(), \COUNT_RECURSIVE) - 1); |
|
3029 | 3029 | } |
3030 | 3030 | |
3031 | 3031 | // non recursive |
3032 | 3032 | |
3033 | 3033 | return \array_keys($this->toArray()) |
3034 | - === |
|
3035 | - \range(0, \count($this->toArray(), \COUNT_NORMAL) - 1); |
|
3034 | + === |
|
3035 | + \range(0, \count($this->toArray(), \COUNT_NORMAL) - 1); |
|
3036 | 3036 | } |
3037 | 3037 | |
3038 | 3038 | /** |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | */ |
643 | 643 | $this->callAtPath( |
644 | 644 | $containerPath, |
645 | - static function ($container) use ($lastOffset, &$offsetExists) { |
|
645 | + static function($container) use ($lastOffset, &$offsetExists) { |
|
646 | 646 | $offsetExists = \array_key_exists($lastOffset, $container); |
647 | 647 | } |
648 | 648 | ); |
@@ -742,7 +742,7 @@ discard block |
||
742 | 742 | */ |
743 | 743 | $this->callAtPath( |
744 | 744 | \implode($this->pathSeparator, $path), |
745 | - static function (&$offset) use ($pathToUnset) { |
|
745 | + static function(&$offset) use ($pathToUnset) { |
|
746 | 746 | if (\is_array($offset)) { |
747 | 747 | unset($offset[$pathToUnset]); |
748 | 748 | } else { |
@@ -792,7 +792,7 @@ discard block |
||
792 | 792 | } |
793 | 793 | |
794 | 794 | if (\strpos($iteratorClass, '\\') === 0) { |
795 | - $iteratorClass = '\\' . $iteratorClass; |
|
795 | + $iteratorClass = '\\'.$iteratorClass; |
|
796 | 796 | if (\class_exists($iteratorClass)) { |
797 | 797 | /** |
798 | 798 | * @psalm-suppress PropertyTypeCoercion |
@@ -803,7 +803,7 @@ discard block |
||
803 | 803 | } |
804 | 804 | } |
805 | 805 | |
806 | - throw new \InvalidArgumentException('The iterator class does not exist: ' . $iteratorClass); |
|
806 | + throw new \InvalidArgumentException('The iterator class does not exist: '.$iteratorClass); |
|
807 | 807 | } |
808 | 808 | |
809 | 809 | /** |
@@ -969,13 +969,13 @@ discard block |
||
969 | 969 | |
970 | 970 | foreach ($this->getGenerator() as $key => $item) { |
971 | 971 | if ($item instanceof self) { |
972 | - $result[$prefix . $key] = $item->appendToEachKey($prefix); |
|
972 | + $result[$prefix.$key] = $item->appendToEachKey($prefix); |
|
973 | 973 | } elseif (\is_array($item) === true) { |
974 | - $result[$prefix . $key] = self::create($item, $this->iteratorClass, false) |
|
974 | + $result[$prefix.$key] = self::create($item, $this->iteratorClass, false) |
|
975 | 975 | ->appendToEachKey($prefix) |
976 | 976 | ->toArray(); |
977 | 977 | } else { |
978 | - $result[$prefix . $key] = $item; |
|
978 | + $result[$prefix.$key] = $item; |
|
979 | 979 | } |
980 | 980 | } |
981 | 981 | |
@@ -1006,7 +1006,7 @@ discard block |
||
1006 | 1006 | } elseif (\is_object($item) === true) { |
1007 | 1007 | $result[$key] = $item; |
1008 | 1008 | } else { |
1009 | - $result[$key] = $prefix . $item; |
|
1009 | + $result[$key] = $prefix.$item; |
|
1010 | 1010 | } |
1011 | 1011 | } |
1012 | 1012 | |
@@ -1194,7 +1194,7 @@ discard block |
||
1194 | 1194 | public function clean(): self |
1195 | 1195 | { |
1196 | 1196 | return $this->filter( |
1197 | - static function ($value) { |
|
1197 | + static function($value) { |
|
1198 | 1198 | return (bool) $value; |
1199 | 1199 | } |
1200 | 1200 | ); |
@@ -1489,9 +1489,9 @@ discard block |
||
1489 | 1489 | |
1490 | 1490 | foreach ($items as $key => $value) { |
1491 | 1491 | if (\is_array($value) && !empty($value)) { |
1492 | - $flatten[] = $this->flatten($delimiter, $prepend . $key . $delimiter, $value); |
|
1492 | + $flatten[] = $this->flatten($delimiter, $prepend.$key.$delimiter, $value); |
|
1493 | 1493 | } else { |
1494 | - $flatten[] = [$prepend . $key => $value]; |
|
1494 | + $flatten[] = [$prepend.$key => $value]; |
|
1495 | 1495 | } |
1496 | 1496 | } |
1497 | 1497 | |
@@ -1669,7 +1669,7 @@ discard block |
||
1669 | 1669 | */ |
1670 | 1670 | \array_walk( |
1671 | 1671 | $array, |
1672 | - static function (&$val) { |
|
1672 | + static function(&$val) { |
|
1673 | 1673 | if ((string) $val === $val) { |
1674 | 1674 | $val = \trim($val); |
1675 | 1675 | } |
@@ -2181,40 +2181,40 @@ discard block |
||
2181 | 2181 | } |
2182 | 2182 | |
2183 | 2183 | $ops = [ |
2184 | - 'eq' => static function ($item, $prop, $value): bool { |
|
2184 | + 'eq' => static function($item, $prop, $value): bool { |
|
2185 | 2185 | return $item[$prop] === $value; |
2186 | 2186 | }, |
2187 | - 'gt' => static function ($item, $prop, $value): bool { |
|
2187 | + 'gt' => static function($item, $prop, $value): bool { |
|
2188 | 2188 | return $item[$prop] > $value; |
2189 | 2189 | }, |
2190 | - 'ge' => static function ($item, $prop, $value): bool { |
|
2190 | + 'ge' => static function($item, $prop, $value): bool { |
|
2191 | 2191 | return $item[$prop] >= $value; |
2192 | 2192 | }, |
2193 | - 'gte' => static function ($item, $prop, $value): bool { |
|
2193 | + 'gte' => static function($item, $prop, $value): bool { |
|
2194 | 2194 | return $item[$prop] >= $value; |
2195 | 2195 | }, |
2196 | - 'lt' => static function ($item, $prop, $value): bool { |
|
2196 | + 'lt' => static function($item, $prop, $value): bool { |
|
2197 | 2197 | return $item[$prop] < $value; |
2198 | 2198 | }, |
2199 | - 'le' => static function ($item, $prop, $value): bool { |
|
2199 | + 'le' => static function($item, $prop, $value): bool { |
|
2200 | 2200 | return $item[$prop] <= $value; |
2201 | 2201 | }, |
2202 | - 'lte' => static function ($item, $prop, $value): bool { |
|
2202 | + 'lte' => static function($item, $prop, $value): bool { |
|
2203 | 2203 | return $item[$prop] <= $value; |
2204 | 2204 | }, |
2205 | - 'ne' => static function ($item, $prop, $value): bool { |
|
2205 | + 'ne' => static function($item, $prop, $value): bool { |
|
2206 | 2206 | return $item[$prop] !== $value; |
2207 | 2207 | }, |
2208 | - 'contains' => static function ($item, $prop, $value): bool { |
|
2208 | + 'contains' => static function($item, $prop, $value): bool { |
|
2209 | 2209 | return \in_array($item[$prop], (array) $value, true); |
2210 | 2210 | }, |
2211 | - 'notContains' => static function ($item, $prop, $value): bool { |
|
2211 | + 'notContains' => static function($item, $prop, $value): bool { |
|
2212 | 2212 | return !\in_array($item[$prop], (array) $value, true); |
2213 | 2213 | }, |
2214 | - 'newer' => static function ($item, $prop, $value): bool { |
|
2214 | + 'newer' => static function($item, $prop, $value): bool { |
|
2215 | 2215 | return \strtotime($item[$prop]) > \strtotime($value); |
2216 | 2216 | }, |
2217 | - 'older' => static function ($item, $prop, $value): bool { |
|
2217 | + 'older' => static function($item, $prop, $value): bool { |
|
2218 | 2218 | return \strtotime($item[$prop]) < \strtotime($value); |
2219 | 2219 | }, |
2220 | 2220 | ]; |
@@ -2222,7 +2222,7 @@ discard block |
||
2222 | 2222 | $result = \array_values( |
2223 | 2223 | \array_filter( |
2224 | 2224 | $this->toArray(false, true), |
2225 | - static function ($item) use ( |
|
2225 | + static function($item) use ( |
|
2226 | 2226 | $property, |
2227 | 2227 | $value, |
2228 | 2228 | $ops, |
@@ -2578,9 +2578,9 @@ discard block |
||
2578 | 2578 | $jsonObject = \json_decode($json, false); |
2579 | 2579 | |
2580 | 2580 | $mapper = new \Arrayy\Mapper\Json(); |
2581 | - $mapper->undefinedPropertyHandler = static function ($object, $key, $jsonValue) use ($class) { |
|
2581 | + $mapper->undefinedPropertyHandler = static function($object, $key, $jsonValue) use ($class) { |
|
2582 | 2582 | if ($class->checkPropertiesMismatchInConstructor) { |
2583 | - throw new \TypeError('Property mismatch - input: ' . \print_r(['key' => $key, 'jsonValue' => $jsonValue], true) . ' for object: ' . \get_class($object)); |
|
2583 | + throw new \TypeError('Property mismatch - input: '.\print_r(['key' => $key, 'jsonValue' => $jsonValue], true).' for object: '.\get_class($object)); |
|
2584 | 2584 | } |
2585 | 2585 | }; |
2586 | 2586 | |
@@ -3038,7 +3038,7 @@ discard block |
||
3038 | 3038 | \array_uintersect( |
3039 | 3039 | $this->toArray(), |
3040 | 3040 | $search, |
3041 | - static function ($a, $b) { |
|
3041 | + static function($a, $b) { |
|
3042 | 3042 | return $a === $b ? 0 : -1; |
3043 | 3043 | } |
3044 | 3044 | ), |
@@ -3333,13 +3333,13 @@ discard block |
||
3333 | 3333 | // non recursive |
3334 | 3334 | |
3335 | 3335 | if ($search_values === null) { |
3336 | - $arrayFunction = function (): \Generator { |
|
3336 | + $arrayFunction = function(): \Generator { |
|
3337 | 3337 | foreach ($this->getGenerator() as $key => $value) { |
3338 | 3338 | yield $key; |
3339 | 3339 | } |
3340 | 3340 | }; |
3341 | 3341 | } else { |
3342 | - $arrayFunction = function () use ($search_values, $strict): \Generator { |
|
3342 | + $arrayFunction = function() use ($search_values, $strict): \Generator { |
|
3343 | 3343 | $is_array_tmp = \is_array($search_values); |
3344 | 3344 | |
3345 | 3345 | foreach ($this->getGeneratorByReference() as $key => &$value) { |
@@ -3585,7 +3585,7 @@ discard block |
||
3585 | 3585 | $useArguments = \func_num_args() > 2; |
3586 | 3586 | |
3587 | 3587 | return static::create( |
3588 | - function () use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
3588 | + function() use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
3589 | 3589 | foreach ($this->getGenerator() as $key => $value) { |
3590 | 3590 | if ($useArguments) { |
3591 | 3591 | if ($useKeyAsSecondParameter) { |
@@ -4005,7 +4005,7 @@ discard block |
||
4005 | 4005 | */ |
4006 | 4006 | public function nth(int $step, int $offset = 0): self |
4007 | 4007 | { |
4008 | - $arrayFunction = function () use ($step, $offset): \Generator { |
|
4008 | + $arrayFunction = function() use ($step, $offset): \Generator { |
|
4009 | 4009 | $position = 0; |
4010 | 4010 | foreach ($this->getGenerator() as $key => $value) { |
4011 | 4011 | if ($position++ % $step !== $offset) { |
@@ -4169,7 +4169,7 @@ discard block |
||
4169 | 4169 | )->prependToEachKey($suffix) |
4170 | 4170 | ->toArray(); |
4171 | 4171 | } else { |
4172 | - $result[$key . $suffix] = $item; |
|
4172 | + $result[$key.$suffix] = $item; |
|
4173 | 4173 | } |
4174 | 4174 | } |
4175 | 4175 | |
@@ -4209,7 +4209,7 @@ discard block |
||
4209 | 4209 | } elseif (\is_object($item) === true) { |
4210 | 4210 | $result[$key] = $item; |
4211 | 4211 | } else { |
4212 | - $result[$key] = $item . $suffix; |
|
4212 | + $result[$key] = $item.$suffix; |
|
4213 | 4213 | } |
4214 | 4214 | } |
4215 | 4215 | |
@@ -4901,7 +4901,7 @@ discard block |
||
4901 | 4901 | * @psalm-suppress MissingClosureParamType |
4902 | 4902 | */ |
4903 | 4903 | return $this->each( |
4904 | - static function ($value) use ($search, $replacement) { |
|
4904 | + static function($value) use ($search, $replacement) { |
|
4905 | 4905 | return \str_replace($search, $replacement, $value); |
4906 | 4906 | } |
4907 | 4907 | ); |
@@ -5527,7 +5527,7 @@ discard block |
||
5527 | 5527 | * @psalm-suppress MissingClosureParamType |
5528 | 5528 | */ |
5529 | 5529 | $results = $arrayy->each( |
5530 | - function ($value) use ($sorter) { |
|
5530 | + function($value) use ($sorter) { |
|
5531 | 5531 | if (\is_callable($sorter) === true) { |
5532 | 5532 | return $sorter($value); |
5533 | 5533 | } |
@@ -5625,7 +5625,7 @@ discard block |
||
5625 | 5625 | public function stripEmpty(): self |
5626 | 5626 | { |
5627 | 5627 | return $this->filter( |
5628 | - static function ($item) { |
|
5628 | + static function($item) { |
|
5629 | 5629 | if ($item === null) { |
5630 | 5630 | return false; |
5631 | 5631 | } |
@@ -5814,7 +5814,7 @@ discard block |
||
5814 | 5814 | * @psalm-suppress MissingClosureParamType |
5815 | 5815 | */ |
5816 | 5816 | $this->array = $this->reduce( |
5817 | - static function ($resultArray, $value) { |
|
5817 | + static function($resultArray, $value) { |
|
5818 | 5818 | if (!\in_array($value, $resultArray, true)) { |
5819 | 5819 | $resultArray[] = $value; |
5820 | 5820 | } |
@@ -5849,7 +5849,7 @@ discard block |
||
5849 | 5849 | */ |
5850 | 5850 | $this->array = \array_reduce( |
5851 | 5851 | \array_keys($array), |
5852 | - static function ($resultArray, $key) use ($array) { |
|
5852 | + static function($resultArray, $key) use ($array) { |
|
5853 | 5853 | if (!\in_array($array[$key], $resultArray, true)) { |
5854 | 5854 | $resultArray[$key] = $array[$key]; |
5855 | 5855 | } |
@@ -5929,7 +5929,7 @@ discard block |
||
5929 | 5929 | public function values(): self |
5930 | 5930 | { |
5931 | 5931 | return static::create( |
5932 | - function () { |
|
5932 | + function() { |
|
5933 | 5933 | /** @noinspection YieldFromCanBeUsedInspection */ |
5934 | 5934 | foreach ($this->getGenerator() as $value) { |
5935 | 5935 | yield $value; |
@@ -5982,7 +5982,7 @@ discard block |
||
5982 | 5982 | public function where(string $keyOrPropertyOrMethod, $value): self |
5983 | 5983 | { |
5984 | 5984 | return $this->filter( |
5985 | - function ($item) use ($keyOrPropertyOrMethod, $value) { |
|
5985 | + function($item) use ($keyOrPropertyOrMethod, $value) { |
|
5986 | 5986 | $accessorValue = $this->extractValue( |
5987 | 5987 | $item, |
5988 | 5988 | $keyOrPropertyOrMethod |
@@ -6272,7 +6272,7 @@ discard block |
||
6272 | 6272 | protected function getPropertiesFromPhpDoc() |
6273 | 6273 | { |
6274 | 6274 | static $PROPERTY_CACHE = []; |
6275 | - $cacheKey = 'Class::' . static::class; |
|
6275 | + $cacheKey = 'Class::'.static::class; |
|
6276 | 6276 | |
6277 | 6277 | if (isset($PROPERTY_CACHE[$cacheKey])) { |
6278 | 6278 | return $PROPERTY_CACHE[$cacheKey]; |
@@ -6554,7 +6554,7 @@ discard block |
||
6554 | 6554 | if ($array === null) { |
6555 | 6555 | $array = []; |
6556 | 6556 | } elseif (!\is_array($array)) { |
6557 | - throw new \RuntimeException('Can not set value at this path "' . $key . '" because (' . \gettype($array) . ')"' . \print_r($array, true) . '" is not an array.'); |
|
6557 | + throw new \RuntimeException('Can not set value at this path "'.$key.'" because ('.\gettype($array).')"'.\print_r($array, true).'" is not an array.'); |
|
6558 | 6558 | } |
6559 | 6559 | |
6560 | 6560 | $array[$key] = $value; |
@@ -6630,7 +6630,7 @@ discard block |
||
6630 | 6630 | && |
6631 | 6631 | \count(\array_diff_key($properties, $data)) > 0 |
6632 | 6632 | ) { |
6633 | - throw new \TypeError('Property mismatch - input: ' . \print_r(\array_keys($data), true) . ' | expected: ' . \print_r(\array_keys($properties), true)); |
|
6633 | + throw new \TypeError('Property mismatch - input: '.\print_r(\array_keys($data), true).' | expected: '.\print_r(\array_keys($properties), true)); |
|
6634 | 6634 | } |
6635 | 6635 | |
6636 | 6636 | foreach ($data as $key => &$valueInner) { |
@@ -6743,7 +6743,7 @@ discard block |
||
6743 | 6743 | * |
6744 | 6744 | * @return void |
6745 | 6745 | */ |
6746 | - static function (&$item) { |
|
6746 | + static function(&$item) { |
|
6747 | 6747 | if ($item instanceof self) { |
6748 | 6748 | $item = $item->getArray(); |
6749 | 6749 | } |
@@ -6768,7 +6768,7 @@ discard block |
||
6768 | 6768 | && |
6769 | 6769 | $this->checkPropertiesMismatch === true |
6770 | 6770 | ) { |
6771 | - throw new \TypeError('The key ' . $key . ' does not exists in "properties". Maybe because @property was not used for the class (' . \get_class($this) . ').'); |
|
6771 | + throw new \TypeError('The key '.$key.' does not exists in "properties". Maybe because @property was not used for the class ('.\get_class($this).').'); |
|
6772 | 6772 | } |
6773 | 6773 | |
6774 | 6774 | if (isset($this->properties[self::ARRAYY_HELPER_TYPES_FOR_ALL_PROPERTIES])) { |
@@ -290,9 +290,9 @@ |
||
290 | 290 | $return = static::create(); |
291 | 291 | $jsonObject = \json_decode($json, false); |
292 | 292 | $mapper = new \Arrayy\Mapper\Json(); |
293 | - $mapper->undefinedPropertyHandler = static function ($object, $key, $jsonValue) use ($return) { |
|
293 | + $mapper->undefinedPropertyHandler = static function($object, $key, $jsonValue) use ($return) { |
|
294 | 294 | if ($return->checkForMissingPropertiesInConstructor) { |
295 | - throw new \TypeError('Property mismatch - input: ' . \print_r(['key' => $key, 'jsonValue' => $jsonValue], true) . ' for object: ' . \get_class($object)); |
|
295 | + throw new \TypeError('Property mismatch - input: '.\print_r(['key' => $key, 'jsonValue' => $jsonValue], true).' for object: '.\get_class($object)); |
|
296 | 296 | } |
297 | 297 | }; |
298 | 298 |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | |
66 | 66 | if (!\is_object($object)) { |
67 | 67 | throw new \InvalidArgumentException( |
68 | - 'JsonMapper::map() requires second argument to be an object, ' . \gettype($object) . ' given.' |
|
68 | + 'JsonMapper::map() requires second argument to be an object, '.\gettype($object).' given.' |
|
69 | 69 | ); |
70 | 70 | } |
71 | 71 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $type = $this->removeNullable($type); |
115 | 115 | } elseif ($jsonValue === null) { |
116 | 116 | throw new \InvalidArgumentException( |
117 | - 'JSON property "' . $key . '" in class "' . $strClassName . '" must not be NULL' |
|
117 | + 'JSON property "'.$key.'" in class "'.$strClassName.'" must not be NULL' |
|
118 | 118 | ); |
119 | 119 | } |
120 | 120 | |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | if ($this->isSimpleType($type)) { |
142 | 142 | if ($type === 'string' && \is_object($jsonValue)) { |
143 | 143 | throw new \InvalidArgumentException( |
144 | - 'JSON property "' . $key . '" in class "' . $strClassName . '" is an object and cannot be converted to a string' |
|
144 | + 'JSON property "'.$key.'" in class "'.$strClassName.'" is an object and cannot be converted to a string' |
|
145 | 145 | ); |
146 | 146 | } |
147 | 147 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | |
163 | 163 | if ($type === '') { |
164 | 164 | throw new \InvalidArgumentException( |
165 | - 'Empty type at property "' . $strClassName . '::$' . $key . '"' |
|
165 | + 'Empty type at property "'.$strClassName.'::$'.$key.'"' |
|
166 | 166 | ); |
167 | 167 | } |
168 | 168 | |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | $this->isScalarType(\gettype($jsonValue)) |
197 | 197 | ) { |
198 | 198 | throw new \InvalidArgumentException( |
199 | - 'JSON property "' . $key . '" must be an array, ' . \gettype($jsonValue) . ' given' |
|
199 | + 'JSON property "'.$key.'" must be an array, '.\gettype($jsonValue).' given' |
|
200 | 200 | ); |
201 | 201 | } |
202 | 202 | |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | } |
274 | 274 | } elseif ($this->isScalarType($class)) { |
275 | 275 | throw new \InvalidArgumentException( |
276 | - 'JSON property "' . ($parent_key ?: '?') . '" is an array of type "' . $class . '" but contained a value of type "' . \gettype($jsonValue) . '"' |
|
276 | + 'JSON property "'.($parent_key ?: '?').'" is an array of type "'.$class.'" but contained a value of type "'.\gettype($jsonValue).'"' |
|
277 | 277 | ); |
278 | 278 | } elseif (\is_a($class, \ArrayObject::class, true)) { |
279 | 279 | /** @noinspection PhpSillyAssignmentInspection - phpstan helper */ |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | } |
330 | 330 | |
331 | 331 | //create a full qualified namespace |
332 | - return '\\' . $strNs . '\\' . $type; |
|
332 | + return '\\'.$strNs.'\\'.$type; |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | /** |
@@ -633,7 +633,7 @@ discard block |
||
633 | 633 | */ |
634 | 634 | private function isNullable($type): bool |
635 | 635 | { |
636 | - return \stripos('|' . $type . '|', '|null|') !== false; |
|
636 | + return \stripos('|'.$type.'|', '|null|') !== false; |
|
637 | 637 | } |
638 | 638 | |
639 | 639 | /** |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | } |
651 | 651 | |
652 | 652 | return \substr( |
653 | - \str_ireplace('|null|', '|', '|' . $type . '|'), |
|
653 | + \str_ireplace('|null|', '|', '|'.$type.'|'), |
|
654 | 654 | 1, |
655 | 655 | -1 |
656 | 656 | ); |