@@ -28,7 +28,7 @@ |
||
| 28 | 28 | * Read the next value, convert it to its type and return it |
| 29 | 29 | * |
| 30 | 30 | * @param JsonReadable $reader |
| 31 | - * @return mixed |
|
| 31 | + * @return JsonElement |
|
| 32 | 32 | * @throws \LogicException |
| 33 | 33 | */ |
| 34 | 34 | public function read(JsonReadable $reader): JsonElement |
@@ -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 | |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | */ |
| 332 | 332 | public function setCacheDir(string $cacheDir): GsonBuilder |
| 333 | 333 | { |
| 334 | - $this->cacheDir = $cacheDir.'/gson'; |
|
| 334 | + $this->cacheDir = $cacheDir . '/gson'; |
|
| 335 | 335 | |
| 336 | 336 | return $this; |
| 337 | 337 | } |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | $propertyNamingStrategy = $this->propertyNamingStrategy ?? new SnakePropertyNamingStrategy(); |
| 353 | 353 | $methodNamingStrategy = $this->methodNamingStrategy ?? new UpperCaseMethodNamingStrategy(); |
| 354 | 354 | |
| 355 | - $doctrineAnnotationCache = false === $this->enableCache ? new ArrayCache(): new ChainCache([new ArrayCache(), new FilesystemCache($this->cacheDir)]); |
|
| 355 | + $doctrineAnnotationCache = false === $this->enableCache ? new ArrayCache() : new ChainCache([new ArrayCache(), new FilesystemCache($this->cacheDir)]); |
|
| 356 | 356 | $doctrineAnnotationCache->setNamespace('doctrine_annotation_cache'); |
| 357 | 357 | $reader = new CachedReader(new AnnotationReader(), $doctrineAnnotationCache); |
| 358 | 358 | |