@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | * @param JsonReadable $reader |
| 25 | 25 | * @return mixed |
| 26 | 26 | */ |
| 27 | - public function read(JsonReadable $reader): ?bool |
|
| 27 | + public function read(JsonReadable $reader): ? bool |
|
| 28 | 28 | { |
| 29 | 29 | if ($reader->peek() === JsonToken::NULL) { |
| 30 | 30 | return $reader->nextNull(); |
@@ -48,6 +48,6 @@ discard block |
||
| 48 | 48 | return; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - $writer->writeBoolean((bool)$value); |
|
| 51 | + $writer->writeBoolean((bool) $value); |
|
| 52 | 52 | } |
| 53 | 53 | } |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | * @param JsonReadable $reader |
| 25 | 25 | * @return mixed |
| 26 | 26 | */ |
| 27 | - public function read(JsonReadable $reader): ?string |
|
| 27 | + public function read(JsonReadable $reader): ? string |
|
| 28 | 28 | { |
| 29 | 29 | if ($reader->peek() === JsonToken::NULL) { |
| 30 | 30 | return $reader->nextNull(); |
@@ -48,6 +48,6 @@ discard block |
||
| 48 | 48 | return; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - $writer->writeString((string)$value); |
|
| 51 | + $writer->writeString((string) $value); |
|
| 52 | 52 | } |
| 53 | 53 | } |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | * @param JsonReadable $reader |
| 25 | 25 | * @return float|null |
| 26 | 26 | */ |
| 27 | - public function read(JsonReadable $reader): ?float |
|
| 27 | + public function read(JsonReadable $reader): ? float |
|
| 28 | 28 | { |
| 29 | 29 | if ($reader->peek() === JsonToken::NULL) { |
| 30 | 30 | return $reader->nextNull(); |
@@ -48,6 +48,6 @@ discard block |
||
| 48 | 48 | return; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - $writer->writeFloat((float)$value); |
|
| 51 | + $writer->writeFloat((float) $value); |
|
| 52 | 52 | } |
| 53 | 53 | } |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | { |
| 162 | 162 | $this->expect(JsonToken::BOOLEAN); |
| 163 | 163 | |
| 164 | - $result = (bool)$this->pop(); |
|
| 164 | + $result = (bool) $this->pop(); |
|
| 165 | 165 | |
| 166 | 166 | $this->incrementPathIndex(); |
| 167 | 167 | |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | { |
| 179 | 179 | $this->expect(JsonToken::NUMBER); |
| 180 | 180 | |
| 181 | - $result = (float)$this->pop(); |
|
| 181 | + $result = (float) $this->pop(); |
|
| 182 | 182 | |
| 183 | 183 | $this->incrementPathIndex(); |
| 184 | 184 | |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | { |
| 196 | 196 | $this->expect(JsonToken::NUMBER); |
| 197 | 197 | |
| 198 | - $result = (int)$this->pop(); |
|
| 198 | + $result = (int) $this->pop(); |
|
| 199 | 199 | |
| 200 | 200 | $this->incrementPathIndex(); |
| 201 | 201 | |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | |
| 218 | 218 | $this->expect(JsonToken::STRING); |
| 219 | 219 | |
| 220 | - $result = (string)$this->pop(); |
|
| 220 | + $result = (string) $this->pop(); |
|
| 221 | 221 | |
| 222 | 222 | $this->incrementPathIndex(); |
| 223 | 223 | |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | |
| 262 | 262 | $this->push($value); |
| 263 | 263 | |
| 264 | - return (string)$key; |
|
| 264 | + return (string) $key; |
|
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | /** |
@@ -350,11 +350,11 @@ discard block |
||
| 350 | 350 | $result = '$'; |
| 351 | 351 | foreach ($this->stack as $index => $item) { |
| 352 | 352 | if ($item instanceof ArrayIterator && isset($this->pathIndices[$index])) { |
| 353 | - $result .= '['.$this->pathIndices[$index].']'; |
|
| 353 | + $result .= '[' . $this->pathIndices[$index] . ']'; |
|
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | if ($item instanceof StdClassIterator && isset($this->pathNames[$index])) { |
| 357 | - $result .= '.'.$this->pathNames[$index]; |
|
| 357 | + $result .= '.' . $this->pathNames[$index]; |
|
| 358 | 358 | } |
| 359 | 359 | } |
| 360 | 360 | |
@@ -354,11 +354,11 @@ |
||
| 354 | 354 | $result = '$'; |
| 355 | 355 | foreach ($this->stack as $index => $item) { |
| 356 | 356 | if ($item instanceof ArrayIterator && isset($this->pathIndices[$index])) { |
| 357 | - $result .= '['.$this->pathIndices[$index].']'; |
|
| 357 | + $result .= '[' . $this->pathIndices[$index] . ']'; |
|
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | if ($item instanceof JsonObjectIterator && isset($this->pathNames[$index])) { |
| 361 | - $result .= '.'.$this->pathNames[$index]; |
|
| 361 | + $result .= '.' . $this->pathNames[$index]; |
|
| 362 | 362 | } |
| 363 | 363 | } |
| 364 | 364 | |
@@ -121,7 +121,7 @@ |
||
| 121 | 121 | public function create(TypeToken $phpType): PropertyCollection |
| 122 | 122 | { |
| 123 | 123 | $class = $phpType->getRawType(); |
| 124 | - $key = 'properties:'.$class; |
|
| 124 | + $key = 'properties:' . $class; |
|
| 125 | 125 | |
| 126 | 126 | $data = $this->cache->fetch($key); |
| 127 | 127 | if (false !== $data) { |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | public function createPropertyAnnotations(string $className, string $propertyName): AnnotationSet |
| 56 | 56 | { |
| 57 | - $key = 'annotations:'.$className.':'.$propertyName; |
|
| 57 | + $key = 'annotations:' . $className . ':' . $propertyName; |
|
| 58 | 58 | if ($this->cache->contains($key)) { |
| 59 | 59 | return $this->cache->fetch($key); |
| 60 | 60 | } |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | */ |
| 135 | 135 | public function createMethodAnnotations(string $className, string $methodName): AnnotationSet |
| 136 | 136 | { |
| 137 | - $key = $className.':'.$methodName; |
|
| 137 | + $key = $className . ':' . $methodName; |
|
| 138 | 138 | if ($this->cache->contains($key)) { |
| 139 | 139 | return $this->cache->fetch($key); |
| 140 | 140 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | * @throws \Tebru\Gson\Exception\UnexpectedJsonTokenException If trying to read from non object/array |
| 55 | 55 | * @throws \Tebru\PhpType\Exception\MalformedTypeException If the type cannot be parsed |
| 56 | 56 | */ |
| 57 | - public function read(JsonReadable $reader): ?array |
|
| 57 | + public function read(JsonReadable $reader): ? array |
|
| 58 | 58 | { |
| 59 | 59 | if ($reader->peek() === JsonToken::NULL) { |
| 60 | 60 | return $reader->nextNull(); |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | throw new UnexpectedJsonTokenException(sprintf('Expected integer, but found string for key at "%s"', $reader->getPath())); |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - $name = (int)$name; |
|
| 112 | + $name = (int) $name; |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | $valueAdapter = $this->typeAdapterProvider->getAdapter($generics[1]); |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | // no generics specified |
| 189 | 189 | case 0: |
| 190 | 190 | if ($arrayIsObject) { |
| 191 | - $writer->name((string)$key); |
|
| 191 | + $writer->name((string) $key); |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | $adapter = $this->typeAdapterProvider->getAdapter(TypeToken::createFromVariable($item)); |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | // generic for value specified |
| 199 | 199 | case 1: |
| 200 | 200 | if ($arrayIsObject) { |
| 201 | - $writer->name((string)$key); |
|
| 201 | + $writer->name((string) $key); |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | $adapter = $this->typeAdapterProvider->getAdapter($generics[0]); |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | public function getAdapter(TypeToken $type, TypeAdapterFactory $skip = null): TypeAdapter |
| 67 | 67 | { |
| 68 | - $key = (string)$type; |
|
| 68 | + $key = (string) $type; |
|
| 69 | 69 | if (null === $skip && isset($this->typeAdapters[$key])) { |
| 70 | 70 | return $this->typeAdapters[$key]; |
| 71 | 71 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | throw new InvalidArgumentException(sprintf( |
| 93 | 93 | 'The type "%s" could not be handled by any of the registered type adapters', |
| 94 | - (string)$type |
|
| 94 | + (string) $type |
|
| 95 | 95 | )); |
| 96 | 96 | } |
| 97 | 97 | |