@@ -86,12 +86,12 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public function visitArray($data, array $type): array |
88 | 88 | { |
89 | - if (!\is_array($data)) { |
|
89 | + if ( ! \is_array($data)) { |
|
90 | 90 | throw new RuntimeException(sprintf('Expected array, but got %s: %s', \gettype($data), json_encode($data))); |
91 | 91 | } |
92 | 92 | |
93 | 93 | // If no further parameters were given, keys/values are just passed as is. |
94 | - if (!$type['params']) { |
|
94 | + if ( ! $type['params']) { |
|
95 | 95 | return $data; |
96 | 96 | } |
97 | 97 | |
@@ -158,22 +158,22 @@ discard block |
||
158 | 158 | return; |
159 | 159 | } |
160 | 160 | |
161 | - if (!\is_array($data)) { |
|
161 | + if ( ! \is_array($data)) { |
|
162 | 162 | throw new RuntimeException(sprintf('Invalid data %s (%s), expected "%s".', json_encode($data), $metadata->type['name'], $metadata->class)); |
163 | 163 | } |
164 | 164 | |
165 | 165 | if (true === $metadata->inline) { |
166 | - if (!$metadata->type) { |
|
166 | + if ( ! $metadata->type) { |
|
167 | 167 | throw RuntimeException::noMetadataForProperty($metadata->class, $metadata->name); |
168 | 168 | } |
169 | 169 | return $this->navigator->accept($data, $metadata->type); |
170 | 170 | } |
171 | 171 | |
172 | - if (!array_key_exists($name, $data)) { |
|
172 | + if ( ! array_key_exists($name, $data)) { |
|
173 | 173 | throw new NotAcceptableException(); |
174 | 174 | } |
175 | 175 | |
176 | - if (!$metadata->type) { |
|
176 | + if ( ! $metadata->type) { |
|
177 | 177 | throw RuntimeException::noMetadataForProperty($metadata->class, $metadata->name); |
178 | 178 | } |
179 | 179 |
@@ -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 |
@@ -159,12 +159,12 @@ discard block |
||
159 | 159 | */ |
160 | 160 | public function setAccessorOrder(string $order, array $customOrder = []): void |
161 | 161 | { |
162 | - if (!in_array($order, [self::ACCESSOR_ORDER_UNDEFINED, self::ACCESSOR_ORDER_ALPHABETICAL, self::ACCESSOR_ORDER_CUSTOM], true)) { |
|
162 | + if ( ! in_array($order, [self::ACCESSOR_ORDER_UNDEFINED, self::ACCESSOR_ORDER_ALPHABETICAL, self::ACCESSOR_ORDER_CUSTOM], true)) { |
|
163 | 163 | throw new InvalidMetadataException(sprintf('The accessor order "%s" is invalid.', $order)); |
164 | 164 | } |
165 | 165 | |
166 | 166 | foreach ($customOrder as $name) { |
167 | - if (!\is_string($name)) { |
|
167 | + if ( ! \is_string($name)) { |
|
168 | 168 | throw new InvalidMetadataException(sprintf('$customOrder is expected to be a list of strings, but got element of value %s.', json_encode($name))); |
169 | 169 | } |
170 | 170 | } |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | |
201 | 201 | public function merge(MergeableInterface $object): void |
202 | 202 | { |
203 | - if (!$object instanceof ClassMetadata) { |
|
203 | + if ( ! $object instanceof ClassMetadata) { |
|
204 | 204 | throw new InvalidMetadataException('$object must be an instance of ClassMetadata.'); |
205 | 205 | } |
206 | 206 | parent::merge($object); |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | $this->discriminatorBaseClass, |
225 | 225 | $this->discriminatorBaseClass |
226 | 226 | )); |
227 | - } elseif (!$this->discriminatorFieldName && $object->discriminatorFieldName) { |
|
227 | + } elseif ( ! $this->discriminatorFieldName && $object->discriminatorFieldName) { |
|
228 | 228 | $this->discriminatorFieldName = $object->discriminatorFieldName; |
229 | 229 | $this->discriminatorMap = $object->discriminatorMap; |
230 | 230 | } |
@@ -246,12 +246,12 @@ discard block |
||
246 | 246 | |
247 | 247 | public function registerNamespace(string $uri, ?string $prefix = null): void |
248 | 248 | { |
249 | - if (!\is_string($uri)) { |
|
249 | + if ( ! \is_string($uri)) { |
|
250 | 250 | throw new InvalidMetadataException(sprintf('$uri is expected to be a strings, but got value %s.', json_encode($uri))); |
251 | 251 | } |
252 | 252 | |
253 | 253 | if (null !== $prefix) { |
254 | - if (!\is_string($prefix)) { |
|
254 | + if ( ! \is_string($prefix)) { |
|
255 | 255 | throw new InvalidMetadataException(sprintf('$prefix is expected to be a strings, but got value %s.', json_encode($prefix))); |
256 | 256 | } |
257 | 257 | } else { |
@@ -367,8 +367,8 @@ discard block |
||
367 | 367 | private function handleDiscriminatorProperty(): void |
368 | 368 | { |
369 | 369 | if ($this->discriminatorMap |
370 | - && !$this->getReflection()->isAbstract() |
|
371 | - && !$this->getReflection()->isInterface() |
|
370 | + && ! $this->getReflection()->isAbstract() |
|
371 | + && ! $this->getReflection()->isInterface() |
|
372 | 372 | ) { |
373 | 373 | if (false === $typeValue = array_search($this->name, $this->discriminatorMap, true)) { |
374 | 374 | throw new InvalidMetadataException(sprintf( |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | $this->discriminatorValue = $typeValue; |
382 | 382 | |
383 | 383 | if (isset($this->propertyMetadata[$this->discriminatorFieldName]) |
384 | - && !$this->propertyMetadata[$this->discriminatorFieldName] instanceof StaticPropertyMetadata |
|
384 | + && ! $this->propertyMetadata[$this->discriminatorFieldName] instanceof StaticPropertyMetadata |
|
385 | 385 | ) { |
386 | 386 | throw new InvalidMetadataException(sprintf( |
387 | 387 | 'The discriminator field name "%s" of the base-class "%s" conflicts with a regular property of the sub-class "%s".', |
@@ -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 |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | public function loadMetadataForClass(\ReflectionClass $class): ?BaseClassMetadata |
78 | 78 | { |
79 | 79 | $classMetadata = new ClassMetadata($name = $class->name); |
80 | - $fileResource = $class->getFilename(); |
|
80 | + $fileResource = $class->getFilename(); |
|
81 | 81 | if (false !== $fileResource) { |
82 | 82 | $classMetadata->fileResources[] = $fileResource; |
83 | 83 | } |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | } |
154 | 154 | } |
155 | 155 | |
156 | - if (!$excludeAll) { |
|
156 | + if ( ! $excludeAll) { |
|
157 | 157 | foreach ($class->getProperties() as $property) { |
158 | 158 | if ($property->class !== $name || (isset($property->info) && $property->info['class'] !== $name)) { |
159 | 159 | continue; |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | } elseif ($annot instanceof Expose) { |
185 | 185 | $isExpose = true; |
186 | 186 | if (null !== $annot->if) { |
187 | - $propertyMetadata->excludeIf = $this->parseExpression('!(' . $annot->if . ')'); |
|
187 | + $propertyMetadata->excludeIf = $this->parseExpression('!('.$annot->if.')'); |
|
188 | 188 | } |
189 | 189 | } elseif ($annot instanceof Exclude) { |
190 | 190 | if (null !== $annot->if) { |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | throw new InvalidMetadataException(sprintf( |
234 | 234 | 'Invalid group name "%s" on "%s", did you mean to create multiple groups?', |
235 | 235 | implode(', ', $propertyMetadata->groups), |
236 | - $propertyMetadata->class . '->' . $propertyMetadata->name |
|
236 | + $propertyMetadata->class.'->'.$propertyMetadata->name |
|
237 | 237 | )); |
238 | 238 | } |
239 | 239 | } |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | } |
256 | 256 | } |
257 | 257 | |
258 | - if (!$propertyMetadata->serializedName) { |
|
258 | + if ( ! $propertyMetadata->serializedName) { |
|
259 | 259 | $propertyMetadata->serializedName = $this->namingStrategy->translateName($propertyMetadata); |
260 | 260 | } |
261 | 261 | |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | } |
266 | 266 | } |
267 | 267 | |
268 | - if ((ExclusionPolicy::NONE === $exclusionPolicy && !$isExclude) |
|
268 | + if ((ExclusionPolicy::NONE === $exclusionPolicy && ! $isExclude) |
|
269 | 269 | || (ExclusionPolicy::ALL === $exclusionPolicy && $isExpose) |
270 | 270 | ) { |
271 | 271 | $propertyMetadata->setAccessor($accessType, $accessor[0], $accessor[1]); |
@@ -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 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | $classMetadata = $this->delegate->loadMetadataForClass($class); |
84 | 84 | |
85 | 85 | // Abort if the given class is not a mapped entity |
86 | - if (!$doctrineMetadata = $this->tryLoadingDoctrineMetadata($class->name)) { |
|
86 | + if ( ! $doctrineMetadata = $this->tryLoadingDoctrineMetadata($class->name)) { |
|
87 | 87 | return $classMetadata; |
88 | 88 | } |
89 | 89 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | |
132 | 132 | protected function tryLoadingDoctrineMetadata(string $className): ?DoctrineClassMetadata |
133 | 133 | { |
134 | - if (!$manager = $this->registry->getManagerForClass($className)) { |
|
134 | + if ( ! $manager = $this->registry->getManagerForClass($className)) { |
|
135 | 135 | return null; |
136 | 136 | } |
137 | 137 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | |
145 | 145 | protected function normalizeFieldType(string $type): ?string |
146 | 146 | { |
147 | - if (!isset($this->fieldMapping[$type])) { |
|
147 | + if ( ! isset($this->fieldMapping[$type])) { |
|
148 | 148 | return null; |
149 | 149 | } |
150 | 150 |