@@ -22,8 +22,8 @@ discard block |
||
| 22 | 22 | protected function setDiscriminator(DoctrineClassMetadata $doctrineMetadata, ClassMetadata $classMetadata): void |
| 23 | 23 | { |
| 24 | 24 | if ( |
| 25 | - empty($classMetadata->discriminatorMap) && !$classMetadata->discriminatorDisabled |
|
| 26 | - && !empty($doctrineMetadata->discriminatorMap) && $doctrineMetadata->isRootEntity() |
|
| 25 | + empty($classMetadata->discriminatorMap) && ! $classMetadata->discriminatorDisabled |
|
| 26 | + && ! empty($doctrineMetadata->discriminatorMap) && $doctrineMetadata->isRootEntity() |
|
| 27 | 27 | ) { |
| 28 | 28 | $classMetadata->setDiscriminator( |
| 29 | 29 | $doctrineMetadata->discriminatorColumn['name'], |
@@ -51,11 +51,11 @@ discard block |
||
| 51 | 51 | // For inheritance schemes, we cannot add any type as we would only add the super-type of the hierarchy. |
| 52 | 52 | // On serialization, this would lead to only the supertype being serialized, and properties of subtypes |
| 53 | 53 | // being ignored. |
| 54 | - if ($targetMetadata instanceof ClassMetadataInfo && !$targetMetadata->isInheritanceTypeNone()) { |
|
| 54 | + if ($targetMetadata instanceof ClassMetadataInfo && ! $targetMetadata->isInheritanceTypeNone()) { |
|
| 55 | 55 | return; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - if (!$doctrineMetadata->isSingleValuedAssociation($propertyName)) { |
|
| 58 | + if ( ! $doctrineMetadata->isSingleValuedAssociation($propertyName)) { |
|
| 59 | 59 | $targetEntity = sprintf('ArrayCollection<%s>', $targetEntity); |
| 60 | 60 | } |
| 61 | 61 | |
@@ -111,7 +111,7 @@ |
||
| 111 | 111 | */ |
| 112 | 112 | private function shouldTypeHint(?\ReflectionType $reflectionType): bool |
| 113 | 113 | { |
| 114 | - if (!$reflectionType instanceof \ReflectionNamedType) { |
|
| 114 | + if ( ! $reflectionType instanceof \ReflectionNamedType) { |
|
| 115 | 115 | return false; |
| 116 | 116 | } |
| 117 | 117 | |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | public function createRoot(?ClassMetadata $metadata = null, ?string $rootName = null, ?string $rootNamespace = null, ?string $rootPrefix = null): \DOMElement |
| 106 | 106 | { |
| 107 | - if (null !== $metadata && !empty($metadata->xmlRootName)) { |
|
| 107 | + if (null !== $metadata && ! empty($metadata->xmlRootName)) { |
|
| 108 | 108 | $rootPrefix = $metadata->xmlRootPrefix; |
| 109 | 109 | $rootName = $metadata->xmlRootName; |
| 110 | 110 | $rootNamespace = $metadata->xmlRootNamespace ?: $this->getClassDefaultNamespace($metadata); |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | |
| 117 | 117 | $document = $this->getDocument(); |
| 118 | 118 | if ($rootNamespace) { |
| 119 | - $rootNode = $document->createElementNS($rootNamespace, (null !== $rootPrefix ? $rootPrefix . ':' : '') . $rootName); |
|
| 119 | + $rootNode = $document->createElementNS($rootNamespace, (null !== $rootPrefix ? $rootPrefix.':' : '').$rootName); |
|
| 120 | 120 | } else { |
| 121 | 121 | $rootNode = $document->createElement($rootName); |
| 122 | 122 | } |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | $decimalsNumbers = $type['params'][2] ?? null; |
| 191 | 191 | if (null === $decimalsNumbers) { |
| 192 | 192 | $parts = explode('.', (string) $dataResult); |
| 193 | - if (count($parts) < 2 || !$parts[1]) { |
|
| 193 | + if (count($parts) < 2 || ! $parts[1]) { |
|
| 194 | 194 | $decimalsNumbers = 1; |
| 195 | 195 | } |
| 196 | 196 | } |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | $node = $this->navigator->accept($v, $metadata->type); |
| 266 | 266 | $this->revertCurrentMetadata(); |
| 267 | 267 | |
| 268 | - if (!$node instanceof \DOMCharacterData) { |
|
| 268 | + if ( ! $node instanceof \DOMCharacterData) { |
|
| 269 | 269 | throw new RuntimeException(sprintf('Unsupported value for XML attribute for %s. Expected character data, but got %s.', $metadata->name, json_encode($v))); |
| 270 | 270 | } |
| 271 | 271 | |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | |
| 277 | 277 | if ( |
| 278 | 278 | ($metadata->xmlValue && $this->currentNode->childNodes->length > 0) |
| 279 | - || (!$metadata->xmlValue && $this->hasValue) |
|
| 279 | + || ( ! $metadata->xmlValue && $this->hasValue) |
|
| 280 | 280 | ) { |
| 281 | 281 | throw new RuntimeException(sprintf('If you make use of @XmlValue, all other properties in the class must have the @XmlAttribute annotation. Invalid usage detected in class %s.', $metadata->class)); |
| 282 | 282 | } |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | $node = $this->navigator->accept($v, $metadata->type); |
| 289 | 289 | $this->revertCurrentMetadata(); |
| 290 | 290 | |
| 291 | - if (!$node instanceof \DOMCharacterData) { |
|
| 291 | + if ( ! $node instanceof \DOMCharacterData) { |
|
| 292 | 292 | throw new RuntimeException(sprintf('Unsupported value for property %s::$%s. Expected character data, but got %s.', $metadata->class, $metadata->name, \is_object($node) ? \get_class($node) : \gettype($node))); |
| 293 | 293 | } |
| 294 | 294 | |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | if ($metadata->xmlAttributeMap) { |
| 301 | - if (!\is_array($v)) { |
|
| 301 | + if ( ! \is_array($v)) { |
|
| 302 | 302 | throw new RuntimeException(sprintf('Unsupported value type for XML attribute map. Expected array but got %s.', \gettype($v))); |
| 303 | 303 | } |
| 304 | 304 | |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | $node = $this->navigator->accept($value, null); |
| 308 | 308 | $this->revertCurrentMetadata(); |
| 309 | 309 | |
| 310 | - if (!$node instanceof \DOMCharacterData) { |
|
| 310 | + if ( ! $node instanceof \DOMCharacterData) { |
|
| 311 | 311 | throw new RuntimeException(sprintf('Unsupported value for a XML attribute map value. Expected character data, but got %s.', json_encode($v))); |
| 312 | 312 | } |
| 313 | 313 | |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | return; |
| 318 | 318 | } |
| 319 | 319 | |
| 320 | - if ($addEnclosingElement = !$this->isInLineCollection($metadata) && !$metadata->inline) { |
|
| 320 | + if ($addEnclosingElement = ! $this->isInLineCollection($metadata) && ! $metadata->inline) { |
|
| 321 | 321 | $namespace = null !== $metadata->xmlNamespace |
| 322 | 322 | ? $metadata->xmlNamespace |
| 323 | 323 | : $this->getClassDefaultNamespace($this->objectMetadataStack->top()); |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | |
| 363 | 363 | private function isSkippableEmptyObject(?\DOMElement $node, PropertyMetadata $metadata): bool |
| 364 | 364 | { |
| 365 | - return null === $node && !$metadata->xmlCollection && $metadata->skipWhenEmpty; |
|
| 365 | + return null === $node && ! $metadata->xmlCollection && $metadata->skipWhenEmpty; |
|
| 366 | 366 | } |
| 367 | 367 | |
| 368 | 368 | private function isSkippableCollection(PropertyMetadata $metadata): bool |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | |
| 373 | 373 | private function isElementEmpty(\DOMElement $element): bool |
| 374 | 374 | { |
| 375 | - return !$element->hasChildNodes() && !$element->hasAttributes(); |
|
| 375 | + return ! $element->hasChildNodes() && ! $element->hasAttributes(); |
|
| 376 | 376 | } |
| 377 | 377 | |
| 378 | 378 | public function endVisitingObject(ClassMetadata $metadata, object $data, array $type): void |
@@ -476,7 +476,7 @@ discard block |
||
| 476 | 476 | foreach ($metadata->xmlNamespaces as $prefix => $uri) { |
| 477 | 477 | $attribute = 'xmlns'; |
| 478 | 478 | if ('' !== $prefix) { |
| 479 | - $attribute .= ':' . $prefix; |
|
| 479 | + $attribute .= ':'.$prefix; |
|
| 480 | 480 | } elseif ($element->namespaceURI === $uri) { |
| 481 | 481 | continue; |
| 482 | 482 | } |
@@ -506,21 +506,21 @@ discard block |
||
| 506 | 506 | return $this->document->createElementNS($namespace, $tagName); |
| 507 | 507 | } |
| 508 | 508 | |
| 509 | - if (!($prefix = $this->currentNode->lookupPrefix($namespace)) && !($prefix = $this->document->lookupPrefix($namespace))) { |
|
| 510 | - $prefix = 'ns-' . substr(sha1($namespace), 0, 8); |
|
| 509 | + if ( ! ($prefix = $this->currentNode->lookupPrefix($namespace)) && ! ($prefix = $this->document->lookupPrefix($namespace))) { |
|
| 510 | + $prefix = 'ns-'.substr(sha1($namespace), 0, 8); |
|
| 511 | 511 | } |
| 512 | 512 | |
| 513 | - return $this->document->createElementNS($namespace, $prefix . ':' . $tagName); |
|
| 513 | + return $this->document->createElementNS($namespace, $prefix.':'.$tagName); |
|
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | private function setAttributeOnNode(\DOMElement $node, string $name, string $value, ?string $namespace = null): void |
| 517 | 517 | { |
| 518 | 518 | if (null !== $namespace) { |
| 519 | - if (!$prefix = $node->lookupPrefix($namespace)) { |
|
| 520 | - $prefix = 'ns-' . substr(sha1($namespace), 0, 8); |
|
| 519 | + if ( ! $prefix = $node->lookupPrefix($namespace)) { |
|
| 520 | + $prefix = 'ns-'.substr(sha1($namespace), 0, 8); |
|
| 521 | 521 | } |
| 522 | 522 | |
| 523 | - $node->setAttributeNS($namespace, $prefix . ':' . $name, $value); |
|
| 523 | + $node->setAttributeNS($namespace, $prefix.':'.$name, $value); |
|
| 524 | 524 | } else { |
| 525 | 525 | $node->setAttribute($name, $value); |
| 526 | 526 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | { |
| 69 | 69 | $objectManager = $this->managerRegistry->getManagerForClass($metadata->name); |
| 70 | 70 | |
| 71 | - if (!$objectManager) { |
|
| 71 | + if ( ! $objectManager) { |
|
| 72 | 72 | // No ObjectManager found, proceed with normal deserialization |
| 73 | 73 | return $this->fallbackConstructor->construct($visitor, $metadata, $data, $type, $context); |
| 74 | 74 | } |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | // Managed entity, check for proxy load |
| 85 | - if (!is_array($data) && !(is_object($data) && 'SimpleXMLElement' === get_class($data))) { |
|
| 85 | + if ( ! is_array($data) && ! (is_object($data) && 'SimpleXMLElement' === get_class($data))) { |
|
| 86 | 86 | \assert($objectManager instanceof EntityManagerInterface || $objectManager instanceof DocumentManagerInterface); |
| 87 | 87 | |
| 88 | 88 | // Single identifier, load proxy |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | foreach ($classMetadata->getIdentifierFieldNames() as $name) { |
| 97 | 97 | // Avoid calling objectManager->find if some identification properties are excluded |
| 98 | - if (!isset($metadata->propertyMetadata[$name])) { |
|
| 98 | + if ( ! isset($metadata->propertyMetadata[$name])) { |
|
| 99 | 99 | return $this->fallbackConstructor->construct($visitor, $metadata, $data, $type, $context); |
| 100 | 100 | } |
| 101 | 101 | |
@@ -106,9 +106,9 @@ discard block |
||
| 106 | 106 | return $this->fallbackConstructor->construct($visitor, $metadata, $data, $type, $context); |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - if (is_array($data) && !array_key_exists($propertyMetadata->serializedName, $data)) { |
|
| 109 | + if (is_array($data) && ! array_key_exists($propertyMetadata->serializedName, $data)) { |
|
| 110 | 110 | return $this->fallbackConstructor->construct($visitor, $metadata, $data, $type, $context); |
| 111 | - } elseif (is_object($data) && !property_exists($data, $propertyMetadata->serializedName)) { |
|
| 111 | + } elseif (is_object($data) && ! property_exists($data, $propertyMetadata->serializedName)) { |
|
| 112 | 112 | return $this->fallbackConstructor->construct($visitor, $metadata, $data, $type, $context); |
| 113 | 113 | } |
| 114 | 114 | |