Passed
Pull Request — master (#1609)
by Ivan
02:48
created
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
         }
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
         $discriminatorDefaultClass = (string) $elem->attributes()->{'discriminator-default-class'};
106 106
         $discriminatorMap = [];
107 107
         foreach ($elem->xpath('./discriminator-class') as $entry) {
108
-            if (!isset($entry->attributes()->value)) {
108
+            if ( ! isset($entry->attributes()->value)) {
109 109
                 throw new InvalidMetadataException('Each discriminator-class element must have a "value" attribute.');
110 110
             }
111 111
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 
115 115
         if ('true' === (string) $elem->attributes()->{'discriminator-disabled'}) {
116 116
             $metadata->discriminatorDisabled = true;
117
-        } elseif (!empty($discriminatorFieldName) || !empty($discriminatorMap)) {
117
+        } elseif ( ! empty($discriminatorFieldName) || ! empty($discriminatorMap)) {
118 118
             $discriminatorGroups = [];
119 119
             foreach ($elem->xpath('./discriminator-groups/group') as $entry) {
120 120
                 $discriminatorGroups[] = (string) $entry;
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
         }
130 130
 
131 131
         foreach ($elem->xpath('./xml-namespace') as $xmlNamespace) {
132
-            if (!isset($xmlNamespace->attributes()->uri)) {
132
+            if ( ! isset($xmlNamespace->attributes()->uri)) {
133 133
                 throw new InvalidMetadataException('The prefix attribute must be set for all xml-namespace elements.');
134 134
             }
135 135
 
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
                     $this->parseExpression((string) $method->attributes()->expression),
165 165
                 );
166 166
             } else {
167
-                if (!isset($method->attributes()->method)) {
167
+                if ( ! isset($method->attributes()->method)) {
168 168
                     throw new InvalidMetadataException('The method attribute must be set for all virtual-property elements.');
169 169
                 }
170 170
 
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
             $propertiesNodes[] = $method;
176 176
         }
177 177
 
178
-        if (!$excludeAll) {
178
+        if ( ! $excludeAll) {
179 179
             foreach ($class->getProperties() as $property) {
180 180
                 if ($property->class !== $name || (isset($property->info) && $property->info['class'] !== $name)) {
181 181
                     continue;
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
                 $pName = $property->getName();
185 185
                 $propertiesMetadata[] = new PropertyMetadata($name, $pName);
186 186
 
187
-                $pElems = $elem->xpath("./property[@name = '" . $pName . "']");
187
+                $pElems = $elem->xpath("./property[@name = '".$pName."']");
188 188
                 $propertiesNodes[] = $pElems ? reset($pElems) : null;
189 189
             }
190 190
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
                     || isset($propertiesNodes[$propertyKey]);
196 196
 
197 197
                 $pElem = $propertiesNodes[$propertyKey];
198
-                if (!empty($pElem)) {
198
+                if ( ! empty($pElem)) {
199 199
                     if (null !== $exclude = $pElem->attributes()->exclude) {
200 200
                         $isExclude = 'true' === strtolower((string) $exclude);
201 201
                     }
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
                     }
218 218
 
219 219
                     if (null !== $excludeIf = $pElem->attributes()->{'expose-if'}) {
220
-                        $pMetadata->excludeIf = $this->parseExpression('!(' . (string) $excludeIf . ')');
220
+                        $pMetadata->excludeIf = $this->parseExpression('!('.(string) $excludeIf.')');
221 221
                         $isExpose = true;
222 222
                     }
223 223
 
@@ -359,16 +359,16 @@  discard block
 block discarded – undo
359 359
                     $metadata->isMap = $metadata->isMap || PropertyMetadata::isCollectionMap($pMetadata->type);
360 360
                 }
361 361
 
362
-                if (!$pMetadata->serializedName) {
362
+                if ( ! $pMetadata->serializedName) {
363 363
                     $pMetadata->serializedName = $this->namingStrategy->translateName($pMetadata);
364 364
                 }
365 365
 
366
-                if (!empty($pElem) && null !== $name = $pElem->attributes()->name) {
366
+                if ( ! empty($pElem) && null !== $name = $pElem->attributes()->name) {
367 367
                     $pMetadata->name = (string) $name;
368 368
                 }
369 369
 
370 370
                 if (
371
-                    (ExclusionPolicy::NONE === (string) $exclusionPolicy && !$isExclude)
371
+                    (ExclusionPolicy::NONE === (string) $exclusionPolicy && ! $isExclude)
372 372
                     || (ExclusionPolicy::ALL === (string) $exclusionPolicy && $isExpose)
373 373
                 ) {
374 374
                     $metadata->addPropertyMetadata($pMetadata);
@@ -377,11 +377,11 @@  discard block
 block discarded – undo
377 377
         }
378 378
 
379 379
         foreach ($elem->xpath('./callback-method') as $method) {
380
-            if (!isset($method->attributes()->type)) {
380
+            if ( ! isset($method->attributes()->type)) {
381 381
                 throw new InvalidMetadataException('The type attribute must be set for all callback-method elements.');
382 382
             }
383 383
 
384
-            if (!isset($method->attributes()->name)) {
384
+            if ( ! isset($method->attributes()->name)) {
385 385
                 throw new InvalidMetadataException('The name attribute must be set for all callback-method elements.');
386 386
             }
387 387
 
@@ -399,11 +399,11 @@  discard block
 block discarded – undo
399 399
                     break;
400 400
 
401 401
                 case 'handler':
402
-                    if (!isset($method->attributes()->format)) {
402
+                    if ( ! isset($method->attributes()->format)) {
403 403
                         throw new InvalidMetadataException('The format attribute must be set for "handler" callback methods.');
404 404
                     }
405 405
 
406
-                    if (!isset($method->attributes()->direction)) {
406
+                    if ( ! isset($method->attributes()->direction)) {
407 407
                         throw new InvalidMetadataException('The direction attribute must be set for "handler" callback methods.');
408 408
                     }
409 409
 
Please login to merge, or discard this patch.
src/GraphNavigator/DeserializationGraphNavigator.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -175,11 +175,11 @@  discard block
 block discarded – undo
175 175
                 $metadata = $this->metadataFactory->getMetadataForClass($type['name']);
176 176
                 \assert($metadata instanceof ClassMetadata);
177 177
 
178
-                if ($metadata->usingExpression && !$this->expressionExclusionStrategy) {
178
+                if ($metadata->usingExpression && ! $this->expressionExclusionStrategy) {
179 179
                     throw new ExpressionLanguageRequiredException(sprintf('To use conditional exclude/expose in %s you must configure the expression language.', $metadata->name));
180 180
                 }
181 181
 
182
-                if (!empty($metadata->discriminatorMap) && $type['name'] === $metadata->discriminatorBaseClass) {
182
+                if ( ! empty($metadata->discriminatorMap) && $type['name'] === $metadata->discriminatorBaseClass) {
183 183
                     $metadata = $this->resolveMetadata($data, $metadata);
184 184
                 }
185 185
 
@@ -243,8 +243,8 @@  discard block
 block discarded – undo
243 243
     {
244 244
         $typeValue = $this->visitor->visitDiscriminatorMapProperty($data, $metadata);
245 245
 
246
-        if (!isset($metadata->discriminatorMap[$typeValue])) {
247
-            if (!empty($metadata->discriminatorDefaultClass)) {
246
+        if ( ! isset($metadata->discriminatorMap[$typeValue])) {
247
+            if ( ! empty($metadata->discriminatorDefaultClass)) {
248 248
                 return $this->metadataFactory->getMetadataForClass($metadata->discriminatorDefaultClass);
249 249
             }
250 250
 
Please login to merge, or discard this patch.
src/Metadata/ClassMetadata.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -178,12 +178,12 @@  discard block
 block discarded – undo
178 178
      */
179 179
     public function setAccessorOrder(string $order, array $customOrder = []): void
180 180
     {
181
-        if (!in_array($order, [self::ACCESSOR_ORDER_UNDEFINED, self::ACCESSOR_ORDER_ALPHABETICAL, self::ACCESSOR_ORDER_CUSTOM], true)) {
181
+        if ( ! in_array($order, [self::ACCESSOR_ORDER_UNDEFINED, self::ACCESSOR_ORDER_ALPHABETICAL, self::ACCESSOR_ORDER_CUSTOM], true)) {
182 182
             throw new InvalidMetadataException(sprintf('The accessor order "%s" is invalid.', $order));
183 183
         }
184 184
 
185 185
         foreach ($customOrder as $name) {
186
-            if (!\is_string($name)) {
186
+            if ( ! \is_string($name)) {
187 187
                 throw new InvalidMetadataException(sprintf('$customOrder is expected to be a list of strings, but got element of value %s.', json_encode($name)));
188 188
             }
189 189
         }
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 
221 221
     public function merge(MergeableInterface $object): void
222 222
     {
223
-        if (!$object instanceof ClassMetadata) {
223
+        if ( ! $object instanceof ClassMetadata) {
224 224
             throw new InvalidMetadataException('$object must be an instance of ClassMetadata.');
225 225
         }
226 226
 
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
                 $this->discriminatorBaseClass,
254 254
                 $this->discriminatorBaseClass,
255 255
             ));
256
-        } elseif (!$this->discriminatorFieldName && $object->discriminatorFieldName) {
256
+        } elseif ( ! $this->discriminatorFieldName && $object->discriminatorFieldName) {
257 257
             $this->discriminatorFieldName = $object->discriminatorFieldName;
258 258
             $this->discriminatorMap = $object->discriminatorMap;
259 259
         }
@@ -284,12 +284,12 @@  discard block
 block discarded – undo
284 284
 
285 285
     public function registerNamespace(string $uri, ?string $prefix = null): void
286 286
     {
287
-        if (!\is_string($uri)) {
287
+        if ( ! \is_string($uri)) {
288 288
             throw new InvalidMetadataException(sprintf('$uri is expected to be a strings, but got value %s.', json_encode($uri)));
289 289
         }
290 290
 
291 291
         if (null !== $prefix) {
292
-            if (!\is_string($prefix)) {
292
+            if ( ! \is_string($prefix)) {
293 293
                 throw new InvalidMetadataException(sprintf('$prefix is expected to be a strings, but got value %s.', json_encode($prefix)));
294 294
             }
295 295
         } else {
@@ -371,11 +371,11 @@  discard block
 block discarded – undo
371 371
     {
372 372
         if (
373 373
             $this->discriminatorMap
374
-            && !$this->getReflection()->isAbstract()
375
-            && !$this->getReflection()->isInterface()
374
+            && ! $this->getReflection()->isAbstract()
375
+            && ! $this->getReflection()->isInterface()
376 376
         ) {
377 377
             if (false === $typeValue = array_search($this->name, $this->discriminatorMap, true)) {
378
-                if (! empty($this->discriminatorDefaultClass)) {
378
+                if ( ! empty($this->discriminatorDefaultClass)) {
379 379
                     $typeValue = $this->discriminatorDefaultClass;
380 380
                 } else {
381 381
                     throw new InvalidMetadataException(sprintf(
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
                 }
387 387
             }
388 388
 
389
-            if (!$this->discriminatorVirtual) {
389
+            if ( ! $this->discriminatorVirtual) {
390 390
                 return;
391 391
             }
392 392
 
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 
395 395
             if (
396 396
                 isset($this->propertyMetadata[$this->discriminatorFieldName])
397
-                && !$this->propertyMetadata[$this->discriminatorFieldName] instanceof StaticPropertyMetadata
397
+                && ! $this->propertyMetadata[$this->discriminatorFieldName] instanceof StaticPropertyMetadata
398 398
             ) {
399 399
                 throw new InvalidMetadataException(sprintf(
400 400
                     'The discriminator field name "%s" of the base-class "%s" conflicts with a regular property of the sub-class "%s".',
Please login to merge, or discard this patch.