@@ -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 | /** |
@@ -104,7 +104,7 @@ 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 | foreach ($array as $key => &$value) { |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | |
452 | 452 | $this->callAtPath( |
453 | 453 | $containerPath, |
454 | - static function ($container) use ($lastOffset, &$offsetExists) { |
|
454 | + static function($container) use ($lastOffset, &$offsetExists) { |
|
455 | 455 | $offsetExists = \array_key_exists($lastOffset, $container); |
456 | 456 | } |
457 | 457 | ); |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | |
516 | 516 | $this->callAtPath( |
517 | 517 | \implode($this->pathSeparator, $path), |
518 | - static function (&$offset) use ($pathToUnset) { |
|
518 | + static function(&$offset) use ($pathToUnset) { |
|
519 | 519 | unset($offset[$pathToUnset]); |
520 | 520 | } |
521 | 521 | ); |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | } |
553 | 553 | |
554 | 554 | if (\strpos($class, '\\') === 0) { |
555 | - $class = '\\' . $class; |
|
555 | + $class = '\\'.$class; |
|
556 | 556 | if (\class_exists($class)) { |
557 | 557 | $this->iteratorClass = $class; |
558 | 558 | |
@@ -560,7 +560,7 @@ discard block |
||
560 | 560 | } |
561 | 561 | } |
562 | 562 | |
563 | - throw new \InvalidArgumentException('The iterator class does not exist: ' . $class); |
|
563 | + throw new \InvalidArgumentException('The iterator class does not exist: '.$class); |
|
564 | 564 | } |
565 | 565 | |
566 | 566 | /** |
@@ -668,13 +668,13 @@ discard block |
||
668 | 668 | |
669 | 669 | foreach ($this->getGenerator() as $key => $item) { |
670 | 670 | if ($item instanceof self) { |
671 | - $result[$prefix . $key] = $item->appendToEachKey($prefix); |
|
671 | + $result[$prefix.$key] = $item->appendToEachKey($prefix); |
|
672 | 672 | } elseif (\is_array($item)) { |
673 | - $result[$prefix . $key] = self::create($item, $this->iteratorClass, false) |
|
673 | + $result[$prefix.$key] = self::create($item, $this->iteratorClass, false) |
|
674 | 674 | ->appendToEachKey($prefix) |
675 | 675 | ->toArray(); |
676 | 676 | } else { |
677 | - $result[$prefix . $key] = $item; |
|
677 | + $result[$prefix.$key] = $item; |
|
678 | 678 | } |
679 | 679 | } |
680 | 680 | |
@@ -702,7 +702,7 @@ discard block |
||
702 | 702 | } elseif (\is_object($item)) { |
703 | 703 | $result[$key] = $item; |
704 | 704 | } else { |
705 | - $result[$key] = $prefix . $item; |
|
705 | + $result[$key] = $prefix.$item; |
|
706 | 706 | } |
707 | 707 | } |
708 | 708 | |
@@ -853,7 +853,7 @@ discard block |
||
853 | 853 | public function clean(): self |
854 | 854 | { |
855 | 855 | return $this->filter( |
856 | - static function ($value) { |
|
856 | + static function($value) { |
|
857 | 857 | return (bool) $value; |
858 | 858 | } |
859 | 859 | ); |
@@ -906,7 +906,7 @@ discard block |
||
906 | 906 | return $this->in_array_recursive( |
907 | 907 | \mb_strtoupper((string) $value), |
908 | 908 | $this->walk( |
909 | - static function (&$val) { |
|
909 | + static function(&$val) { |
|
910 | 910 | /** @noinspection PhpComposerExtensionStubsInspection */ |
911 | 911 | $val = \mb_strtoupper((string) $val); |
912 | 912 | }, |
@@ -920,7 +920,7 @@ discard block |
||
920 | 920 | return \in_array( |
921 | 921 | \mb_strtoupper((string) $value), |
922 | 922 | $this->walk( |
923 | - static function (&$val) { |
|
923 | + static function(&$val) { |
|
924 | 924 | /** @noinspection PhpComposerExtensionStubsInspection */ |
925 | 925 | $val = \mb_strtoupper((string) $val); |
926 | 926 | }, |
@@ -1097,7 +1097,7 @@ discard block |
||
1097 | 1097 | public static function createFromGeneratorImmutable(\Generator $generator): self |
1098 | 1098 | { |
1099 | 1099 | // init |
1100 | - $array = new static( $generator); |
|
1100 | + $array = new static($generator); |
|
1101 | 1101 | |
1102 | 1102 | return $array; |
1103 | 1103 | } |
@@ -1181,7 +1181,7 @@ discard block |
||
1181 | 1181 | // trim all string in the array |
1182 | 1182 | \array_walk( |
1183 | 1183 | $array, |
1184 | - static function (&$val) { |
|
1184 | + static function(&$val) { |
|
1185 | 1185 | if (\is_string($val)) { |
1186 | 1186 | $val = \trim($val); |
1187 | 1187 | } |
@@ -1497,40 +1497,40 @@ discard block |
||
1497 | 1497 | } |
1498 | 1498 | |
1499 | 1499 | $ops = [ |
1500 | - 'eq' => static function ($item, $prop, $value) { |
|
1500 | + 'eq' => static function($item, $prop, $value) { |
|
1501 | 1501 | return $item[$prop] === $value; |
1502 | 1502 | }, |
1503 | - 'gt' => static function ($item, $prop, $value) { |
|
1503 | + 'gt' => static function($item, $prop, $value) { |
|
1504 | 1504 | return $item[$prop] > $value; |
1505 | 1505 | }, |
1506 | - 'ge' => static function ($item, $prop, $value) { |
|
1506 | + 'ge' => static function($item, $prop, $value) { |
|
1507 | 1507 | return $item[$prop] >= $value; |
1508 | 1508 | }, |
1509 | - 'gte' => static function ($item, $prop, $value) { |
|
1509 | + 'gte' => static function($item, $prop, $value) { |
|
1510 | 1510 | return $item[$prop] >= $value; |
1511 | 1511 | }, |
1512 | - 'lt' => static function ($item, $prop, $value) { |
|
1512 | + 'lt' => static function($item, $prop, $value) { |
|
1513 | 1513 | return $item[$prop] < $value; |
1514 | 1514 | }, |
1515 | - 'le' => static function ($item, $prop, $value) { |
|
1515 | + 'le' => static function($item, $prop, $value) { |
|
1516 | 1516 | return $item[$prop] <= $value; |
1517 | 1517 | }, |
1518 | - 'lte' => static function ($item, $prop, $value) { |
|
1518 | + 'lte' => static function($item, $prop, $value) { |
|
1519 | 1519 | return $item[$prop] <= $value; |
1520 | 1520 | }, |
1521 | - 'ne' => static function ($item, $prop, $value) { |
|
1521 | + 'ne' => static function($item, $prop, $value) { |
|
1522 | 1522 | return $item[$prop] !== $value; |
1523 | 1523 | }, |
1524 | - 'contains' => static function ($item, $prop, $value) { |
|
1524 | + 'contains' => static function($item, $prop, $value) { |
|
1525 | 1525 | return \in_array($item[$prop], (array) $value, true); |
1526 | 1526 | }, |
1527 | - 'notContains' => static function ($item, $prop, $value) { |
|
1527 | + 'notContains' => static function($item, $prop, $value) { |
|
1528 | 1528 | return !\in_array($item[$prop], (array) $value, true); |
1529 | 1529 | }, |
1530 | - 'newer' => static function ($item, $prop, $value) { |
|
1530 | + 'newer' => static function($item, $prop, $value) { |
|
1531 | 1531 | return \strtotime($item[$prop]) > \strtotime($value); |
1532 | 1532 | }, |
1533 | - 'older' => static function ($item, $prop, $value) { |
|
1533 | + 'older' => static function($item, $prop, $value) { |
|
1534 | 1534 | return \strtotime($item[$prop]) < \strtotime($value); |
1535 | 1535 | }, |
1536 | 1536 | ]; |
@@ -1538,7 +1538,7 @@ discard block |
||
1538 | 1538 | $result = \array_values( |
1539 | 1539 | \array_filter( |
1540 | 1540 | $this->getArray(), |
1541 | - static function ($item) use ( |
|
1541 | + static function($item) use ( |
|
1542 | 1542 | $property, |
1543 | 1543 | $value, |
1544 | 1544 | $ops, |
@@ -2669,7 +2669,7 @@ discard block |
||
2669 | 2669 | } elseif (\is_array($item)) { |
2670 | 2670 | $result[$key] = self::create($item, $this->iteratorClass, false)->prependToEachKey($suffix)->toArray(); |
2671 | 2671 | } else { |
2672 | - $result[$key . $suffix] = $item; |
|
2672 | + $result[$key.$suffix] = $item; |
|
2673 | 2673 | } |
2674 | 2674 | } |
2675 | 2675 | |
@@ -2699,7 +2699,7 @@ discard block |
||
2699 | 2699 | } elseif (\is_object($item)) { |
2700 | 2700 | $result[$key] = $item; |
2701 | 2701 | } else { |
2702 | - $result[$key] = $item . $suffix; |
|
2702 | + $result[$key] = $item.$suffix; |
|
2703 | 2703 | } |
2704 | 2704 | } |
2705 | 2705 | |
@@ -2905,7 +2905,7 @@ discard block |
||
2905 | 2905 | if ($this->generator) { |
2906 | 2906 | $result = $init; |
2907 | 2907 | |
2908 | - foreach($this->getGenerator() as $value) { |
|
2908 | + foreach ($this->getGenerator() as $value) { |
|
2909 | 2909 | $result = $callable($result, $value); |
2910 | 2910 | } |
2911 | 2911 | |
@@ -3166,7 +3166,7 @@ discard block |
||
3166 | 3166 | public function replaceValues($search, $replacement = ''): self |
3167 | 3167 | { |
3168 | 3168 | $array = $this->each( |
3169 | - static function ($value) use ($search, $replacement) { |
|
3169 | + static function($value) use ($search, $replacement) { |
|
3170 | 3170 | return \str_replace($search, $replacement, $value); |
3171 | 3171 | } |
3172 | 3172 | ); |
@@ -3554,7 +3554,7 @@ discard block |
||
3554 | 3554 | |
3555 | 3555 | $that = $this; |
3556 | 3556 | $results = $arrayy->each( |
3557 | - static function ($value) use ($sorter, $that) { |
|
3557 | + static function($value) use ($sorter, $that) { |
|
3558 | 3558 | return \is_callable($sorter) ? $sorter($value) : $that->get($sorter, null, $value); |
3559 | 3559 | } |
3560 | 3560 | ); |
@@ -3604,7 +3604,7 @@ discard block |
||
3604 | 3604 | public function stripEmpty(): self |
3605 | 3605 | { |
3606 | 3606 | return $this->filter( |
3607 | - static function ($item) { |
|
3607 | + static function($item) { |
|
3608 | 3608 | if ($item === null) { |
3609 | 3609 | return false; |
3610 | 3610 | } |
@@ -3680,7 +3680,7 @@ discard block |
||
3680 | 3680 | // INFO: \array_unique() can't handle e.g. "stdClass"-values in an array |
3681 | 3681 | |
3682 | 3682 | $this->array = $this->reduce( |
3683 | - static function ($resultArray, $value) { |
|
3683 | + static function($resultArray, $value) { |
|
3684 | 3684 | if (!\in_array($value, $resultArray, true)) { |
3685 | 3685 | $resultArray[] = $value; |
3686 | 3686 | } |
@@ -3709,7 +3709,7 @@ discard block |
||
3709 | 3709 | |
3710 | 3710 | $this->array = \array_reduce( |
3711 | 3711 | \array_keys($array), |
3712 | - static function ($resultArray, $key) use ($array) { |
|
3712 | + static function($resultArray, $key) use ($array) { |
|
3713 | 3713 | if (!\in_array($array[$key], $resultArray, true)) { |
3714 | 3714 | $resultArray[$key] = $array[$key]; |
3715 | 3715 | } |
@@ -3769,7 +3769,7 @@ discard block |
||
3769 | 3769 | public function values(): self |
3770 | 3770 | { |
3771 | 3771 | return static::create( |
3772 | - \array_values( $this->getArray()), |
|
3772 | + \array_values($this->getArray()), |
|
3773 | 3773 | $this->iteratorClass, |
3774 | 3774 | false |
3775 | 3775 | ); |
@@ -4006,7 +4006,7 @@ discard block |
||
4006 | 4006 | private function getPropertiesFromPhpDoc(): array |
4007 | 4007 | { |
4008 | 4008 | static $PROPERTY_CACHE = []; |
4009 | - $cacheKey = 'Class::' . static::class; |
|
4009 | + $cacheKey = 'Class::'.static::class; |
|
4010 | 4010 | |
4011 | 4011 | if (isset($PROPERTY_CACHE[$cacheKey])) { |
4012 | 4012 | return $PROPERTY_CACHE[$cacheKey]; |
@@ -4174,7 +4174,7 @@ discard block |
||
4174 | 4174 | $this->properties !== [] |
4175 | 4175 | ) { |
4176 | 4176 | if (isset($this->properties[$key]) === false) { |
4177 | - throw new \InvalidArgumentException('The key ' . $key . ' does not exists as @property in the class (' . \get_class($this) . ').'); |
|
4177 | + throw new \InvalidArgumentException('The key '.$key.' does not exists as @property in the class ('.\get_class($this).').'); |
|
4178 | 4178 | } |
4179 | 4179 | |
4180 | 4180 | $this->properties[$key]->checkType($value); |