Completed
Push — master ( 745aeb...25b5eb )
by Marcin
46s queued 41s
created
src/XmlDeserializationVisitor.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
         }
329 329
 
330 330
         if ($metadata->xmlValue) {
331
-            if (!$metadata->type) {
331
+            if ( ! $metadata->type) {
332 332
                 throw RuntimeException::noMetadataForProperty($metadata->class, $metadata->name);
333 333
             }
334 334
 
@@ -337,12 +337,12 @@  discard block
 block discarded – undo
337 337
 
338 338
         if ($metadata->xmlCollection) {
339 339
             $enclosingElem = $data;
340
-            if (!$metadata->xmlCollectionInline) {
340
+            if ( ! $metadata->xmlCollectionInline) {
341 341
                 $enclosingElem = $data->children($metadata->xmlNamespace)->$name;
342 342
             }
343 343
 
344 344
             $this->setCurrentMetadata($metadata);
345
-            if (!$metadata->type) {
345
+            if ( ! $metadata->type) {
346 346
                 throw RuntimeException::noMetadataForProperty($metadata->class, $metadata->name);
347 347
             }
348 348
 
@@ -354,13 +354,13 @@  discard block
 block discarded – undo
354 354
 
355 355
         if ($metadata->xmlNamespace) {
356 356
             $node = $data->children($metadata->xmlNamespace)->$name;
357
-            if (!$node->count()) {
357
+            if ( ! $node->count()) {
358 358
                 throw new NotAcceptableException();
359 359
             }
360 360
         } elseif ('' === $metadata->xmlNamespace) {
361 361
             // See #1087 - element must be like: <element xmlns="" /> - https://www.w3.org/TR/REC-xml-names/#iri-use
362 362
             // Use of an empty string in a namespace declaration turns it into an "undeclaration".
363
-            $nodes = $data->xpath('./' . $name);
363
+            $nodes = $data->xpath('./'.$name);
364 364
             if (empty($nodes)) {
365 365
                 throw new NotAcceptableException();
366 366
             }
@@ -371,9 +371,9 @@  discard block
 block discarded – undo
371 371
             if (isset($namespaces[''])) {
372 372
                 $prefix = uniqid('ns-');
373 373
                 $data->registerXPathNamespace($prefix, $namespaces['']);
374
-                $nodes = $data->xpath('./' . $prefix . ':' . $name);
374
+                $nodes = $data->xpath('./'.$prefix.':'.$name);
375 375
             } else {
376
-                $nodes = $data->xpath('./' . $name);
376
+                $nodes = $data->xpath('./'.$name);
377 377
             }
378 378
 
379 379
             if (empty($nodes)) {
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
             $this->setCurrentMetadata($metadata);
388 388
         }
389 389
 
390
-        if (!$metadata->type) {
390
+        if ( ! $metadata->type) {
391 391
             throw RuntimeException::noMetadataForProperty($metadata->class, $metadata->name);
392 392
         }
393 393
 
Please login to merge, or discard this patch.
src/Handler/DateHandler.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
                     'type' => $type,
48 48
                     'format' => $format,
49 49
                     'direction' => GraphNavigatorInterface::DIRECTION_SERIALIZATION,
50
-                    'method' => 'serialize' . $type,
50
+                    'method' => 'serialize'.$type,
51 51
                 ];
52 52
             }
53 53
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
                 'type' => \DateTimeInterface::class,
56 56
                 'direction' => GraphNavigatorInterface::DIRECTION_DESERIALIZATION,
57 57
                 'format' => $format,
58
-                'method' => 'deserializeDateTimeFrom' . ucfirst($format),
58
+                'method' => 'deserializeDateTimeFrom'.ucfirst($format),
59 59
             ];
60 60
 
61 61
             $methods[] = [
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
      */
232 232
     private function parseDateTime($data, array $type, bool $immutable = false): \DateTimeInterface
233 233
     {
234
-        $timezone = !empty($type['params'][1]) ? new \DateTimeZone($type['params'][1]) : $this->defaultTimezone;
234
+        $timezone = ! empty($type['params'][1]) ? new \DateTimeZone($type['params'][1]) : $this->defaultTimezone;
235 235
         $formats = $this->getDeserializationFormats($type);
236 236
 
237 237
         $formatTried = [];
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
         throw new RuntimeException(sprintf(
257 257
             'Invalid datetime "%s", expected one of the format %s.',
258 258
             $data,
259
-            '"' . implode('", "', $formatTried) . '"',
259
+            '"'.implode('", "', $formatTried).'"',
260 260
         ));
261 261
     }
262 262
 
@@ -304,15 +304,15 @@  discard block
 block discarded – undo
304 304
         $format = 'P';
305 305
 
306 306
         if (0 < $dateInterval->y) {
307
-            $format .= $dateInterval->y . 'Y';
307
+            $format .= $dateInterval->y.'Y';
308 308
         }
309 309
 
310 310
         if (0 < $dateInterval->m) {
311
-            $format .= $dateInterval->m . 'M';
311
+            $format .= $dateInterval->m.'M';
312 312
         }
313 313
 
314 314
         if (0 < $dateInterval->d) {
315
-            $format .= $dateInterval->d . 'D';
315
+            $format .= $dateInterval->d.'D';
316 316
         }
317 317
 
318 318
         if (0 < $dateInterval->h || 0 < $dateInterval->i || 0 < $dateInterval->s) {
@@ -320,15 +320,15 @@  discard block
 block discarded – undo
320 320
         }
321 321
 
322 322
         if (0 < $dateInterval->h) {
323
-            $format .= $dateInterval->h . 'H';
323
+            $format .= $dateInterval->h.'H';
324 324
         }
325 325
 
326 326
         if (0 < $dateInterval->i) {
327
-            $format .= $dateInterval->i . 'M';
327
+            $format .= $dateInterval->i.'M';
328 328
         }
329 329
 
330 330
         if (0 < $dateInterval->s) {
331
-            $format .= $dateInterval->s . 'S';
331
+            $format .= $dateInterval->s.'S';
332 332
         }
333 333
 
334 334
         if ('P' === $format) {
Please login to merge, or discard this patch.
src/Annotation/Type.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
 
22 22
     public function __construct($values = [], $name = null)
23 23
     {
24
-        if ((null !== $name) && !is_string($name) && !(is_object($name) && method_exists($name, '__toString'))) {
24
+        if ((null !== $name) && ! is_string($name) && ! (is_object($name) && method_exists($name, '__toString'))) {
25 25
             throw new \RuntimeException(
26 26
                 'Type must be either string, null or object implements __toString() method.',
27 27
             );
Please login to merge, or discard this patch.
src/Metadata/Driver/DocBlockDriver/DocBlockTypeResolver.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
         if ($type instanceof ArrayTypeNode) {
110 110
             $resolvedType = $this->resolveTypeFromTypeNode($type->type, $reflector);
111 111
 
112
-            return 'array<' . $resolvedType . '>';
112
+            return 'array<'.$resolvedType.'>';
113 113
         }
114 114
 
115 115
         // Generic array syntax: array<Product> | array<\Foo\Bar\Product> | array<int,Product>
@@ -117,13 +117,13 @@  discard block
 block discarded – undo
117 117
             if ($this->isSimpleType($type->type, 'array')) {
118 118
                 $resolvedTypes = array_map(fn (TypeNode $node) => $this->resolveTypeFromTypeNode($node, $reflector), $type->genericTypes);
119 119
 
120
-                return 'array<' . implode(',', $resolvedTypes) . '>';
120
+                return 'array<'.implode(',', $resolvedTypes).'>';
121 121
             }
122 122
 
123 123
             if ($this->isSimpleType($type->type, 'list')) {
124 124
                 $resolvedTypes = array_map(fn (TypeNode $node) => $this->resolveTypeFromTypeNode($node, $reflector), $type->genericTypes);
125 125
 
126
-                return 'array<int, ' . implode(',', $resolvedTypes) . '>';
126
+                return 'array<int, '.implode(',', $resolvedTypes).'>';
127 127
             }
128 128
 
129 129
             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()));
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
             return [];
147 147
         }
148 148
 
149
-        return array_merge(...array_map(static function ($node) {
149
+        return array_merge(...array_map(static function($node) {
150 150
             if ($node->type instanceof UnionTypeNode) {
151 151
                 return $node->type->types;
152 152
             }
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
      */
232 232
     private function resolveTypeFromTypeNode(TypeNode $typeNode, $reflector): string
233 233
     {
234
-        if (!($typeNode instanceof IdentifierTypeNode)) {
234
+        if ( ! ($typeNode instanceof IdentifierTypeNode)) {
235 235
             throw new \InvalidArgumentException(sprintf("Can't use unsupported type %s for collection in %s:%s", (string) $typeNode, $reflector->getDeclaringClass()->getName(), $reflector->getName()));
236 236
         }
237 237
 
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
      */
244 244
     private function expandClassNameUsingUseStatements(string $typeHint, \ReflectionClass $declaringClass, $reflector): string
245 245
     {
246
-        $expandedClassName = $declaringClass->getNamespaceName() . '\\' . $typeHint;
246
+        $expandedClassName = $declaringClass->getNamespaceName().'\\'.$typeHint;
247 247
         if ($this->isClassOrInterface($expandedClassName)) {
248 248
             return $expandedClassName;
249 249
         }
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 
282 282
     private function endsWith(string $statementClassToCheck, string $typeHintToSearchFor): bool
283 283
     {
284
-        $typeHintToSearchFor = '\\' . $typeHintToSearchFor;
284
+        $typeHintToSearchFor = '\\'.$typeHintToSearchFor;
285 285
 
286 286
         return substr($statementClassToCheck, -strlen($typeHintToSearchFor)) === $typeHintToSearchFor;
287 287
     }
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
         preg_match_all(self::GROUP_USE_STATEMENTS_REGEX, $classContents, $foundGroupUseStatements);
303 303
         for ($useStatementIndex = 0; $useStatementIndex < count($foundGroupUseStatements[0]); $useStatementIndex++) {
304 304
             foreach (explode(',', $foundGroupUseStatements[2][$useStatementIndex]) as $singleUseStatement) {
305
-                $foundUseStatements[] = trim($foundGroupUseStatements[1][$useStatementIndex]) . trim($singleUseStatement);
305
+                $foundUseStatements[] = trim($foundGroupUseStatements[1][$useStatementIndex]).trim($singleUseStatement);
306 306
             }
307 307
         }
308 308
 
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
      */
342 342
     private function resolveType(string $typeHint, $reflector): string
343 343
     {
344
-        if (!$this->hasGlobalNamespacePrefix($typeHint) && !$this->isPrimitiveType($typeHint)) {
344
+        if ( ! $this->hasGlobalNamespacePrefix($typeHint) && ! $this->isPrimitiveType($typeHint)) {
345 345
             $typeHint = $this->expandClassNameUsingUseStatements($typeHint, $this->getDeclaringClassOrTrait($reflector), $reflector);
346 346
         }
347 347
 
@@ -359,15 +359,15 @@  discard block
 block discarded – undo
359 359
     private function resolveTypeFromDocblock($reflector): array
360 360
     {
361 361
         $docComment = $reflector->getDocComment();
362
-        if (!$docComment && PHP_VERSION_ID >= 80000 && $reflector instanceof \ReflectionProperty && $reflector->isPromoted()) {
362
+        if ( ! $docComment && PHP_VERSION_ID >= 80000 && $reflector instanceof \ReflectionProperty && $reflector->isPromoted()) {
363 363
             $constructor = $reflector->getDeclaringClass()->getConstructor();
364
-            if (!$constructor) {
364
+            if ( ! $constructor) {
365 365
                 return [];
366 366
             }
367 367
 
368 368
             $docComment = $constructor->getDocComment();
369 369
 
370
-            if (!$docComment) {
370
+            if ( ! $docComment) {
371 371
                 return [];
372 372
             }
373 373
 
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
             return $this->flattenParamTagValueTypes($reflector->getName(), $phpDocNode->getParamTagValues());
378 378
         }
379 379
 
380
-        if (!$docComment) {
380
+        if ( ! $docComment) {
381 381
             return [];
382 382
         }
383 383
 
Please login to merge, or discard this patch.
src/Metadata/Driver/AttributeDriver/AttributeReader.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@
 block discarded – undo
72 72
      */
73 73
     private function buildAnnotation(array $attributes): ?SerializerAttribute
74 74
     {
75
-        if (!isset($attributes[0])) {
75
+        if ( ! isset($attributes[0])) {
76 76
             return null;
77 77
         }
78 78
 
Please login to merge, or discard this patch.
src/Metadata/Driver/AnnotationOrAttributeDriver.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
         $configured = false;
82 82
 
83 83
         $classMetadata = new ClassMetadata($name = $class->name);
84
-        $fileResource =  $class->getFilename();
84
+        $fileResource = $class->getFilename();
85 85
 
86 86
         if (false !== $fileResource) {
87 87
             $classMetadata->fileResources[] = $fileResource;
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
             }
168 168
         }
169 169
 
170
-        if (!$excludeAll) {
170
+        if ( ! $excludeAll) {
171 171
             foreach ($class->getProperties() as $property) {
172 172
                 if ($property->class !== $name || (isset($property->info) && $property->info['class'] !== $name)) {
173 173
                     continue;
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
                     } elseif ($annot instanceof Expose) {
202 202
                         $isExpose = true;
203 203
                         if (null !== $annot->if) {
204
-                            $propertyMetadata->excludeIf = $this->parseExpression('!(' . $annot->if . ')');
204
+                            $propertyMetadata->excludeIf = $this->parseExpression('!('.$annot->if.')');
205 205
                         }
206 206
                     } elseif ($annot instanceof Exclude) {
207 207
                         if (null !== $annot->if) {
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
                                 throw new InvalidMetadataException(sprintf(
249 249
                                     'Invalid group name "%s" on "%s", did you mean to create multiple groups?',
250 250
                                     implode(', ', $propertyMetadata->groups),
251
-                                    $propertyMetadata->class . '->' . $propertyMetadata->name,
251
+                                    $propertyMetadata->class.'->'.$propertyMetadata->name,
252 252
                                 ));
253 253
                             }
254 254
                         }
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
                     }
271 271
                 }
272 272
 
273
-                if (!$propertyMetadata->serializedName) {
273
+                if ( ! $propertyMetadata->serializedName) {
274 274
                     $propertyMetadata->serializedName = $this->namingStrategy->translateName($propertyMetadata);
275 275
                 }
276 276
 
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
                 }
282 282
 
283 283
                 if (
284
-                    (ExclusionPolicy::NONE === $exclusionPolicy && !$isExclude)
284
+                    (ExclusionPolicy::NONE === $exclusionPolicy && ! $isExclude)
285 285
                     || (ExclusionPolicy::ALL === $exclusionPolicy && $isExpose)
286 286
                 ) {
287 287
                     $propertyMetadata->setAccessor($accessType, $accessor[0], $accessor[1]);
Please login to merge, or discard this patch.
src/Accessor/DefaultAccessorStrategy.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -132,7 +132,7 @@
 block discarded – undo
132 132
 
133 133
         $accessor = $this->writeAccessors[$metadata->class] ?? null;
134 134
         if (null === $accessor) {
135
-            $accessor = \Closure::bind(static function ($o, $name, $value): void {
135
+            $accessor = \Closure::bind(static function($o, $name, $value): void {
136 136
                 $o->$name = $value;
137 137
             }, null, $metadata->class);
138 138
             $this->writeAccessors[$metadata->class] = $accessor;
Please login to merge, or discard this patch.
src/XmlSerializationVisitor.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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 = $metadata->xmlNamespace ?? $this->getClassDefaultNamespace($this->objectMetadataStack->top());
322 322
 
323 323
             $element = $this->createElement($metadata->serializedName, $namespace);
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 
361 361
     private function isSkippableEmptyObject(?\DOMElement $node, PropertyMetadata $metadata): bool
362 362
     {
363
-        return null === $node && !$metadata->xmlCollection && $metadata->skipWhenEmpty;
363
+        return null === $node && ! $metadata->xmlCollection && $metadata->skipWhenEmpty;
364 364
     }
365 365
 
366 366
     private function isSkippableCollection(PropertyMetadata $metadata): bool
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
 
371 371
     private function isElementEmpty(\DOMElement $element): bool
372 372
     {
373
-        return !$element->hasChildNodes() && !$element->hasAttributes();
373
+        return ! $element->hasChildNodes() && ! $element->hasAttributes();
374 374
     }
375 375
 
376 376
     public function endVisitingObject(ClassMetadata $metadata, object $data, array $type): void
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
         foreach ($metadata->xmlNamespaces as $prefix => $uri) {
476 476
             $attribute = 'xmlns';
477 477
             if ('' !== $prefix) {
478
-                $attribute .= ':' . $prefix;
478
+                $attribute .= ':'.$prefix;
479 479
             } elseif ($element->namespaceURI === $uri) {
480 480
                 continue;
481 481
             }
@@ -505,21 +505,21 @@  discard block
 block discarded – undo
505 505
             return $this->document->createElementNS($namespace, $tagName);
506 506
         }
507 507
 
508
-        if (!($prefix = $this->currentNode->lookupPrefix($namespace)) && !($prefix = $this->document->lookupPrefix($namespace))) {
509
-            $prefix = 'ns-' . substr(sha1($namespace), 0, 8);
508
+        if ( ! ($prefix = $this->currentNode->lookupPrefix($namespace)) && ! ($prefix = $this->document->lookupPrefix($namespace))) {
509
+            $prefix = 'ns-'.substr(sha1($namespace), 0, 8);
510 510
         }
511 511
 
512
-        return $this->document->createElementNS($namespace, $prefix . ':' . $tagName);
512
+        return $this->document->createElementNS($namespace, $prefix.':'.$tagName);
513 513
     }
514 514
 
515 515
     private function setAttributeOnNode(\DOMElement $node, string $name, string $value, ?string $namespace = null): void
516 516
     {
517 517
         if (null !== $namespace) {
518
-            if (!$prefix = $node->lookupPrefix($namespace)) {
519
-                $prefix = 'ns-' . substr(sha1($namespace), 0, 8);
518
+            if ( ! $prefix = $node->lookupPrefix($namespace)) {
519
+                $prefix = 'ns-'.substr(sha1($namespace), 0, 8);
520 520
             }
521 521
 
522
-            $node->setAttributeNS($namespace, $prefix . ':' . $name, $value);
522
+            $node->setAttributeNS($namespace, $prefix.':'.$name, $value);
523 523
         } else {
524 524
             $node->setAttribute($name, $value);
525 525
         }
Please login to merge, or discard this patch.
src/Handler/EnumHandler.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
         array $type,
45 45
         SerializationContext $context
46 46
     ) {
47
-        if ((isset($type['params'][1]) && 'value' === $type['params'][1]) || (!isset($type['params'][1]) && $enum instanceof \BackedEnum)) {
48
-            if (!$enum instanceof \BackedEnum) {
47
+        if ((isset($type['params'][1]) && 'value' === $type['params'][1]) || ( ! isset($type['params'][1]) && $enum instanceof \BackedEnum)) {
48
+            if ( ! $enum instanceof \BackedEnum) {
49 49
                 throw new InvalidMetadataException(sprintf('The type "%s" is not a backed enum, thus you can not use "value" as serialization mode for its value.', get_class($enum)));
50 50
             }
51 51
 
@@ -67,13 +67,13 @@  discard block
 block discarded – undo
67 67
         $caseValue = (string) $data;
68 68
 
69 69
         $ref = new \ReflectionEnum($enumType);
70
-        if (isset($type['params'][1]) && 'value' === $type['params'][1] || (!isset($type['params'][1]) && is_a($enumType, \BackedEnum::class, true))) {
71
-            if (!is_a($enumType, \BackedEnum::class, true)) {
70
+        if (isset($type['params'][1]) && 'value' === $type['params'][1] || ( ! isset($type['params'][1]) && is_a($enumType, \BackedEnum::class, true))) {
71
+            if ( ! is_a($enumType, \BackedEnum::class, true)) {
72 72
                 throw new InvalidMetadataException(sprintf('The type "%s" is not a backed enum, thus you can not use "value" as serialization mode for its value.', $enumType));
73 73
             }
74 74
 
75 75
             if ('int' === $ref->getBackingType()->getName()) {
76
-                if (!is_numeric($caseValue)) {
76
+                if ( ! is_numeric($caseValue)) {
77 77
                     throw new RuntimeException(sprintf('"%s" is not a valid backing value for enum "%s"', $caseValue, $enumType));
78 78
                 }
79 79
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 
83 83
             return $enumType::from($caseValue);
84 84
         } else {
85
-            if (!$ref->hasCase($caseValue)) {
85
+            if ( ! $ref->hasCase($caseValue)) {
86 86
                 throw new InvalidMetadataException(sprintf('The type "%s" does not have the case "%s"', $ref->getName(), $caseValue));
87 87
             }
88 88
 
Please login to merge, or discard this patch.