@@ -83,7 +83,7 @@ |
||
83 | 83 | * to |
84 | 84 | * true, otherwise this option didn't not work anyway. |
85 | 85 | * </p> |
86 | - * @param TypeCheckArray|TypeCheckInterface[]|null $type |
|
86 | + * @param null|TypeCheckArray $type |
|
87 | 87 | */ |
88 | 88 | public function __construct( |
89 | 89 | $data = [], |
@@ -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 | } |
@@ -32,6 +32,6 @@ |
||
32 | 32 | */ |
33 | 33 | public function throwException($expectedTypes, $value, $type): \Throwable |
34 | 34 | { |
35 | - throw new \TypeError("Invalid type: expected to be of type {{$expectedTypes}}, instead got value `" . \print_r($value, true) . "` with type {{$type}}."); |
|
35 | + throw new \TypeError("Invalid type: expected to be of type {{$expectedTypes}}, instead got value `".\print_r($value, true)."` with type {{$type}}."); |
|
36 | 36 | } |
37 | 37 | } |
@@ -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 ''; |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | |
450 | 450 | $this->callAtPath( |
451 | 451 | $containerPath, |
452 | - static function ($container) use ($lastOffset, &$offsetExists) { |
|
452 | + static function($container) use ($lastOffset, &$offsetExists) { |
|
453 | 453 | $offsetExists = \array_key_exists($lastOffset, $container); |
454 | 454 | } |
455 | 455 | ); |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | |
532 | 532 | $this->callAtPath( |
533 | 533 | \implode($this->pathSeparator, $path), |
534 | - static function (&$offset) use ($pathToUnset) { |
|
534 | + static function(&$offset) use ($pathToUnset) { |
|
535 | 535 | unset($offset[$pathToUnset]); |
536 | 536 | } |
537 | 537 | ); |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | } |
574 | 574 | |
575 | 575 | if (\strpos($class, '\\') === 0) { |
576 | - $class = '\\' . $class; |
|
576 | + $class = '\\'.$class; |
|
577 | 577 | if (\class_exists($class)) { |
578 | 578 | $this->iteratorClass = $class; |
579 | 579 | |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | } |
582 | 582 | } |
583 | 583 | |
584 | - throw new \InvalidArgumentException('The iterator class does not exist: ' . $class); |
|
584 | + throw new \InvalidArgumentException('The iterator class does not exist: '.$class); |
|
585 | 585 | } |
586 | 586 | |
587 | 587 | /** |
@@ -691,13 +691,13 @@ discard block |
||
691 | 691 | |
692 | 692 | foreach ($this->getGenerator() as $key => $item) { |
693 | 693 | if ($item instanceof self) { |
694 | - $result[$prefix . $key] = $item->appendToEachKey($prefix); |
|
694 | + $result[$prefix.$key] = $item->appendToEachKey($prefix); |
|
695 | 695 | } elseif (\is_array($item) === true) { |
696 | - $result[$prefix . $key] = self::create($item, $this->iteratorClass, false) |
|
696 | + $result[$prefix.$key] = self::create($item, $this->iteratorClass, false) |
|
697 | 697 | ->appendToEachKey($prefix) |
698 | 698 | ->toArray(); |
699 | 699 | } else { |
700 | - $result[$prefix . $key] = $item; |
|
700 | + $result[$prefix.$key] = $item; |
|
701 | 701 | } |
702 | 702 | } |
703 | 703 | |
@@ -725,7 +725,7 @@ discard block |
||
725 | 725 | } elseif (\is_object($item) === true) { |
726 | 726 | $result[$key] = $item; |
727 | 727 | } else { |
728 | - $result[$key] = $prefix . $item; |
|
728 | + $result[$key] = $prefix.$item; |
|
729 | 729 | } |
730 | 730 | } |
731 | 731 | |
@@ -874,7 +874,7 @@ discard block |
||
874 | 874 | public function clean(): self |
875 | 875 | { |
876 | 876 | return $this->filter( |
877 | - static function ($value) { |
|
877 | + static function($value) { |
|
878 | 878 | return (bool) $value; |
879 | 879 | } |
880 | 880 | ); |
@@ -1231,7 +1231,7 @@ discard block |
||
1231 | 1231 | // trim all string in the array |
1232 | 1232 | \array_walk( |
1233 | 1233 | $array, |
1234 | - static function (&$val) { |
|
1234 | + static function(&$val) { |
|
1235 | 1235 | if ((string) $val === $val) { |
1236 | 1236 | $val = \trim($val); |
1237 | 1237 | } |
@@ -1616,40 +1616,40 @@ discard block |
||
1616 | 1616 | } |
1617 | 1617 | |
1618 | 1618 | $ops = [ |
1619 | - 'eq' => static function ($item, $prop, $value) { |
|
1619 | + 'eq' => static function($item, $prop, $value) { |
|
1620 | 1620 | return $item[$prop] === $value; |
1621 | 1621 | }, |
1622 | - 'gt' => static function ($item, $prop, $value) { |
|
1622 | + 'gt' => static function($item, $prop, $value) { |
|
1623 | 1623 | return $item[$prop] > $value; |
1624 | 1624 | }, |
1625 | - 'ge' => static function ($item, $prop, $value) { |
|
1625 | + 'ge' => static function($item, $prop, $value) { |
|
1626 | 1626 | return $item[$prop] >= $value; |
1627 | 1627 | }, |
1628 | - 'gte' => static function ($item, $prop, $value) { |
|
1628 | + 'gte' => static function($item, $prop, $value) { |
|
1629 | 1629 | return $item[$prop] >= $value; |
1630 | 1630 | }, |
1631 | - 'lt' => static function ($item, $prop, $value) { |
|
1631 | + 'lt' => static function($item, $prop, $value) { |
|
1632 | 1632 | return $item[$prop] < $value; |
1633 | 1633 | }, |
1634 | - 'le' => static function ($item, $prop, $value) { |
|
1634 | + 'le' => static function($item, $prop, $value) { |
|
1635 | 1635 | return $item[$prop] <= $value; |
1636 | 1636 | }, |
1637 | - 'lte' => static function ($item, $prop, $value) { |
|
1637 | + 'lte' => static function($item, $prop, $value) { |
|
1638 | 1638 | return $item[$prop] <= $value; |
1639 | 1639 | }, |
1640 | - 'ne' => static function ($item, $prop, $value) { |
|
1640 | + 'ne' => static function($item, $prop, $value) { |
|
1641 | 1641 | return $item[$prop] !== $value; |
1642 | 1642 | }, |
1643 | - 'contains' => static function ($item, $prop, $value) { |
|
1643 | + 'contains' => static function($item, $prop, $value) { |
|
1644 | 1644 | return \in_array($item[$prop], (array) $value, true); |
1645 | 1645 | }, |
1646 | - 'notContains' => static function ($item, $prop, $value) { |
|
1646 | + 'notContains' => static function($item, $prop, $value) { |
|
1647 | 1647 | return !\in_array($item[$prop], (array) $value, true); |
1648 | 1648 | }, |
1649 | - 'newer' => static function ($item, $prop, $value) { |
|
1649 | + 'newer' => static function($item, $prop, $value) { |
|
1650 | 1650 | return \strtotime($item[$prop]) > \strtotime($value); |
1651 | 1651 | }, |
1652 | - 'older' => static function ($item, $prop, $value) { |
|
1652 | + 'older' => static function($item, $prop, $value) { |
|
1653 | 1653 | return \strtotime($item[$prop]) < \strtotime($value); |
1654 | 1654 | }, |
1655 | 1655 | ]; |
@@ -1657,7 +1657,7 @@ discard block |
||
1657 | 1657 | $result = \array_values( |
1658 | 1658 | \array_filter( |
1659 | 1659 | $this->getArray(), |
1660 | - static function ($item) use ( |
|
1660 | + static function($item) use ( |
|
1661 | 1661 | $property, |
1662 | 1662 | $value, |
1663 | 1663 | $ops, |
@@ -2291,7 +2291,7 @@ discard block |
||
2291 | 2291 | \array_uintersect( |
2292 | 2292 | $this->array, |
2293 | 2293 | $search, |
2294 | - static function ($a, $b) { |
|
2294 | + static function($a, $b) { |
|
2295 | 2295 | return $a === $b ? 0 : -1; |
2296 | 2296 | } |
2297 | 2297 | ), |
@@ -2539,13 +2539,13 @@ discard block |
||
2539 | 2539 | // non recursive |
2540 | 2540 | |
2541 | 2541 | if ($search_values === null) { |
2542 | - $arrayFunction = function () { |
|
2542 | + $arrayFunction = function() { |
|
2543 | 2543 | foreach ($this->getGenerator() as $key => $value) { |
2544 | 2544 | yield $key; |
2545 | 2545 | } |
2546 | 2546 | }; |
2547 | 2547 | } else { |
2548 | - $arrayFunction = function () use ($search_values, $strict) { |
|
2548 | + $arrayFunction = function() use ($search_values, $strict) { |
|
2549 | 2549 | $is_array_tmp = \is_array($search_values); |
2550 | 2550 | |
2551 | 2551 | foreach ($this->getGenerator() as $key => $value) { |
@@ -2745,7 +2745,7 @@ discard block |
||
2745 | 2745 | $useArguments = \func_num_args() > 2; |
2746 | 2746 | |
2747 | 2747 | return static::create( |
2748 | - function () use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
2748 | + function() use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
2749 | 2749 | foreach ($this->getGenerator() as $key => $value) { |
2750 | 2750 | if ($useArguments) { |
2751 | 2751 | if ($useKeyAsSecondParameter) { |
@@ -3183,7 +3183,7 @@ discard block |
||
3183 | 3183 | )->prependToEachKey($suffix) |
3184 | 3184 | ->toArray(); |
3185 | 3185 | } else { |
3186 | - $result[$key . $suffix] = $item; |
|
3186 | + $result[$key.$suffix] = $item; |
|
3187 | 3187 | } |
3188 | 3188 | } |
3189 | 3189 | |
@@ -3220,7 +3220,7 @@ discard block |
||
3220 | 3220 | } elseif (\is_object($item) === true) { |
3221 | 3221 | $result[$key] = $item; |
3222 | 3222 | } else { |
3223 | - $result[$key] = $item . $suffix; |
|
3223 | + $result[$key] = $item.$suffix; |
|
3224 | 3224 | } |
3225 | 3225 | } |
3226 | 3226 | |
@@ -3821,7 +3821,7 @@ discard block |
||
3821 | 3821 | public function replaceValues($search, $replacement = ''): self |
3822 | 3822 | { |
3823 | 3823 | return $this->each( |
3824 | - static function ($value) use ($search, $replacement) { |
|
3824 | + static function($value) use ($search, $replacement) { |
|
3825 | 3825 | return \str_replace($search, $replacement, $value); |
3826 | 3826 | } |
3827 | 3827 | ); |
@@ -4340,7 +4340,7 @@ discard block |
||
4340 | 4340 | ); |
4341 | 4341 | |
4342 | 4342 | $results = $arrayy->each( |
4343 | - function ($value) use ($sorter) { |
|
4343 | + function($value) use ($sorter) { |
|
4344 | 4344 | if (\is_callable($sorter) === true) { |
4345 | 4345 | return $sorter($value); |
4346 | 4346 | } |
@@ -4402,7 +4402,7 @@ discard block |
||
4402 | 4402 | public function stripEmpty(): self |
4403 | 4403 | { |
4404 | 4404 | return $this->filter( |
4405 | - static function ($item) { |
|
4405 | + static function($item) { |
|
4406 | 4406 | if ($item === null) { |
4407 | 4407 | return false; |
4408 | 4408 | } |
@@ -4486,7 +4486,7 @@ discard block |
||
4486 | 4486 | // INFO: \array_unique() can't handle e.g. "stdClass"-values in an array |
4487 | 4487 | |
4488 | 4488 | $this->array = $this->reduce( |
4489 | - static function ($resultArray, $value) { |
|
4489 | + static function($resultArray, $value) { |
|
4490 | 4490 | if (!\in_array($value, $resultArray, true)) { |
4491 | 4491 | $resultArray[] = $value; |
4492 | 4492 | } |
@@ -4515,7 +4515,7 @@ discard block |
||
4515 | 4515 | |
4516 | 4516 | $this->array = \array_reduce( |
4517 | 4517 | \array_keys($array), |
4518 | - static function ($resultArray, $key) use ($array) { |
|
4518 | + static function($resultArray, $key) use ($array) { |
|
4519 | 4519 | if (!\in_array($array[$key], $resultArray, true)) { |
4520 | 4520 | $resultArray[$key] = $array[$key]; |
4521 | 4521 | } |
@@ -4574,7 +4574,7 @@ discard block |
||
4574 | 4574 | public function values(): self |
4575 | 4575 | { |
4576 | 4576 | return static::create( |
4577 | - function () { |
|
4577 | + function() { |
|
4578 | 4578 | /** @noinspection YieldFromCanBeUsedInspection */ |
4579 | 4579 | foreach ($this->getGenerator() as $value) { |
4580 | 4580 | yield $value; |
@@ -4641,7 +4641,7 @@ discard block |
||
4641 | 4641 | && |
4642 | 4642 | \count(\array_diff_key($this->properties, $data)) > 0 |
4643 | 4643 | ) { |
4644 | - throw new \TypeError('Property mismatch - input: ' . \print_r(\array_keys($data), true) . ' | expected: ' . \print_r(\array_keys($this->properties), true)); |
|
4644 | + throw new \TypeError('Property mismatch - input: '.\print_r(\array_keys($data), true).' | expected: '.\print_r(\array_keys($this->properties), true)); |
|
4645 | 4645 | } |
4646 | 4646 | |
4647 | 4647 | foreach ($data as $key => &$valueInner) { |
@@ -5183,7 +5183,7 @@ discard block |
||
5183 | 5183 | protected function getPropertiesFromPhpDoc() |
5184 | 5184 | { |
5185 | 5185 | static $PROPERTY_CACHE = []; |
5186 | - $cacheKey = 'Class::' . static::class; |
|
5186 | + $cacheKey = 'Class::'.static::class; |
|
5187 | 5187 | |
5188 | 5188 | if (isset($PROPERTY_CACHE[$cacheKey])) { |
5189 | 5189 | return $PROPERTY_CACHE[$cacheKey]; |
@@ -5234,7 +5234,7 @@ discard block |
||
5234 | 5234 | && |
5235 | 5235 | $this->checkPropertiesMismatch === true |
5236 | 5236 | ) { |
5237 | - throw new \TypeError('The key ' . $key . ' does not exists in "properties". Maybe because @property was not used for the class (' . \get_class($this) . ').'); |
|
5237 | + throw new \TypeError('The key '.$key.' does not exists in "properties". Maybe because @property was not used for the class ('.\get_class($this).').'); |
|
5238 | 5238 | } |
5239 | 5239 | |
5240 | 5240 | if (isset($this->properties[self::ARRAYY_HELPER_TYPES_FOR_ALL_PROPERTIES])) { |
@@ -228,7 +228,7 @@ |
||
228 | 228 | public function where(string $keyOrPropertyOrMethod, $value): CollectionInterface |
229 | 229 | { |
230 | 230 | return $this->filter( |
231 | - function ($item) use ($keyOrPropertyOrMethod, $value) { |
|
231 | + function($item) use ($keyOrPropertyOrMethod, $value) { |
|
232 | 232 | $accessorValue = $this->extractValue( |
233 | 233 | $item, |
234 | 234 | $keyOrPropertyOrMethod |