@@ -153,7 +153,7 @@ |
||
| 153 | 153 | array $type, |
| 154 | 154 | DeserializationContext $context |
| 155 | 155 | ): Generator { |
| 156 | - return (static function () use (&$visitor, &$data, &$type): Generator { |
|
| 156 | + return (static function() use (&$visitor, &$data, &$type): Generator { |
|
| 157 | 157 | $type['name'] = 'array'; |
| 158 | 158 | yield from $visitor->visitArray($data, $type); |
| 159 | 159 | })(); |
@@ -23,10 +23,10 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | switch ($direction) { |
| 25 | 25 | case GraphNavigatorInterface::DIRECTION_DESERIALIZATION: |
| 26 | - return 'deserialize' . $type . 'From' . $format; |
|
| 26 | + return 'deserialize'.$type.'From'.$format; |
|
| 27 | 27 | |
| 28 | 28 | case GraphNavigatorInterface::DIRECTION_SERIALIZATION: |
| 29 | - return 'serialize' . $type . 'To' . $format; |
|
| 29 | + return 'serialize'.$type.'To'.$format; |
|
| 30 | 30 | |
| 31 | 31 | default: |
| 32 | 32 | throw new LogicException(sprintf('The direction %s does not exist; see GraphNavigatorInterface::DIRECTION_??? constants.', json_encode($direction))); |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | public function registerSubscribingHandler(SubscribingHandlerInterface $handler): void |
| 42 | 42 | { |
| 43 | 43 | foreach ($handler->getSubscribingMethods() as $methodData) { |
| 44 | - if (!isset($methodData['type'], $methodData['format'])) { |
|
| 44 | + if ( ! isset($methodData['type'], $methodData['format'])) { |
|
| 45 | 45 | throw new RuntimeException(sprintf('For each subscribing method a "type" and "format" attribute must be given, but only got "%s" for %s.', implode('" and "', array_keys($methodData)), \get_class($handler))); |
| 46 | 46 | } |
| 47 | 47 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | public function getHandler(int $direction, string $typeName, string $format) |
| 72 | 72 | { |
| 73 | - if (!isset($this->handlers[$direction][$typeName][$format])) { |
|
| 73 | + if ( ! isset($this->handlers[$direction][$typeName][$format])) { |
|
| 74 | 74 | return null; |
| 75 | 75 | } |
| 76 | 76 | |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | public function __construct($container, array $handlers = []) |
| 28 | 28 | { |
| 29 | - if (!$container instanceof PsrContainerInterface && !$container instanceof ContainerInterface) { |
|
| 29 | + if ( ! $container instanceof PsrContainerInterface && ! $container instanceof ContainerInterface) { |
|
| 30 | 30 | throw new InvalidArgumentException(sprintf('The container must be an instance of %s or %s (%s given).', PsrContainerInterface::class, ContainerInterface::class, \is_object($container) ? \get_class($container) : \gettype($container))); |
| 31 | 31 | } |
| 32 | 32 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | return $this->initializedHandlers[$direction][$typeName][$format]; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - if (!isset($this->handlers[$direction][$typeName][$format])) { |
|
| 55 | + if ( ! isset($this->handlers[$direction][$typeName][$format])) { |
|
| 56 | 56 | return null; |
| 57 | 57 | } |
| 58 | 58 | |
@@ -157,22 +157,22 @@ discard block |
||
| 157 | 157 | $class = $this->getReflection()->getDeclaringClass(); |
| 158 | 158 | |
| 159 | 159 | if (empty($getter)) { |
| 160 | - if ($class->hasMethod('get' . $this->name) && $class->getMethod('get' . $this->name)->isPublic()) { |
|
| 161 | - $getter = 'get' . $this->name; |
|
| 162 | - } elseif ($class->hasMethod('is' . $this->name) && $class->getMethod('is' . $this->name)->isPublic()) { |
|
| 163 | - $getter = 'is' . $this->name; |
|
| 164 | - } elseif ($class->hasMethod('has' . $this->name) && $class->getMethod('has' . $this->name)->isPublic()) { |
|
| 165 | - $getter = 'has' . $this->name; |
|
| 160 | + if ($class->hasMethod('get'.$this->name) && $class->getMethod('get'.$this->name)->isPublic()) { |
|
| 161 | + $getter = 'get'.$this->name; |
|
| 162 | + } elseif ($class->hasMethod('is'.$this->name) && $class->getMethod('is'.$this->name)->isPublic()) { |
|
| 163 | + $getter = 'is'.$this->name; |
|
| 164 | + } elseif ($class->hasMethod('has'.$this->name) && $class->getMethod('has'.$this->name)->isPublic()) { |
|
| 165 | + $getter = 'has'.$this->name; |
|
| 166 | 166 | } else { |
| 167 | - throw new InvalidMetadataException(sprintf('There is neither a public %s method, nor a public %s method, nor a public %s method in class %s. Please specify which public method should be used for retrieving the value of the property %s.', 'get' . ucfirst($this->name), 'is' . ucfirst($this->name), 'has' . ucfirst($this->name), $this->class, $this->name)); |
|
| 167 | + throw new InvalidMetadataException(sprintf('There is neither a public %s method, nor a public %s method, nor a public %s method in class %s. Please specify which public method should be used for retrieving the value of the property %s.', 'get'.ucfirst($this->name), 'is'.ucfirst($this->name), 'has'.ucfirst($this->name), $this->class, $this->name)); |
|
| 168 | 168 | } |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | - if (empty($setter) && !$this->readOnly) { |
|
| 172 | - if ($class->hasMethod('set' . $this->name) && $class->getMethod('set' . $this->name)->isPublic()) { |
|
| 173 | - $setter = 'set' . $this->name; |
|
| 171 | + if (empty($setter) && ! $this->readOnly) { |
|
| 172 | + if ($class->hasMethod('set'.$this->name) && $class->getMethod('set'.$this->name)->isPublic()) { |
|
| 173 | + $setter = 'set'.$this->name; |
|
| 174 | 174 | } else { |
| 175 | - throw new InvalidMetadataException(sprintf('There is no public %s method in class %s. Please specify which public method should be used for setting the value of the property %s.', 'set' . ucfirst($this->name), $this->class, $this->name)); |
|
| 175 | + throw new InvalidMetadataException(sprintf('There is no public %s method in class %s. Please specify which public method should be used for setting the value of the property %s.', 'set'.ucfirst($this->name), $this->class, $this->name)); |
|
| 176 | 176 | } |
| 177 | 177 | } |
| 178 | 178 | } |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | return is_array($type) |
| 192 | 192 | && 'array' === $type['name'] |
| 193 | 193 | && isset($type['params'][0]) |
| 194 | - && !isset($type['params'][1]); |
|
| 194 | + && ! isset($type['params'][1]); |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | public static function isCollectionMap(?array $type = null): bool |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | public function loadMetadataForClass(\ReflectionClass $class): ?BaseClassMetadata |
| 14 | 14 | { |
| 15 | 15 | $classMetadata = new ClassMetadata($name = $class->name); |
| 16 | - $fileResource = $class->getFilename(); |
|
| 16 | + $fileResource = $class->getFilename(); |
|
| 17 | 17 | if (false !== $fileResource) { |
| 18 | 18 | $classMetadata->fileResources[] = $fileResource; |
| 19 | 19 | } |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | $value = $values['policy']; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - if (!\is_string($value)) { |
|
| 35 | + if ( ! \is_string($value)) { |
|
| 36 | 36 | throw new RuntimeException('Exclusion policy value must be of string type.'); |
| 37 | 37 | } |
| 38 | 38 | |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | |
| 115 | 115 | private function getNavigator(int $direction): GraphNavigatorInterface |
| 116 | 116 | { |
| 117 | - if (!isset($this->graphNavigators[$direction])) { |
|
| 117 | + if ( ! isset($this->graphNavigators[$direction])) { |
|
| 118 | 118 | throw new RuntimeException( |
| 119 | 119 | sprintf( |
| 120 | 120 | 'Can not find a graph navigator for the direction "%s".', |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | ? $this->serializationVisitors |
| 133 | 133 | : $this->deserializationVisitors; |
| 134 | 134 | |
| 135 | - if (!isset($factories[$format])) { |
|
| 135 | + if ( ! isset($factories[$format])) { |
|
| 136 | 136 | throw new UnsupportedFormatException( |
| 137 | 137 | sprintf( |
| 138 | 138 | 'The format "%s" is not supported for %s.', |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | $result = $this->visit($navigator, $visitor, $context, $data, 'json', $type); |
| 197 | 197 | $result = $this->convertArrayObjects($result); |
| 198 | 198 | |
| 199 | - if (!\is_array($result)) { |
|
| 199 | + if ( ! \is_array($result)) { |
|
| 200 | 200 | throw new RuntimeException(sprintf( |
| 201 | 201 | 'The input data of type "%s" did not convert to an array, but got a result of type "%s".', |
| 202 | 202 | \is_object($data) ? \get_class($data) : \gettype($data), |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | $this->addExclusionStrategy(new VersionExclusionStrategy($this->attributes['version'])); |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - if (!empty($this->attributes['max_depth_checks'])) { |
|
| 82 | + if ( ! empty($this->attributes['max_depth_checks'])) { |
|
| 83 | 83 | $this->addExclusionStrategy(new DepthExclusionStrategy()); |
| 84 | 84 | } |
| 85 | 85 | |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | |
| 133 | 133 | final protected function assertMutable(): void |
| 134 | 134 | { |
| 135 | - if (!$this->initialized) { |
|
| 135 | + if ( ! $this->initialized) { |
|
| 136 | 136 | return; |
| 137 | 137 | } |
| 138 | 138 | |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | { |
| 209 | 209 | $metadata = $this->metadataStack->pop(); |
| 210 | 210 | |
| 211 | - if (!$metadata instanceof PropertyMetadata) { |
|
| 211 | + if ( ! $metadata instanceof PropertyMetadata) { |
|
| 212 | 212 | throw new RuntimeException('Context metadataStack not working well'); |
| 213 | 213 | } |
| 214 | 214 | } |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | { |
| 218 | 218 | $metadata = $this->metadataStack->pop(); |
| 219 | 219 | |
| 220 | - if (!$metadata instanceof ClassMetadata) { |
|
| 220 | + if ( ! $metadata instanceof ClassMetadata) { |
|
| 221 | 221 | throw new RuntimeException('Context metadataStack not working well'); |
| 222 | 222 | } |
| 223 | 223 | } |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | */ |
| 233 | 233 | public function getCurrentPath(): array |
| 234 | 234 | { |
| 235 | - if (!$this->metadataStack) { |
|
| 235 | + if ( ! $this->metadataStack) { |
|
| 236 | 236 | return []; |
| 237 | 237 | } |
| 238 | 238 | |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | |
| 44 | 44 | public function createDriver(array $metadataDirs, Reader $annotationReader): DriverInterface |
| 45 | 45 | { |
| 46 | - if (!empty($metadataDirs)) { |
|
| 46 | + if ( ! empty($metadataDirs)) { |
|
| 47 | 47 | $fileLocator = new FileLocator($metadataDirs); |
| 48 | 48 | |
| 49 | 49 | $driver = new DriverChain([ |