@@ -50,7 +50,7 @@ |
||
| 50 | 50 | * Read the next value, convert it to its type and return it |
| 51 | 51 | * |
| 52 | 52 | * @param JsonReadable $reader |
| 53 | - * @return DateTimeInterface|null |
|
| 53 | + * @return null|DateTime |
|
| 54 | 54 | * @throws \Tebru\Gson\Exception\JsonSyntaxException If the DateTime could not be created from format |
| 55 | 55 | */ |
| 56 | 56 | public function read(JsonReadable $reader): ?DateTimeInterface |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | */ |
| 56 | 56 | public function read(JsonReadable $reader): ?DateTimeInterface |
| 57 | 57 | { |
| 58 | - if ($reader->peek() === JsonToken::NULL) { |
|
| 58 | + if ($reader->peek() === JsonToken::null) { |
|
| 59 | 59 | $reader->nextNull(); |
| 60 | 60 | return null; |
| 61 | 61 | } |
@@ -376,7 +376,7 @@ |
||
| 376 | 376 | */ |
| 377 | 377 | public function setCacheDir(string $cacheDir): GsonBuilder |
| 378 | 378 | { |
| 379 | - $this->cacheDir = $cacheDir.'/gson'; |
|
| 379 | + $this->cacheDir = $cacheDir . '/gson'; |
|
| 380 | 380 | |
| 381 | 381 | return $this; |
| 382 | 382 | } |
@@ -78,6 +78,6 @@ |
||
| 78 | 78 | */ |
| 79 | 79 | private function prependUpperCaseWith(string $string, string $replacement): string |
| 80 | 80 | { |
| 81 | - return \preg_replace('/(?<!^)([A-Z])/', $replacement.'\\1', $string); |
|
| 81 | + return \preg_replace('/(?<!^)([A-Z])/', $replacement . '\\1', $string); |
|
| 82 | 82 | } |
| 83 | 83 | } |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | /** |
| 39 | 39 | * Update internal stack and stack types, appending values |
| 40 | 40 | * |
| 41 | - * @param mixed $jsonElement |
|
| 41 | + * @param JsonElement $jsonElement |
|
| 42 | 42 | */ |
| 43 | 43 | private function updateStack(JsonElement $jsonElement): void |
| 44 | 44 | { |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | $this->stackTypes[$this->stackSize++] = JsonToken::BOOLEAN; |
| 64 | 64 | } else { |
| 65 | 65 | $this->stack[$this->stackSize] = null; |
| 66 | - $this->stackTypes[$this->stackSize++] = JsonToken::NULL; |
|
| 66 | + $this->stackTypes[$this->stackSize++] = JsonToken::null; |
|
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | |
@@ -168,9 +168,9 @@ discard block |
||
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | // for setters, we look for the param name as well |
| 171 | - $pattern = '/@'.$annotation.'\s+([a-zA-Z0-9|\[\]\\\\]+)'; |
|
| 171 | + $pattern = '/@' . $annotation . '\s+([a-zA-Z0-9|\[\]\\\\]+)'; |
|
| 172 | 172 | if ($parameter !== null) { |
| 173 | - $pattern .= '\s+\$'.$parameter; |
|
| 173 | + $pattern .= '\s+\$' . $parameter; |
|
| 174 | 174 | } |
| 175 | 175 | $pattern .= '/'; |
| 176 | 176 | |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | // return the non-null type |
| 201 | - foreach(\explode('|', $type) as $potentialType) { |
|
| 201 | + foreach (\explode('|', $type) as $potentialType) { |
|
| 202 | 202 | $potentialType = \trim($potentialType); |
| 203 | 203 | if (\strtolower($potentialType) !== 'null') { |
| 204 | 204 | return $potentialType; |
@@ -278,15 +278,15 @@ discard block |
||
| 278 | 278 | |
| 279 | 279 | // group use statement |
| 280 | 280 | if (!empty($matches['group'])) { |
| 281 | - return TypeToken::create($matches['group'].$type); |
|
| 281 | + return TypeToken::create($matches['group'] . $type); |
|
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | // grouped aliased use statement |
| 285 | 285 | if (!empty($matches['namespace']) && !empty($matches['classname'])) { |
| 286 | - return TypeToken::create($matches['namespace'].$matches['classname']); |
|
| 286 | + return TypeToken::create($matches['namespace'] . $matches['classname']); |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | - return TypeToken::create($namespace.'\\'.$type); |
|
| 289 | + return TypeToken::create($namespace . '\\' . $type); |
|
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | /** |
@@ -57,8 +57,7 @@ |
||
| 57 | 57 | ?TypeToken $keyType, |
| 58 | 58 | ?TypeAdapter $valueTypeAdapter, |
| 59 | 59 | int $numberOfGenerics |
| 60 | - ) |
|
| 61 | - { |
|
| 60 | + ) { |
|
| 62 | 61 | $this->typeAdapterProvider = $typeAdapterProvider; |
| 63 | 62 | $this->keyType = $keyType; |
| 64 | 63 | $this->valueTypeAdapter = $valueTypeAdapter; |
@@ -76,7 +76,7 @@ |
||
| 76 | 76 | public function read(JsonReadable $reader): ?array |
| 77 | 77 | { |
| 78 | 78 | $token = $reader->peek(); |
| 79 | - if ($token === JsonToken::NULL) { |
|
| 79 | + if ($token === JsonToken::null) { |
|
| 80 | 80 | $reader->nextNull(); |
| 81 | 81 | return null; |
| 82 | 82 | } |
@@ -142,7 +142,7 @@ |
||
| 142 | 142 | return null; |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - if ($reader->peek() === JsonToken::NULL) { |
|
| 145 | + if ($reader->peek() === JsonToken::null) { |
|
| 146 | 146 | $reader->nextNull(); |
| 147 | 147 | return null; |
| 148 | 148 | } |
@@ -64,8 +64,8 @@ |
||
| 64 | 64 | case JsonToken::NUMBER: |
| 65 | 65 | $type = TypeToken::create(TypeToken::FLOAT); |
| 66 | 66 | break; |
| 67 | - case JsonToken::NULL: |
|
| 68 | - $type = TypeToken::create(TypeToken::NULL); |
|
| 67 | + case JsonToken::null: |
|
| 68 | + $type = TypeToken::create(TypeToken::null); |
|
| 69 | 69 | break; |
| 70 | 70 | default: |
| 71 | 71 | throw new JsonSyntaxException( |
@@ -116,7 +116,7 @@ |
||
| 116 | 116 | public function create(TypeToken $phpType, ClassMetadata $classMetadata): PropertyCollection |
| 117 | 117 | { |
| 118 | 118 | $class = $phpType->getRawType(); |
| 119 | - $key = 'gson.properties.'.\str_replace('\\', '', $class); |
|
| 119 | + $key = 'gson.properties.' . \str_replace('\\', '', $class); |
|
| 120 | 120 | |
| 121 | 121 | $data = $this->cache->get($key); |
| 122 | 122 | if ($data !== null) { |