@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | if (false !== stripos($data, '<!doctype')) { |
| 87 | 87 | $internalSubset = $this->getDomDocumentTypeEntitySubset($data); |
| 88 | - if (!in_array($internalSubset, $this->doctypeAllowList, true)) { |
|
| 88 | + if ( ! in_array($internalSubset, $this->doctypeAllowList, true)) { |
|
| 89 | 89 | throw new InvalidArgumentException(sprintf( |
| 90 | 90 | 'The document type "%s" is not allowed. If it is safe, you may add it to the allowlist configuration.', |
| 91 | 91 | $internalSubset, |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | $nodes = $data->xpath($entryName); |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | - if (null === $nodes || !\count($nodes)) { |
|
| 222 | + if (null === $nodes || ! \count($nodes)) { |
|
| 223 | 223 | return []; |
| 224 | 224 | } |
| 225 | 225 | |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | $nodes = $data->children($namespace)->$entryName; |
| 248 | 248 | foreach ($nodes as $v) { |
| 249 | 249 | $attrs = $v->attributes(); |
| 250 | - if (!isset($attrs[$this->currentMetadata->xmlKeyAttribute])) { |
|
| 250 | + if ( ! isset($attrs[$this->currentMetadata->xmlKeyAttribute])) { |
|
| 251 | 251 | throw new RuntimeException(sprintf('The key attribute "%s" must be set for each entry of the map.', $this->currentMetadata->xmlKeyAttribute)); |
| 252 | 252 | } |
| 253 | 253 | |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | return (string) $data->attributes($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}; |
| 278 | 278 | |
| 279 | 279 | // Check XML element with namespace for discriminatorFieldName |
| 280 | - case !$metadata->xmlDiscriminatorAttribute && null !== $metadata->xmlDiscriminatorNamespace && isset($data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}): |
|
| 280 | + case ! $metadata->xmlDiscriminatorAttribute && null !== $metadata->xmlDiscriminatorNamespace && isset($data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}): |
|
| 281 | 281 | return (string) $data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}; |
| 282 | 282 | |
| 283 | 283 | // Check XML element for discriminatorFieldName |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | $name = $metadata->serializedName; |
| 308 | 308 | |
| 309 | 309 | if (true === $metadata->inline) { |
| 310 | - if (!$metadata->type) { |
|
| 310 | + if ( ! $metadata->type) { |
|
| 311 | 311 | throw RuntimeException::noMetadataForProperty($metadata->class, $metadata->name); |
| 312 | 312 | } |
| 313 | 313 | |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | if ($metadata->xmlAttribute) { |
| 318 | 318 | $attributes = $data->attributes($metadata->xmlNamespace); |
| 319 | 319 | if (isset($attributes[$name])) { |
| 320 | - if (!$metadata->type) { |
|
| 320 | + if ( ! $metadata->type) { |
|
| 321 | 321 | throw RuntimeException::noMetadataForProperty($metadata->class, $metadata->name); |
| 322 | 322 | } |
| 323 | 323 | |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | $attributes = $data->attributes($metadata->xmlNamespace); |
| 333 | 333 | |
| 334 | 334 | if (isset($attributes[$attributeName])) { |
| 335 | - if (!$metadata->type) { |
|
| 335 | + if ( ! $metadata->type) { |
|
| 336 | 336 | throw RuntimeException::noMetadataForProperty($metadata->class, $metadata->name); |
| 337 | 337 | } |
| 338 | 338 | |
@@ -348,9 +348,9 @@ discard block |
||
| 348 | 348 | $childDataNode = null; |
| 349 | 349 | if ('' === $metadata->xmlNamespace) { |
| 350 | 350 | // Element explicitly in NO namespace |
| 351 | - $xpathQuery = "./*[local-name()='" . $elementName . "' and (namespace-uri()='' or not(namespace-uri()))]"; |
|
| 351 | + $xpathQuery = "./*[local-name()='".$elementName."' and (namespace-uri()='' or not(namespace-uri()))]"; |
|
| 352 | 352 | $matchingNodes = $data->xpath($xpathQuery); |
| 353 | - if (!empty($matchingNodes)) { |
|
| 353 | + if ( ! empty($matchingNodes)) { |
|
| 354 | 354 | $childDataNode = $matchingNodes[0]; |
| 355 | 355 | } |
| 356 | 356 | } elseif ($metadata->xmlNamespace) { |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | } |
| 368 | 368 | } |
| 369 | 369 | |
| 370 | - if (!$childDataNode || !$childDataNode->getName()) { |
|
| 370 | + if ( ! $childDataNode || ! $childDataNode->getName()) { |
|
| 371 | 371 | if (null === $metadata->xmlNamespace) { |
| 372 | 372 | $ns = '[default/none]'; |
| 373 | 373 | } else { |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | $attributes = $childDataNode->attributes($attributeTargetNs); |
| 382 | 382 | |
| 383 | 383 | if (isset($attributes[$attributeName])) { |
| 384 | - if (!$metadata->type) { |
|
| 384 | + if ( ! $metadata->type) { |
|
| 385 | 385 | throw RuntimeException::noMetadataForProperty($metadata->class, $metadata->name); |
| 386 | 386 | } |
| 387 | 387 | |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | } |
| 393 | 393 | |
| 394 | 394 | if ($metadata->xmlValue) { |
| 395 | - if (!$metadata->type) { |
|
| 395 | + if ( ! $metadata->type) { |
|
| 396 | 396 | throw RuntimeException::noMetadataForProperty($metadata->class, $metadata->name); |
| 397 | 397 | } |
| 398 | 398 | |
@@ -401,12 +401,12 @@ discard block |
||
| 401 | 401 | |
| 402 | 402 | if ($metadata->xmlCollection) { |
| 403 | 403 | $enclosingElem = $data; |
| 404 | - if (!$metadata->xmlCollectionInline) { |
|
| 404 | + if ( ! $metadata->xmlCollectionInline) { |
|
| 405 | 405 | $enclosingElem = $data->children($metadata->xmlNamespace)->$name; |
| 406 | 406 | } |
| 407 | 407 | |
| 408 | 408 | $this->setCurrentMetadata($metadata); |
| 409 | - if (!$metadata->type) { |
|
| 409 | + if ( ! $metadata->type) { |
|
| 410 | 410 | throw RuntimeException::noMetadataForProperty($metadata->class, $metadata->name); |
| 411 | 411 | } |
| 412 | 412 | |
@@ -418,13 +418,13 @@ discard block |
||
| 418 | 418 | |
| 419 | 419 | if ($metadata->xmlNamespace) { |
| 420 | 420 | $node = $data->children($metadata->xmlNamespace)->$name; |
| 421 | - if (!$node->count()) { |
|
| 421 | + if ( ! $node->count()) { |
|
| 422 | 422 | throw new NotAcceptableException(); |
| 423 | 423 | } |
| 424 | 424 | } elseif ('' === $metadata->xmlNamespace) { |
| 425 | 425 | // See #1087 - element must be like: <element xmlns="" /> - https://www.w3.org/TR/REC-xml-names/#iri-use |
| 426 | 426 | // Use of an empty string in a namespace declaration turns it into an "undeclaration". |
| 427 | - $nodes = $data->xpath('./' . $name); |
|
| 427 | + $nodes = $data->xpath('./'.$name); |
|
| 428 | 428 | if (empty($nodes)) { |
| 429 | 429 | throw new NotAcceptableException(); |
| 430 | 430 | } |
@@ -435,9 +435,9 @@ discard block |
||
| 435 | 435 | if (isset($namespaces[''])) { |
| 436 | 436 | $prefix = uniqid('ns-'); |
| 437 | 437 | $data->registerXPathNamespace($prefix, $namespaces['']); |
| 438 | - $nodes = $data->xpath('./' . $prefix . ':' . $name); |
|
| 438 | + $nodes = $data->xpath('./'.$prefix.':'.$name); |
|
| 439 | 439 | } else { |
| 440 | - $nodes = $data->xpath('./' . $name); |
|
| 440 | + $nodes = $data->xpath('./'.$name); |
|
| 441 | 441 | } |
| 442 | 442 | |
| 443 | 443 | if (empty($nodes)) { |
@@ -451,7 +451,7 @@ discard block |
||
| 451 | 451 | $this->setCurrentMetadata($metadata); |
| 452 | 452 | } |
| 453 | 453 | |
| 454 | - if (!$metadata->type) { |
|
| 454 | + if ( ! $metadata->type) { |
|
| 455 | 455 | throw RuntimeException::noMetadataForProperty($metadata->class, $metadata->name); |
| 456 | 456 | } |
| 457 | 457 | |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | |
| 116 | 116 | private function getNavigator(int $direction): GraphNavigatorInterface |
| 117 | 117 | { |
| 118 | - if (!isset($this->graphNavigators[$direction])) { |
|
| 118 | + if ( ! isset($this->graphNavigators[$direction])) { |
|
| 119 | 119 | throw new RuntimeException( |
| 120 | 120 | sprintf( |
| 121 | 121 | 'Cannot find a graph navigator for the direction "%s".', |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | ? $this->serializationVisitors |
| 134 | 134 | : $this->deserializationVisitors; |
| 135 | 135 | |
| 136 | - if (!isset($factories[$format])) { |
|
| 136 | + if ( ! isset($factories[$format])) { |
|
| 137 | 137 | throw new UnsupportedFormatException( |
| 138 | 138 | sprintf( |
| 139 | 139 | 'The format "%s" is not supported for %s.', |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | $result = $this->visit($navigator, $visitor, $context, $data, 'json', $type); |
| 203 | 203 | $result = $this->convertArrayObjects($result); |
| 204 | 204 | |
| 205 | - if (!\is_array($result)) { |
|
| 205 | + if ( ! \is_array($result)) { |
|
| 206 | 206 | throw new RuntimeException(sprintf( |
| 207 | 207 | 'The input data of type "%s" did not convert to an array, but got a result of type "%s".', |
| 208 | 208 | \is_object($data) ? \get_class($data) : \gettype($data), |
@@ -51,8 +51,8 @@ discard block |
||
| 51 | 51 | array $type, |
| 52 | 52 | SerializationContext $context |
| 53 | 53 | ) { |
| 54 | - if ((isset($type['params'][1]) && 'value' === $type['params'][1]) || (!isset($type['params'][1]) && $enum instanceof \BackedEnum)) { |
|
| 55 | - if (!$enum instanceof \BackedEnum) { |
|
| 54 | + if ((isset($type['params'][1]) && 'value' === $type['params'][1]) || ( ! isset($type['params'][1]) && $enum instanceof \BackedEnum)) { |
|
| 55 | + if ( ! $enum instanceof \BackedEnum) { |
|
| 56 | 56 | throw new InvalidMetadataException(sprintf('The type "%s" is not a backed enum, thus you cannot use "value" as serialization mode for its value.', get_class($enum))); |
| 57 | 57 | } |
| 58 | 58 | |
@@ -80,13 +80,13 @@ discard block |
||
| 80 | 80 | $caseValue = (string) $data; |
| 81 | 81 | |
| 82 | 82 | $ref = new \ReflectionEnum($enumType); |
| 83 | - if (isset($type['params'][1]) && 'value' === $type['params'][1] || (!isset($type['params'][1]) && is_a($enumType, \BackedEnum::class, true))) { |
|
| 84 | - if (!is_a($enumType, \BackedEnum::class, true)) { |
|
| 83 | + if (isset($type['params'][1]) && 'value' === $type['params'][1] || ( ! isset($type['params'][1]) && is_a($enumType, \BackedEnum::class, true))) { |
|
| 84 | + if ( ! is_a($enumType, \BackedEnum::class, true)) { |
|
| 85 | 85 | throw new InvalidMetadataException(sprintf('The type "%s" is not a backed enum, thus you cannot use "value" as serialization mode for its value.', $enumType)); |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | if ('int' === $ref->getBackingType()->getName()) { |
| 89 | - if (!is_numeric($caseValue)) { |
|
| 89 | + if ( ! is_numeric($caseValue)) { |
|
| 90 | 90 | throw new RuntimeException(sprintf('"%s" is not a valid backing value for enum "%s"', $caseValue, $enumType)); |
| 91 | 91 | } |
| 92 | 92 | |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | return $enumType::from($caseValue); |
| 97 | 97 | } else { |
| 98 | - if (!$ref->hasCase($caseValue)) { |
|
| 98 | + if ( ! $ref->hasCase($caseValue)) { |
|
| 99 | 99 | throw new InvalidMetadataException(sprintf('The type "%s" does not have the case "%s"', $ref->getName(), $caseValue)); |
| 100 | 100 | } |
| 101 | 101 | |