@@ -172,12 +172,12 @@ discard block |
||
172 | 172 | */ |
173 | 173 | public function setAccessorOrder(string $order, array $customOrder = []): void |
174 | 174 | { |
175 | - if (!in_array($order, [self::ACCESSOR_ORDER_UNDEFINED, self::ACCESSOR_ORDER_ALPHABETICAL, self::ACCESSOR_ORDER_CUSTOM], true)) { |
|
175 | + if ( ! in_array($order, [self::ACCESSOR_ORDER_UNDEFINED, self::ACCESSOR_ORDER_ALPHABETICAL, self::ACCESSOR_ORDER_CUSTOM], true)) { |
|
176 | 176 | throw new InvalidMetadataException(sprintf('The accessor order "%s" is invalid.', $order)); |
177 | 177 | } |
178 | 178 | |
179 | 179 | foreach ($customOrder as $name) { |
180 | - if (!\is_string($name)) { |
|
180 | + if ( ! \is_string($name)) { |
|
181 | 181 | throw new InvalidMetadataException(sprintf('$customOrder is expected to be a list of strings, but got element of value %s.', json_encode($name))); |
182 | 182 | } |
183 | 183 | } |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | |
215 | 215 | public function merge(MergeableInterface $object): void |
216 | 216 | { |
217 | - if (!$object instanceof ClassMetadata) { |
|
217 | + if ( ! $object instanceof ClassMetadata) { |
|
218 | 218 | throw new InvalidMetadataException('$object must be an instance of ClassMetadata.'); |
219 | 219 | } |
220 | 220 | |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | $this->discriminatorBaseClass, |
248 | 248 | $this->discriminatorBaseClass, |
249 | 249 | )); |
250 | - } elseif (!$this->discriminatorFieldName && $object->discriminatorFieldName) { |
|
250 | + } elseif ( ! $this->discriminatorFieldName && $object->discriminatorFieldName) { |
|
251 | 251 | $this->discriminatorFieldName = $object->discriminatorFieldName; |
252 | 252 | $this->discriminatorMap = $object->discriminatorMap; |
253 | 253 | } |
@@ -278,12 +278,12 @@ discard block |
||
278 | 278 | |
279 | 279 | public function registerNamespace(string $uri, ?string $prefix = null): void |
280 | 280 | { |
281 | - if (!\is_string($uri)) { |
|
281 | + if ( ! \is_string($uri)) { |
|
282 | 282 | throw new InvalidMetadataException(sprintf('$uri is expected to be a strings, but got value %s.', json_encode($uri))); |
283 | 283 | } |
284 | 284 | |
285 | 285 | if (null !== $prefix) { |
286 | - if (!\is_string($prefix)) { |
|
286 | + if ( ! \is_string($prefix)) { |
|
287 | 287 | throw new InvalidMetadataException(sprintf('$prefix is expected to be a strings, but got value %s.', json_encode($prefix))); |
288 | 288 | } |
289 | 289 | } else { |
@@ -363,11 +363,11 @@ discard block |
||
363 | 363 | { |
364 | 364 | if ( |
365 | 365 | $this->discriminatorMap |
366 | - && !$this->getReflection()->isAbstract() |
|
367 | - && !$this->getReflection()->isInterface() |
|
366 | + && ! $this->getReflection()->isAbstract() |
|
367 | + && ! $this->getReflection()->isInterface() |
|
368 | 368 | ) { |
369 | 369 | if (false === $typeValue = array_search($this->name, $this->discriminatorMap, true)) { |
370 | - if (! empty($this->discriminatorDefaultClass)) { |
|
370 | + if ( ! empty($this->discriminatorDefaultClass)) { |
|
371 | 371 | $typeValue = $this->discriminatorDefaultClass; |
372 | 372 | } else { |
373 | 373 | throw new InvalidMetadataException(sprintf( |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | |
383 | 383 | if ( |
384 | 384 | isset($this->propertyMetadata[$this->discriminatorFieldName]) |
385 | - && !$this->propertyMetadata[$this->discriminatorFieldName] instanceof StaticPropertyMetadata |
|
385 | + && ! $this->propertyMetadata[$this->discriminatorFieldName] instanceof StaticPropertyMetadata |
|
386 | 386 | ) { |
387 | 387 | throw new InvalidMetadataException(sprintf( |
388 | 388 | 'The discriminator field name "%s" of the base-class "%s" conflicts with a regular property of the sub-class "%s".', |
@@ -58,14 +58,14 @@ discard block |
||
58 | 58 | } |
59 | 59 | |
60 | 60 | $metadata = new ClassMetadata($name = $class->name); |
61 | - if (!$elems = $elem->xpath("./class[@name = '" . $name . "']")) { |
|
61 | + if ( ! $elems = $elem->xpath("./class[@name = '".$name."']")) { |
|
62 | 62 | throw new InvalidMetadataException(sprintf('Could not find class %s inside XML element.', $name)); |
63 | 63 | } |
64 | 64 | |
65 | 65 | $elem = reset($elems); |
66 | 66 | |
67 | 67 | $metadata->fileResources[] = $path; |
68 | - $fileResource = $class->getFilename(); |
|
68 | + $fileResource = $class->getFilename(); |
|
69 | 69 | if (false !== $fileResource) { |
70 | 70 | $metadata->fileResources[] = $fileResource; |
71 | 71 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | $discriminatorDefaultClass = (string) $elem->attributes()->{'discriminator-default-class'}; |
106 | 106 | $discriminatorMap = []; |
107 | 107 | foreach ($elem->xpath('./discriminator-class') as $entry) { |
108 | - if (!isset($entry->attributes()->value)) { |
|
108 | + if ( ! isset($entry->attributes()->value)) { |
|
109 | 109 | throw new InvalidMetadataException('Each discriminator-class element must have a "value" attribute.'); |
110 | 110 | } |
111 | 111 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | |
115 | 115 | if ('true' === (string) $elem->attributes()->{'discriminator-disabled'}) { |
116 | 116 | $metadata->discriminatorDisabled = true; |
117 | - } elseif (!empty($discriminatorFieldName) || !empty($discriminatorMap)) { |
|
117 | + } elseif ( ! empty($discriminatorFieldName) || ! empty($discriminatorMap)) { |
|
118 | 118 | $discriminatorGroups = []; |
119 | 119 | foreach ($elem->xpath('./discriminator-groups/group') as $entry) { |
120 | 120 | $discriminatorGroups[] = (string) $entry; |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | } |
130 | 130 | |
131 | 131 | foreach ($elem->xpath('./xml-namespace') as $xmlNamespace) { |
132 | - if (!isset($xmlNamespace->attributes()->uri)) { |
|
132 | + if ( ! isset($xmlNamespace->attributes()->uri)) { |
|
133 | 133 | throw new InvalidMetadataException('The prefix attribute must be set for all xml-namespace elements.'); |
134 | 134 | } |
135 | 135 | |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | $this->parseExpression((string) $method->attributes()->expression), |
165 | 165 | ); |
166 | 166 | } else { |
167 | - if (!isset($method->attributes()->method)) { |
|
167 | + if ( ! isset($method->attributes()->method)) { |
|
168 | 168 | throw new InvalidMetadataException('The method attribute must be set for all virtual-property elements.'); |
169 | 169 | } |
170 | 170 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | $propertiesNodes[] = $method; |
176 | 176 | } |
177 | 177 | |
178 | - if (!$excludeAll) { |
|
178 | + if ( ! $excludeAll) { |
|
179 | 179 | foreach ($class->getProperties() as $property) { |
180 | 180 | if ($property->class !== $name || (isset($property->info) && $property->info['class'] !== $name)) { |
181 | 181 | continue; |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | $pName = $property->getName(); |
185 | 185 | $propertiesMetadata[] = new PropertyMetadata($name, $pName); |
186 | 186 | |
187 | - $pElems = $elem->xpath("./property[@name = '" . $pName . "']"); |
|
187 | + $pElems = $elem->xpath("./property[@name = '".$pName."']"); |
|
188 | 188 | $propertiesNodes[] = $pElems ? reset($pElems) : null; |
189 | 189 | } |
190 | 190 | |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | || isset($propertiesNodes[$propertyKey]); |
196 | 196 | |
197 | 197 | $pElem = $propertiesNodes[$propertyKey]; |
198 | - if (!empty($pElem)) { |
|
198 | + if ( ! empty($pElem)) { |
|
199 | 199 | if (null !== $exclude = $pElem->attributes()->exclude) { |
200 | 200 | $isExclude = 'true' === strtolower((string) $exclude); |
201 | 201 | } |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | } |
218 | 218 | |
219 | 219 | if (null !== $excludeIf = $pElem->attributes()->{'expose-if'}) { |
220 | - $pMetadata->excludeIf = $this->parseExpression('!(' . (string) $excludeIf . ')'); |
|
220 | + $pMetadata->excludeIf = $this->parseExpression('!('.(string) $excludeIf.')'); |
|
221 | 221 | $isExpose = true; |
222 | 222 | } |
223 | 223 | |
@@ -359,16 +359,16 @@ discard block |
||
359 | 359 | $metadata->isMap = $metadata->isMap || PropertyMetadata::isCollectionMap($pMetadata->type); |
360 | 360 | } |
361 | 361 | |
362 | - if (!$pMetadata->serializedName) { |
|
362 | + if ( ! $pMetadata->serializedName) { |
|
363 | 363 | $pMetadata->serializedName = $this->namingStrategy->translateName($pMetadata); |
364 | 364 | } |
365 | 365 | |
366 | - if (!empty($pElem) && null !== $name = $pElem->attributes()->name) { |
|
366 | + if ( ! empty($pElem) && null !== $name = $pElem->attributes()->name) { |
|
367 | 367 | $pMetadata->name = (string) $name; |
368 | 368 | } |
369 | 369 | |
370 | 370 | if ( |
371 | - (ExclusionPolicy::NONE === (string) $exclusionPolicy && !$isExclude) |
|
371 | + (ExclusionPolicy::NONE === (string) $exclusionPolicy && ! $isExclude) |
|
372 | 372 | || (ExclusionPolicy::ALL === (string) $exclusionPolicy && $isExpose) |
373 | 373 | ) { |
374 | 374 | $metadata->addPropertyMetadata($pMetadata); |
@@ -377,11 +377,11 @@ discard block |
||
377 | 377 | } |
378 | 378 | |
379 | 379 | foreach ($elem->xpath('./callback-method') as $method) { |
380 | - if (!isset($method->attributes()->type)) { |
|
380 | + if ( ! isset($method->attributes()->type)) { |
|
381 | 381 | throw new InvalidMetadataException('The type attribute must be set for all callback-method elements.'); |
382 | 382 | } |
383 | 383 | |
384 | - if (!isset($method->attributes()->name)) { |
|
384 | + if ( ! isset($method->attributes()->name)) { |
|
385 | 385 | throw new InvalidMetadataException('The name attribute must be set for all callback-method elements.'); |
386 | 386 | } |
387 | 387 | |
@@ -399,11 +399,11 @@ discard block |
||
399 | 399 | break; |
400 | 400 | |
401 | 401 | case 'handler': |
402 | - if (!isset($method->attributes()->format)) { |
|
402 | + if ( ! isset($method->attributes()->format)) { |
|
403 | 403 | throw new InvalidMetadataException('The format attribute must be set for "handler" callback methods.'); |
404 | 404 | } |
405 | 405 | |
406 | - if (!isset($method->attributes()->direction)) { |
|
406 | + if ( ! isset($method->attributes()->direction)) { |
|
407 | 407 | throw new InvalidMetadataException('The direction attribute must be set for "handler" callback methods.'); |
408 | 408 | } |
409 | 409 |
@@ -175,11 +175,11 @@ discard block |
||
175 | 175 | $metadata = $this->metadataFactory->getMetadataForClass($type['name']); |
176 | 176 | \assert($metadata instanceof ClassMetadata); |
177 | 177 | |
178 | - if ($metadata->usingExpression && !$this->expressionExclusionStrategy) { |
|
178 | + if ($metadata->usingExpression && ! $this->expressionExclusionStrategy) { |
|
179 | 179 | throw new ExpressionLanguageRequiredException(sprintf('To use conditional exclude/expose in %s you must configure the expression language.', $metadata->name)); |
180 | 180 | } |
181 | 181 | |
182 | - if (!empty($metadata->discriminatorMap) && $type['name'] === $metadata->discriminatorBaseClass) { |
|
182 | + if ( ! empty($metadata->discriminatorMap) && $type['name'] === $metadata->discriminatorBaseClass) { |
|
183 | 183 | $metadata = $this->resolveMetadata($data, $metadata); |
184 | 184 | } |
185 | 185 | |
@@ -243,8 +243,8 @@ discard block |
||
243 | 243 | { |
244 | 244 | $typeValue = $this->visitor->visitDiscriminatorMapProperty($data, $metadata); |
245 | 245 | |
246 | - if (!isset($metadata->discriminatorMap[$typeValue])) { |
|
247 | - if (!empty($metadata->discriminatorDefaultClass)) { |
|
246 | + if ( ! isset($metadata->discriminatorMap[$typeValue])) { |
|
247 | + if ( ! empty($metadata->discriminatorDefaultClass)) { |
|
248 | 248 | return $this->metadataFactory->getMetadataForClass($metadata->discriminatorDefaultClass); |
249 | 249 | } |
250 | 250 |