Completed
Push — master ( b48dc5...46c1ee )
by Marcin
22s queued 19s
created
src/Metadata/Driver/YamlDriver.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
      */
71 71
     public function getAllClassNames(): array
72 72
     {
73
-        if (!$this->locator instanceof AdvancedFileLocatorInterface) {
73
+        if ( ! $this->locator instanceof AdvancedFileLocatorInterface) {
74 74
             throw new RuntimeException(
75 75
                 sprintf(
76 76
                     'Locator "%s" must be an instance of "AdvancedFileLocatorInterface".',
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
     {
94 94
         $config = Yaml::parseFile($file, Yaml::PARSE_CONSTANT);
95 95
 
96
-        if (!isset($config[$name = $class->name])) {
96
+        if ( ! isset($config[$name = $class->name])) {
97 97
             throw new InvalidMetadataException(
98 98
                 sprintf('Expected metadata for class %s to be defined in %s.', $class->name, $file),
99 99
             );
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
                     );
131 131
                     unset($propertySettings['exp']);
132 132
                 } else {
133
-                    if (!$class->hasMethod($methodName)) {
133
+                    if ( ! $class->hasMethod($methodName)) {
134 134
                         throw new InvalidMetadataException(
135
-                            'The method ' . $methodName . ' not found in class ' . $class->name,
135
+                            'The method '.$methodName.' not found in class '.$class->name,
136 136
                         );
137 137
                     }
138 138
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
             }
145 145
         }
146 146
 
147
-        if (!$excludeAll) {
147
+        if ( ! $excludeAll) {
148 148
             foreach ($class->getProperties() as $property) {
149 149
                 if ($property->class !== $name || (isset($property->info) && $property->info['class'] !== $name)) {
150 150
                     continue;
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 
153 153
                 $pName = $property->getName();
154 154
                 $propertiesMetadata[] = new PropertyMetadata($name, $pName);
155
-                $propertiesData[] =  !empty($config['properties']) && true === array_key_exists($pName, $config['properties'])
155
+                $propertiesData[] = ! empty($config['properties']) && true === array_key_exists($pName, $config['properties'])
156 156
                     ? (array) $config['properties'][$pName]
157 157
                     : null;
158 158
             }
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
                     || isset($propertiesData[$propertyKey]);
165 165
 
166 166
                 $pConfig = $propertiesData[$propertyKey];
167
-                if (!empty($pConfig)) {
167
+                if ( ! empty($pConfig)) {
168 168
                     if (isset($pConfig['exclude'])) {
169 169
                         $isExclude = (bool) $pConfig['exclude'];
170 170
                     }
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
                     }
195 195
 
196 196
                     if (isset($pConfig['expose_if'])) {
197
-                        $pMetadata->excludeIf = $this->parseExpression('!(' . $pConfig['expose_if'] . ')');
197
+                        $pMetadata->excludeIf = $this->parseExpression('!('.$pConfig['expose_if'].')');
198 198
                     }
199 199
 
200 200
                     if (isset($pConfig['serialized_name'])) {
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
                     }
303 303
                 }
304 304
 
305
-                if (!$pMetadata->serializedName) {
305
+                if ( ! $pMetadata->serializedName) {
306 306
                     $pMetadata->serializedName = $this->namingStrategy->translateName($pMetadata);
307 307
                 }
308 308
 
@@ -311,12 +311,12 @@  discard block
 block discarded – undo
311 311
                     $metadata->isMap = $metadata->isMap || PropertyMetadata::isCollectionMap($pMetadata->type);
312 312
                 }
313 313
 
314
-                if (!empty($pConfig) && !empty($pConfig['name'])) {
314
+                if ( ! empty($pConfig) && ! empty($pConfig['name'])) {
315 315
                     $pMetadata->name = (string) $pConfig['name'];
316 316
                 }
317 317
 
318 318
                 if (
319
-                    (ExclusionPolicy::NONE === $exclusionPolicy && !$isExclude)
319
+                    (ExclusionPolicy::NONE === $exclusionPolicy && ! $isExclude)
320 320
                     || (ExclusionPolicy::ALL === $exclusionPolicy && $isExpose)
321 321
                 ) {
322 322
                     $metadata->addPropertyMetadata($pMetadata);
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
 
362 362
     private function addClassProperties(ClassMetadata $metadata, array $config): void
363 363
     {
364
-        if (isset($config['custom_accessor_order']) && !isset($config['accessor_order'])) {
364
+        if (isset($config['custom_accessor_order']) && ! isset($config['accessor_order'])) {
365 365
             $config['accessor_order'] = 'custom';
366 366
         }
367 367
 
@@ -391,11 +391,11 @@  discard block
 block discarded – undo
391 391
             if (isset($config['discriminator']['disabled']) && true === $config['discriminator']['disabled']) {
392 392
                 $metadata->discriminatorDisabled = true;
393 393
             } else {
394
-                if (!isset($config['discriminator']['field_name'])) {
394
+                if ( ! isset($config['discriminator']['field_name'])) {
395 395
                     throw new InvalidMetadataException('The "field_name" attribute must be set for discriminators.');
396 396
                 }
397 397
 
398
-                if (!isset($config['discriminator']['map']) || !is_array($config['discriminator']['map'])) {
398
+                if ( ! isset($config['discriminator']['map']) || ! is_array($config['discriminator']['map'])) {
399 399
                     throw new InvalidMetadataException(
400 400
                         'The "map" attribute must be set, and be an array for discriminators.',
401 401
                     );
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
     {
433 433
         if (is_string($config)) {
434 434
             $config = [$config];
435
-        } elseif (!is_array($config)) {
435
+        } elseif ( ! is_array($config)) {
436 436
             throw new InvalidMetadataException(
437 437
                 sprintf(
438 438
                     'callback methods expects a string, or an array of strings that represent method names, but got %s.',
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
 
444 444
         $methods = [];
445 445
         foreach ($config as $name) {
446
-            if (!$class->hasMethod($name)) {
446
+            if ( ! $class->hasMethod($name)) {
447 447
                 throw new InvalidMetadataException(
448 448
                     sprintf('The method %s does not exist in class %s.', $name, $class->name),
449 449
                 );
Please login to merge, or discard this patch.
src/Metadata/Driver/XmlDriver.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -58,14 +58,14 @@  discard block
 block discarded – undo
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
         }
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         $discriminatorFieldName = (string) $elem->attributes()->{'discriminator-field-name'};
105 105
         $discriminatorMap = [];
106 106
         foreach ($elem->xpath('./discriminator-class') as $entry) {
107
-            if (!isset($entry->attributes()->value)) {
107
+            if ( ! isset($entry->attributes()->value)) {
108 108
                 throw new InvalidMetadataException('Each discriminator-class element must have a "value" attribute.');
109 109
             }
110 110
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 
114 114
         if ('true' === (string) $elem->attributes()->{'discriminator-disabled'}) {
115 115
             $metadata->discriminatorDisabled = true;
116
-        } elseif (!empty($discriminatorFieldName) || !empty($discriminatorMap)) {
116
+        } elseif ( ! empty($discriminatorFieldName) || ! empty($discriminatorMap)) {
117 117
             $discriminatorGroups = [];
118 118
             foreach ($elem->xpath('./discriminator-groups/group') as $entry) {
119 119
                 $discriminatorGroups[] = (string) $entry;
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         }
124 124
 
125 125
         foreach ($elem->xpath('./xml-namespace') as $xmlNamespace) {
126
-            if (!isset($xmlNamespace->attributes()->uri)) {
126
+            if ( ! isset($xmlNamespace->attributes()->uri)) {
127 127
                 throw new InvalidMetadataException('The prefix attribute must be set for all xml-namespace elements.');
128 128
             }
129 129
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
                     $this->parseExpression((string) $method->attributes()->expression),
159 159
                 );
160 160
             } else {
161
-                if (!isset($method->attributes()->method)) {
161
+                if ( ! isset($method->attributes()->method)) {
162 162
                     throw new InvalidMetadataException('The method attribute must be set for all virtual-property elements.');
163 163
                 }
164 164
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
             $propertiesNodes[] = $method;
170 170
         }
171 171
 
172
-        if (!$excludeAll) {
172
+        if ( ! $excludeAll) {
173 173
             foreach ($class->getProperties() as $property) {
174 174
                 if ($property->class !== $name || (isset($property->info) && $property->info['class'] !== $name)) {
175 175
                     continue;
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
                 $pName = $property->getName();
179 179
                 $propertiesMetadata[] = new PropertyMetadata($name, $pName);
180 180
 
181
-                $pElems = $elem->xpath("./property[@name = '" . $pName . "']");
181
+                $pElems = $elem->xpath("./property[@name = '".$pName."']");
182 182
                 $propertiesNodes[] = $pElems ? reset($pElems) : null;
183 183
             }
184 184
 
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
                     || isset($propertiesNodes[$propertyKey]);
190 190
 
191 191
                 $pElem = $propertiesNodes[$propertyKey];
192
-                if (!empty($pElem)) {
192
+                if ( ! empty($pElem)) {
193 193
                     if (null !== $exclude = $pElem->attributes()->exclude) {
194 194
                         $isExclude = 'true' === strtolower((string) $exclude);
195 195
                     }
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
                     }
212 212
 
213 213
                     if (null !== $excludeIf = $pElem->attributes()->{'expose-if'}) {
214
-                        $pMetadata->excludeIf = $this->parseExpression('!(' . (string) $excludeIf . ')');
214
+                        $pMetadata->excludeIf = $this->parseExpression('!('.(string) $excludeIf.')');
215 215
                         $isExpose = true;
216 216
                     }
217 217
 
@@ -339,16 +339,16 @@  discard block
 block discarded – undo
339 339
                     $metadata->isMap = $metadata->isMap || PropertyMetadata::isCollectionMap($pMetadata->type);
340 340
                 }
341 341
 
342
-                if (!$pMetadata->serializedName) {
342
+                if ( ! $pMetadata->serializedName) {
343 343
                     $pMetadata->serializedName = $this->namingStrategy->translateName($pMetadata);
344 344
                 }
345 345
 
346
-                if (!empty($pElem) && null !== $name = $pElem->attributes()->name) {
346
+                if ( ! empty($pElem) && null !== $name = $pElem->attributes()->name) {
347 347
                     $pMetadata->name = (string) $name;
348 348
                 }
349 349
 
350 350
                 if (
351
-                    (ExclusionPolicy::NONE === (string) $exclusionPolicy && !$isExclude)
351
+                    (ExclusionPolicy::NONE === (string) $exclusionPolicy && ! $isExclude)
352 352
                     || (ExclusionPolicy::ALL === (string) $exclusionPolicy && $isExpose)
353 353
                 ) {
354 354
                     $metadata->addPropertyMetadata($pMetadata);
@@ -357,11 +357,11 @@  discard block
 block discarded – undo
357 357
         }
358 358
 
359 359
         foreach ($elem->xpath('./callback-method') as $method) {
360
-            if (!isset($method->attributes()->type)) {
360
+            if ( ! isset($method->attributes()->type)) {
361 361
                 throw new InvalidMetadataException('The type attribute must be set for all callback-method elements.');
362 362
             }
363 363
 
364
-            if (!isset($method->attributes()->name)) {
364
+            if ( ! isset($method->attributes()->name)) {
365 365
                 throw new InvalidMetadataException('The name attribute must be set for all callback-method elements.');
366 366
             }
367 367
 
@@ -379,11 +379,11 @@  discard block
 block discarded – undo
379 379
                     break;
380 380
 
381 381
                 case 'handler':
382
-                    if (!isset($method->attributes()->format)) {
382
+                    if ( ! isset($method->attributes()->format)) {
383 383
                         throw new InvalidMetadataException('The format attribute must be set for "handler" callback methods.');
384 384
                     }
385 385
 
386
-                    if (!isset($method->attributes()->direction)) {
386
+                    if ( ! isset($method->attributes()->direction)) {
387 387
                         throw new InvalidMetadataException('The direction attribute must be set for "handler" callback methods.');
388 388
                     }
389 389
 
Please login to merge, or discard this patch.
src/Type/Parser.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     {
38 38
         $this->lexer->moveNext();
39 39
 
40
-        if (!$this->lexer->token) {
40
+        if ( ! $this->lexer->token) {
41 41
             throw new SyntaxError(
42 42
                 'Syntax error, unexpected end of stream',
43 43
             );
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
             }
60 60
 
61 61
             return $this->visitSimpleType();
62
-        } elseif (!$this->root && Lexer::T_ARRAY_START === $this->lexer->token->type) {
62
+        } elseif ( ! $this->root && Lexer::T_ARRAY_START === $this->lexer->token->type) {
63 63
             return $this->visitArrayType();
64 64
         }
65 65
 
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
         $this->match(Lexer::T_TYPE_START);
88 88
 
89 89
         $params = [];
90
-        if (!$this->lexer->isNextToken(Lexer::T_TYPE_END)) {
90
+        if ( ! $this->lexer->isNextToken(Lexer::T_TYPE_END)) {
91 91
             while (true) {
92 92
                 $params[] = $this->visit();
93 93
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
          */
116 116
 
117 117
         $params = [];
118
-        if (!$this->lexer->isNextToken(Lexer::T_ARRAY_END)) {
118
+        if ( ! $this->lexer->isNextToken(Lexer::T_ARRAY_END)) {
119 119
             while (true) {
120 120
                 $params[] = $this->visit();
121 121
                 if ($this->lexer->isNextToken(Lexer::T_ARRAY_END)) {
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 
134 134
     private function match(int $token): void
135 135
     {
136
-        if (!$this->lexer->lookahead) {
136
+        if ( ! $this->lexer->lookahead) {
137 137
             throw new SyntaxError(
138 138
                 sprintf('Syntax error, unexpected end of stream, expected %s', $this->getConstant($token)),
139 139
             );
Please login to merge, or discard this patch.
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.