@@ -176,22 +176,22 @@ discard block |
||
176 | 176 | $class = $this->getReflection()->getDeclaringClass(); |
177 | 177 | |
178 | 178 | if (empty($getter)) { |
179 | - if ($class->hasMethod('get' . $this->name) && $class->getMethod('get' . $this->name)->isPublic()) { |
|
180 | - $getter = 'get' . $this->name; |
|
181 | - } elseif ($class->hasMethod('is' . $this->name) && $class->getMethod('is' . $this->name)->isPublic()) { |
|
182 | - $getter = 'is' . $this->name; |
|
183 | - } elseif ($class->hasMethod('has' . $this->name) && $class->getMethod('has' . $this->name)->isPublic()) { |
|
184 | - $getter = 'has' . $this->name; |
|
179 | + if ($class->hasMethod('get'.$this->name) && $class->getMethod('get'.$this->name)->isPublic()) { |
|
180 | + $getter = 'get'.$this->name; |
|
181 | + } elseif ($class->hasMethod('is'.$this->name) && $class->getMethod('is'.$this->name)->isPublic()) { |
|
182 | + $getter = 'is'.$this->name; |
|
183 | + } elseif ($class->hasMethod('has'.$this->name) && $class->getMethod('has'.$this->name)->isPublic()) { |
|
184 | + $getter = 'has'.$this->name; |
|
185 | 185 | } else { |
186 | - 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)); |
|
186 | + 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)); |
|
187 | 187 | } |
188 | 188 | } |
189 | 189 | |
190 | - if (empty($setter) && !$this->readOnly) { |
|
191 | - if ($class->hasMethod('set' . $this->name) && $class->getMethod('set' . $this->name)->isPublic()) { |
|
192 | - $setter = 'set' . $this->name; |
|
190 | + if (empty($setter) && ! $this->readOnly) { |
|
191 | + if ($class->hasMethod('set'.$this->name) && $class->getMethod('set'.$this->name)->isPublic()) { |
|
192 | + $setter = 'set'.$this->name; |
|
193 | 193 | } else { |
194 | - 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)); |
|
194 | + 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)); |
|
195 | 195 | } |
196 | 196 | } |
197 | 197 | } |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | return is_array($type) |
217 | 217 | && 'array' === $type['name'] |
218 | 218 | && isset($type['params'][0]) |
219 | - && !isset($type['params'][1]); |
|
219 | + && ! isset($type['params'][1]); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | /** |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | if ($type instanceof ArrayTypeNode) { |
127 | 127 | $resolvedType = $this->resolveTypeFromTypeNode($type->type, $reflector); |
128 | 128 | |
129 | - return 'array<' . $resolvedType . '>'; |
|
129 | + return 'array<'.$resolvedType.'>'; |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | // Generic array syntax: array<Product> | array<\Foo\Bar\Product> | array<int,Product> |
@@ -134,13 +134,13 @@ discard block |
||
134 | 134 | if ($this->isSimpleType($type->type, 'array')) { |
135 | 135 | $resolvedTypes = array_map(fn (TypeNode $node) => $this->resolveTypeFromTypeNode($node, $reflector), $type->genericTypes); |
136 | 136 | |
137 | - return 'array<' . implode(',', $resolvedTypes) . '>'; |
|
137 | + return 'array<'.implode(',', $resolvedTypes).'>'; |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | if ($this->isSimpleType($type->type, 'list')) { |
141 | 141 | $resolvedTypes = array_map(fn (TypeNode $node) => $this->resolveTypeFromTypeNode($node, $reflector), $type->genericTypes); |
142 | 142 | |
143 | - return 'list<' . implode(',', $resolvedTypes) . '>'; |
|
143 | + return 'list<'.implode(',', $resolvedTypes).'>'; |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | throw new \InvalidArgumentException(sprintf("Can't use non-array generic type %s for collection in %s:%s", (string) $type->type, $reflector->getDeclaringClass()->getName(), $reflector->getName())); |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | return []; |
164 | 164 | } |
165 | 165 | |
166 | - return array_merge(...array_map(static function ($node) { |
|
166 | + return array_merge(...array_map(static function($node) { |
|
167 | 167 | if ($node->type instanceof UnionTypeNode) { |
168 | 168 | return $node->type->types; |
169 | 169 | } |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | */ |
249 | 249 | private function resolveTypeFromTypeNode(TypeNode $typeNode, $reflector): string |
250 | 250 | { |
251 | - if (!($typeNode instanceof IdentifierTypeNode)) { |
|
251 | + if ( ! ($typeNode instanceof IdentifierTypeNode)) { |
|
252 | 252 | throw new \InvalidArgumentException(sprintf("Can't use unsupported type %s for collection in %s:%s", (string) $typeNode, $reflector->getDeclaringClass()->getName(), $reflector->getName())); |
253 | 253 | } |
254 | 254 | |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | */ |
261 | 261 | private function expandClassNameUsingUseStatements(string $typeHint, \ReflectionClass $declaringClass, $reflector): string |
262 | 262 | { |
263 | - $expandedClassName = $declaringClass->getNamespaceName() . '\\' . $typeHint; |
|
263 | + $expandedClassName = $declaringClass->getNamespaceName().'\\'.$typeHint; |
|
264 | 264 | if ($this->isClassOrInterface($expandedClassName)) { |
265 | 265 | return $expandedClassName; |
266 | 266 | } |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | |
299 | 299 | private function endsWith(string $statementClassToCheck, string $typeHintToSearchFor): bool |
300 | 300 | { |
301 | - $typeHintToSearchFor = '\\' . $typeHintToSearchFor; |
|
301 | + $typeHintToSearchFor = '\\'.$typeHintToSearchFor; |
|
302 | 302 | |
303 | 303 | return substr($statementClassToCheck, -strlen($typeHintToSearchFor)) === $typeHintToSearchFor; |
304 | 304 | } |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | preg_match_all(self::GROUP_USE_STATEMENTS_REGEX, $classContents, $foundGroupUseStatements); |
320 | 320 | for ($useStatementIndex = 0; $useStatementIndex < count($foundGroupUseStatements[0]); $useStatementIndex++) { |
321 | 321 | foreach (explode(',', $foundGroupUseStatements[2][$useStatementIndex]) as $singleUseStatement) { |
322 | - $foundUseStatements[] = trim($foundGroupUseStatements[1][$useStatementIndex]) . trim($singleUseStatement); |
|
322 | + $foundUseStatements[] = trim($foundGroupUseStatements[1][$useStatementIndex]).trim($singleUseStatement); |
|
323 | 323 | } |
324 | 324 | } |
325 | 325 | |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | */ |
359 | 359 | private function resolveType(string $typeHint, $reflector): string |
360 | 360 | { |
361 | - if (!$this->hasGlobalNamespacePrefix($typeHint) && !$this->isPrimitiveType($typeHint)) { |
|
361 | + if ( ! $this->hasGlobalNamespacePrefix($typeHint) && ! $this->isPrimitiveType($typeHint)) { |
|
362 | 362 | $typeHint = $this->expandClassNameUsingUseStatements($typeHint, $this->getDeclaringClassOrTrait($reflector), $reflector); |
363 | 363 | } |
364 | 364 | |
@@ -376,15 +376,15 @@ discard block |
||
376 | 376 | private function resolveTypeFromDocblock($reflector): array |
377 | 377 | { |
378 | 378 | $docComment = $reflector->getDocComment(); |
379 | - if (!$docComment && PHP_VERSION_ID >= 80000 && $reflector instanceof \ReflectionProperty && $reflector->isPromoted()) { |
|
379 | + if ( ! $docComment && PHP_VERSION_ID >= 80000 && $reflector instanceof \ReflectionProperty && $reflector->isPromoted()) { |
|
380 | 380 | $constructor = $reflector->getDeclaringClass()->getConstructor(); |
381 | - if (!$constructor) { |
|
381 | + if ( ! $constructor) { |
|
382 | 382 | return []; |
383 | 383 | } |
384 | 384 | |
385 | 385 | $docComment = $constructor->getDocComment(); |
386 | 386 | |
387 | - if (!$docComment) { |
|
387 | + if ( ! $docComment) { |
|
388 | 388 | return []; |
389 | 389 | } |
390 | 390 | |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | return $this->flattenParamTagValueTypes($reflector->getName(), $phpDocNode->getParamTagValues()); |
395 | 395 | } |
396 | 396 | |
397 | - if (!$docComment) { |
|
397 | + if ( ! $docComment) { |
|
398 | 398 | return []; |
399 | 399 | } |
400 | 400 |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | { |
22 | 22 | assert($doctrineMetadata instanceof ORMClassMetadata || $doctrineMetadata instanceof ODMClassMetadata); |
23 | 23 | if ( |
24 | - empty($classMetadata->discriminatorMap) && !$classMetadata->discriminatorDisabled |
|
25 | - && !empty($doctrineMetadata->discriminatorMap) && $doctrineMetadata->isRootEntity() |
|
24 | + empty($classMetadata->discriminatorMap) && ! $classMetadata->discriminatorDisabled |
|
25 | + && ! empty($doctrineMetadata->discriminatorMap) && $doctrineMetadata->isRootEntity() |
|
26 | 26 | ) { |
27 | 27 | if ($doctrineMetadata->discriminatorColumn instanceof DiscriminatorColumnMapping) { |
28 | 28 | // Doctrine 3.1+ |
@@ -59,11 +59,11 @@ discard block |
||
59 | 59 | // For inheritance schemes, we cannot add any type as we would only add the super-type of the hierarchy. |
60 | 60 | // On serialization, this would lead to only the supertype being serialized, and properties of subtypes |
61 | 61 | // being ignored. |
62 | - if ($targetMetadata instanceof ODMClassMetadata && !$targetMetadata->isInheritanceTypeNone()) { |
|
62 | + if ($targetMetadata instanceof ODMClassMetadata && ! $targetMetadata->isInheritanceTypeNone()) { |
|
63 | 63 | return; |
64 | 64 | } |
65 | 65 | |
66 | - if (!$doctrineMetadata->isSingleValuedAssociation($propertyName)) { |
|
66 | + if ( ! $doctrineMetadata->isSingleValuedAssociation($propertyName)) { |
|
67 | 67 | $targetEntity = sprintf('ArrayCollection<%s>', $targetEntity); |
68 | 68 | } |
69 | 69 |
@@ -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 |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | |
106 | 106 | public function createRoot(?ClassMetadata $metadata = null, ?string $rootName = null, ?string $rootNamespace = null, ?string $rootPrefix = null): \DOMElement |
107 | 107 | { |
108 | - if (null !== $metadata && !empty($metadata->xmlRootName)) { |
|
108 | + if (null !== $metadata && ! empty($metadata->xmlRootName)) { |
|
109 | 109 | $rootPrefix = $metadata->xmlRootPrefix; |
110 | 110 | $rootName = $metadata->xmlRootName; |
111 | 111 | $rootNamespace = $metadata->xmlRootNamespace ?: $this->getClassDefaultNamespace($metadata); |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | |
118 | 118 | $document = $this->getDocument(); |
119 | 119 | if ($rootNamespace) { |
120 | - $rootNode = $document->createElementNS($rootNamespace, (null !== $rootPrefix ? $rootPrefix . ':' : '') . $rootName); |
|
120 | + $rootNode = $document->createElementNS($rootNamespace, (null !== $rootPrefix ? $rootPrefix.':' : '').$rootName); |
|
121 | 121 | } else { |
122 | 122 | $rootNode = $document->createElement($rootName); |
123 | 123 | } |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | $decimalsNumbers = $type['params'][2] ?? null; |
192 | 192 | if (null === $decimalsNumbers) { |
193 | 193 | $parts = explode('.', (string) $dataResult); |
194 | - if (count($parts) < 2 || !$parts[1]) { |
|
194 | + if (count($parts) < 2 || ! $parts[1]) { |
|
195 | 195 | $decimalsNumbers = 1; |
196 | 196 | } |
197 | 197 | } |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | $node = $this->navigator->accept($v, $metadata->type); |
267 | 267 | $this->revertCurrentMetadata(); |
268 | 268 | |
269 | - if (!$node instanceof \DOMCharacterData) { |
|
269 | + if ( ! $node instanceof \DOMCharacterData) { |
|
270 | 270 | throw new RuntimeException(sprintf('Unsupported value for XML attribute for %s. Expected character data, but got %s.', $metadata->name, json_encode($v))); |
271 | 271 | } |
272 | 272 | |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | |
278 | 278 | if ( |
279 | 279 | ($metadata->xmlValue && $this->currentNode->childNodes->length > 0) |
280 | - || (!$metadata->xmlValue && $this->hasValue) |
|
280 | + || ( ! $metadata->xmlValue && $this->hasValue) |
|
281 | 281 | ) { |
282 | 282 | 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)); |
283 | 283 | } |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | $node = $this->navigator->accept($v, $metadata->type); |
290 | 290 | $this->revertCurrentMetadata(); |
291 | 291 | |
292 | - if (!$node instanceof \DOMCharacterData) { |
|
292 | + if ( ! $node instanceof \DOMCharacterData) { |
|
293 | 293 | 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))); |
294 | 294 | } |
295 | 295 | |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | } |
300 | 300 | |
301 | 301 | if ($metadata->xmlAttributeMap) { |
302 | - if (!\is_array($v)) { |
|
302 | + if ( ! \is_array($v)) { |
|
303 | 303 | throw new RuntimeException(sprintf('Unsupported value type for XML attribute map. Expected array but got %s.', \gettype($v))); |
304 | 304 | } |
305 | 305 | |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | $node = $this->navigator->accept($value, null); |
309 | 309 | $this->revertCurrentMetadata(); |
310 | 310 | |
311 | - if (!$node instanceof \DOMCharacterData) { |
|
311 | + if ( ! $node instanceof \DOMCharacterData) { |
|
312 | 312 | throw new RuntimeException(sprintf('Unsupported value for a XML attribute map value. Expected character data, but got %s.', json_encode($v))); |
313 | 313 | } |
314 | 314 | |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | return; |
341 | 341 | } |
342 | 342 | |
343 | - if ($addEnclosingElement = !$this->isInLineCollection($metadata) && !$metadata->inline) { |
|
343 | + if ($addEnclosingElement = ! $this->isInLineCollection($metadata) && ! $metadata->inline) { |
|
344 | 344 | $namespace = $metadata->xmlNamespace ?? $this->getClassDefaultNamespace($this->objectMetadataStack->top()); |
345 | 345 | |
346 | 346 | $element = $this->createElement($metadata->serializedName, $namespace); |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | } |
403 | 403 | } |
404 | 404 | |
405 | - if (!$targetElement) { |
|
405 | + if ( ! $targetElement) { |
|
406 | 406 | return false; |
407 | 407 | } |
408 | 408 | |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | |
453 | 453 | private function isSkippableEmptyObject(?\DOMElement $node, PropertyMetadata $metadata): bool |
454 | 454 | { |
455 | - return null === $node && !$metadata->xmlCollection && $metadata->skipWhenEmpty; |
|
455 | + return null === $node && ! $metadata->xmlCollection && $metadata->skipWhenEmpty; |
|
456 | 456 | } |
457 | 457 | |
458 | 458 | private function isSkippableCollection(PropertyMetadata $metadata): bool |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | |
463 | 463 | private function isElementEmpty(\DOMElement $element): bool |
464 | 464 | { |
465 | - return !$element->hasChildNodes() && !$element->hasAttributes(); |
|
465 | + return ! $element->hasChildNodes() && ! $element->hasAttributes(); |
|
466 | 466 | } |
467 | 467 | |
468 | 468 | public function endVisitingObject(ClassMetadata $metadata, object $data, array $type): void |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | foreach ($metadata->xmlNamespaces as $prefix => $uri) { |
568 | 568 | $attribute = 'xmlns'; |
569 | 569 | if ('' !== $prefix) { |
570 | - $attribute .= ':' . $prefix; |
|
570 | + $attribute .= ':'.$prefix; |
|
571 | 571 | } elseif ($element->namespaceURI === $uri) { |
572 | 572 | continue; |
573 | 573 | } |
@@ -597,21 +597,21 @@ discard block |
||
597 | 597 | return $this->document->createElementNS($namespace, $tagName); |
598 | 598 | } |
599 | 599 | |
600 | - if (!($prefix = $this->currentNode->lookupPrefix($namespace)) && !($prefix = $this->document->lookupPrefix($namespace))) { |
|
601 | - $prefix = 'ns-' . substr(sha1($namespace), 0, 8); |
|
600 | + if ( ! ($prefix = $this->currentNode->lookupPrefix($namespace)) && ! ($prefix = $this->document->lookupPrefix($namespace))) { |
|
601 | + $prefix = 'ns-'.substr(sha1($namespace), 0, 8); |
|
602 | 602 | } |
603 | 603 | |
604 | - return $this->document->createElementNS($namespace, $prefix . ':' . $tagName); |
|
604 | + return $this->document->createElementNS($namespace, $prefix.':'.$tagName); |
|
605 | 605 | } |
606 | 606 | |
607 | 607 | private function setAttributeOnNode(\DOMElement $node, string $name, string $value, ?string $namespace = null): void |
608 | 608 | { |
609 | 609 | if (null !== $namespace) { |
610 | - if (!$prefix = $node->lookupPrefix($namespace)) { |
|
611 | - $prefix = 'ns-' . substr(sha1($namespace), 0, 8); |
|
610 | + if ( ! $prefix = $node->lookupPrefix($namespace)) { |
|
611 | + $prefix = 'ns-'.substr(sha1($namespace), 0, 8); |
|
612 | 612 | } |
613 | 613 | |
614 | - $node->setAttributeNS($namespace, $prefix . ':' . $name, $value); |
|
614 | + $node->setAttributeNS($namespace, $prefix.':'.$name, $value); |
|
615 | 615 | } else { |
616 | 616 | $node->setAttribute($name, $value); |
617 | 617 | } |