@@ -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 | { |
@@ -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 | ); |
@@ -1,11 +1,11 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -require __DIR__ . '/../vendor/autoload.php'; |
|
| 4 | -require __DIR__ . '/vendor/autoload.php'; |
|
| 3 | +require __DIR__.'/../vendor/autoload.php'; |
|
| 4 | +require __DIR__.'/vendor/autoload.php'; |
|
| 5 | 5 | |
| 6 | 6 | $readmeText = (new \voku\PhpReadmeHelper\GenerateApi())->generate( |
| 7 | - __DIR__ . '/../src/Arrayy.php', |
|
| 8 | - __DIR__ . '/docs/base.md' |
|
| 7 | + __DIR__.'/../src/Arrayy.php', |
|
| 8 | + __DIR__.'/docs/base.md' |
|
| 9 | 9 | ); |
| 10 | 10 | |
| 11 | -file_put_contents(__DIR__ . '/../README.md', $readmeText); |
|
| 11 | +file_put_contents(__DIR__.'/../README.md', $readmeText); |
|