Completed
Push — master ( 01e67d...72a24a )
by Marcin
17s queued 15s
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.