Completed
Pull Request — master (#968)
by Michael
14:42
created
src/EventDispatcher/Subscriber/SymfonyValidatorValidatorSubscriber.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
         $validator = $this->validator;
38 38
         $groups    = $context->hasAttribute('validation_groups') ? $context->getAttribute('validation_groups') : null;
39 39
 
40
-        if (!$groups) {
40
+        if ( ! $groups) {
41 41
             return;
42 42
         }
43 43
 
Please login to merge, or discard this patch.
src/Type/TypeVisitor.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
             return $value;
47 47
         }
48 48
 
49
-        return str_replace($escapeChar . $escapeChar, $escapeChar, $value);
49
+        return str_replace($escapeChar.$escapeChar, $escapeChar, $value);
50 50
     }
51 51
 
52 52
     private function visitCompoundType(TreeNode $element, ?int &$handle, ?int $eldnah): array
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
         return [
58 58
             'name' => $nameToken->getValueValue(),
59 59
             'params' => array_map(
60
-                function (TreeNode $node) use ($handle, $eldnah) {
60
+                function(TreeNode $node) use ($handle, $eldnah) {
61 61
                     return $node->accept($this, $handle, $eldnah);
62 62
                 },
63 63
                 $parameters
Please login to merge, or discard this patch.
src/Context.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
             $this->addExclusionStrategy(new VersionExclusionStrategy($this->attributes['version']));
69 69
         }
70 70
 
71
-        if (!empty($this->attributes['max_depth_checks'])) {
71
+        if ( ! empty($this->attributes['max_depth_checks'])) {
72 72
             $this->addExclusionStrategy(new DepthExclusionStrategy());
73 73
         }
74 74
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 
116 116
     private function assertMutable(): void
117 117
     {
118
-        if (!$this->initialized) {
118
+        if ( ! $this->initialized) {
119 119
             return;
120 120
         }
121 121
 
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
     {
212 212
         $metadata = $this->metadataStack->pop();
213 213
 
214
-        if (!$metadata instanceof PropertyMetadata) {
214
+        if ( ! $metadata instanceof PropertyMetadata) {
215 215
             throw new RuntimeException('Context metadataStack not working well');
216 216
         }
217 217
     }
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
     {
221 221
         $metadata = $this->metadataStack->pop();
222 222
 
223
-        if (!$metadata instanceof ClassMetadata) {
223
+        if ( ! $metadata instanceof ClassMetadata) {
224 224
             throw new RuntimeException('Context metadataStack not working well');
225 225
         }
226 226
     }
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
      */
236 236
     public function getCurrentPath(): array
237 237
     {
238
-        if (!$this->metadataStack) {
238
+        if ( ! $this->metadataStack) {
239 239
             return [];
240 240
         }
241 241
 
Please login to merge, or discard this patch.
src/Expression/ExpressionEvaluator.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,13 +41,13 @@
 block discarded – undo
41 41
      */
42 42
     public function evaluate(string $expression, array $data = [])
43 43
     {
44
-        if (!is_string($expression)) {
44
+        if ( ! is_string($expression)) {
45 45
             return $expression;
46 46
         }
47 47
 
48 48
         $context = $data + $this->context;
49 49
 
50
-        if (!array_key_exists($expression, $this->cache)) {
50
+        if ( ! array_key_exists($expression, $this->cache)) {
51 51
             $this->cache[$expression] = $this->expressionLanguage->parse($expression, array_keys($context));
52 52
         }
53 53
 
Please login to merge, or discard this patch.
src/SerializerBuilder.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 
119 119
     private function getAccessorStrategy(): AccessorStrategyInterface
120 120
     {
121
-        if (!$this->accessorStrategy) {
121
+        if ( ! $this->accessorStrategy) {
122 122
             $this->accessorStrategy = new DefaultAccessorStrategy($this->expressionEvaluator);
123 123
         }
124 124
         return $this->accessorStrategy;
@@ -154,10 +154,10 @@  discard block
 block discarded – undo
154 154
 
155 155
     public function setCacheDir(string $dir): self
156 156
     {
157
-        if (!is_dir($dir)) {
157
+        if ( ! is_dir($dir)) {
158 158
             $this->createDir($dir);
159 159
         }
160
-        if (!is_writable($dir)) {
160
+        if ( ! is_writable($dir)) {
161 161
             throw new InvalidArgumentException(sprintf('The cache directory "%s" is not writable.', $dir));
162 162
         }
163 163
 
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
     public function setMetadataDirs(array $namespacePrefixToDirMap): self
279 279
     {
280 280
         foreach ($namespacePrefixToDirMap as $dir) {
281
-            if (!is_dir($dir)) {
281
+            if ( ! is_dir($dir)) {
282 282
                 throw new InvalidArgumentException(sprintf('The directory "%s" does not exist.', $dir));
283 283
             }
284 284
         }
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
      */
317 317
     public function addMetadataDir(string $dir, string $namespacePrefix = ''): self
318 318
     {
319
-        if (!is_dir($dir)) {
319
+        if ( ! is_dir($dir)) {
320 320
             throw new InvalidArgumentException(sprintf('The directory "%s" does not exist.', $dir));
321 321
         }
322 322
 
@@ -356,11 +356,11 @@  discard block
 block discarded – undo
356 356
      */
357 357
     public function replaceMetadataDir(string $dir, string $namespacePrefix = ''): self
358 358
     {
359
-        if (!is_dir($dir)) {
359
+        if ( ! is_dir($dir)) {
360 360
             throw new InvalidArgumentException(sprintf('The directory "%s" does not exist.', $dir));
361 361
         }
362 362
 
363
-        if (!isset($this->metadataDirs[$namespacePrefix])) {
363
+        if ( ! isset($this->metadataDirs[$namespacePrefix])) {
364 364
             throw new InvalidArgumentException(sprintf('There is no directory configured for namespace prefix "%s". Please use addMetadataDir() for adding new directories.', $namespacePrefix));
365 365
         }
366 366
 
@@ -427,8 +427,8 @@  discard block
 block discarded – undo
427 427
             $annotationReader = new AnnotationReader();
428 428
 
429 429
             if (null !== $this->cacheDir) {
430
-                $this->createDir($this->cacheDir . '/annotations');
431
-                $annotationsCache = new FilesystemCache($this->cacheDir . '/annotations');
430
+                $this->createDir($this->cacheDir.'/annotations');
431
+                $annotationsCache = new FilesystemCache($this->cacheDir.'/annotations');
432 432
                 $annotationReader = new CachedReader($annotationReader, $annotationsCache, $this->debug);
433 433
             }
434 434
         }
@@ -446,19 +446,19 @@  discard block
 block discarded – undo
446 446
         if ($this->metadataCache !== null) {
447 447
             $metadataFactory->setCache($this->metadataCache);
448 448
         } elseif (null !== $this->cacheDir) {
449
-            $this->createDir($this->cacheDir . '/metadata');
450
-            $metadataFactory->setCache(new FileCache($this->cacheDir . '/metadata'));
449
+            $this->createDir($this->cacheDir.'/metadata');
450
+            $metadataFactory->setCache(new FileCache($this->cacheDir.'/metadata'));
451 451
         }
452 452
 
453
-        if (!$this->handlersConfigured) {
453
+        if ( ! $this->handlersConfigured) {
454 454
             $this->addDefaultHandlers();
455 455
         }
456 456
 
457
-        if (!$this->listenersConfigured) {
457
+        if ( ! $this->listenersConfigured) {
458 458
             $this->addDefaultListeners();
459 459
         }
460 460
 
461
-        if (!$this->visitorsAdded) {
461
+        if ( ! $this->visitorsAdded) {
462 462
             $this->addDefaultSerializationVisitors();
463 463
             $this->addDefaultDeserializationVisitors();
464 464
         }
Please login to merge, or discard this patch.
src/JsonDeserializationVisitor.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -67,12 +67,12 @@  discard block
 block discarded – undo
67 67
 
68 68
     public function visitArray($data, array $type): array
69 69
     {
70
-        if (!is_array($data)) {
70
+        if ( ! is_array($data)) {
71 71
             throw new RuntimeException(sprintf('Expected array, but got %s: %s', gettype($data), json_encode($data)));
72 72
         }
73 73
 
74 74
         // If no further parameters were given, keys/values are just passed as is.
75
-        if (!$type['params']) {
75
+        if ( ! $type['params']) {
76 76
             return $data;
77 77
         }
78 78
 
@@ -130,15 +130,15 @@  discard block
 block discarded – undo
130 130
             return;
131 131
         }
132 132
 
133
-        if (!is_array($data)) {
133
+        if ( ! is_array($data)) {
134 134
             throw new RuntimeException(sprintf('Invalid data %s (%s), expected "%s".', json_encode($data), $metadata->type['name'], $metadata->class));
135 135
         }
136 136
 
137
-        if (!array_key_exists($name, $data)) {
137
+        if ( ! array_key_exists($name, $data)) {
138 138
             return;
139 139
         }
140 140
 
141
-        if (!$metadata->type) {
141
+        if ( ! $metadata->type) {
142 142
             throw new RuntimeException(sprintf('You must define a type for %s::$%s.', $metadata->class, $metadata->name));
143 143
         }
144 144
 
Please login to merge, or discard this patch.
src/Metadata/PropertyMetadata.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -70,22 +70,22 @@  discard block
 block discarded – undo
70 70
             $class = $this->getReflection()->getDeclaringClass();
71 71
 
72 72
             if (empty($getter)) {
73
-                if ($class->hasMethod('get' . $this->name) && $class->getMethod('get' . $this->name)->isPublic()) {
74
-                    $getter = 'get' . $this->name;
75
-                } elseif ($class->hasMethod('is' . $this->name) && $class->getMethod('is' . $this->name)->isPublic()) {
76
-                    $getter = 'is' . $this->name;
77
-                } elseif ($class->hasMethod('has' . $this->name) && $class->getMethod('has' . $this->name)->isPublic()) {
78
-                    $getter = 'has' . $this->name;
73
+                if ($class->hasMethod('get'.$this->name) && $class->getMethod('get'.$this->name)->isPublic()) {
74
+                    $getter = 'get'.$this->name;
75
+                } elseif ($class->hasMethod('is'.$this->name) && $class->getMethod('is'.$this->name)->isPublic()) {
76
+                    $getter = 'is'.$this->name;
77
+                } elseif ($class->hasMethod('has'.$this->name) && $class->getMethod('has'.$this->name)->isPublic()) {
78
+                    $getter = 'has'.$this->name;
79 79
                 } else {
80
-                    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));
80
+                    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));
81 81
                 }
82 82
             }
83 83
 
84
-            if (empty($setter) && !$this->readOnly) {
85
-                if ($class->hasMethod('set' . $this->name) && $class->getMethod('set' . $this->name)->isPublic()) {
86
-                    $setter = 'set' . $this->name;
84
+            if (empty($setter) && ! $this->readOnly) {
85
+                if ($class->hasMethod('set'.$this->name) && $class->getMethod('set'.$this->name)->isPublic()) {
86
+                    $setter = 'set'.$this->name;
87 87
                 } else {
88
-                    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));
88
+                    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));
89 89
                 }
90 90
             }
91 91
         }
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         return is_array($type)
105 105
             && $type['name'] === 'array'
106 106
             && isset($type['params'][0])
107
-            && !isset($type['params'][1]);
107
+            && ! isset($type['params'][1]);
108 108
     }
109 109
 
110 110
     public static function isCollectionMap(?array $type = null): bool
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
             $this->xmlAttributeMap,
173 173
             $this->maxDepth,
174 174
             $parentStr
175
-            )         = $unserialized;
175
+            ) = $unserialized;
176 176
 
177 177
         if (isset($unserialized['xmlEntryNamespace'])) {
178 178
             $this->xmlEntryNamespace = $unserialized['xmlEntryNamespace'];
Please login to merge, or discard this patch.
src/Metadata/ClassMetadata.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -107,12 +107,12 @@  discard block
 block discarded – undo
107 107
      */
108 108
     public function setAccessorOrder(string $order, array $customOrder = []): void
109 109
     {
110
-        if (!in_array($order, [self::ACCESSOR_ORDER_UNDEFINED, self::ACCESSOR_ORDER_ALPHABETICAL, self::ACCESSOR_ORDER_CUSTOM], true)) {
110
+        if ( ! in_array($order, [self::ACCESSOR_ORDER_UNDEFINED, self::ACCESSOR_ORDER_ALPHABETICAL, self::ACCESSOR_ORDER_CUSTOM], true)) {
111 111
             throw new InvalidMetadataException(sprintf('The accessor order "%s" is invalid.', $order));
112 112
         }
113 113
 
114 114
         foreach ($customOrder as $name) {
115
-            if (!is_string($name)) {
115
+            if ( ! is_string($name)) {
116 116
                 throw new InvalidMetadataException(sprintf('$customOrder is expected to be a list of strings, but got element of value %s.', json_encode($name)));
117 117
             }
118 118
         }
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 
149 149
     public function merge(MergeableInterface $object): void
150 150
     {
151
-        if (!$object instanceof ClassMetadata) {
151
+        if ( ! $object instanceof ClassMetadata) {
152 152
             throw new InvalidMetadataException('$object must be an instance of ClassMetadata.');
153 153
         }
154 154
         parent::merge($object);
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
                 $this->discriminatorBaseClass,
173 173
                 $this->discriminatorBaseClass
174 174
             ));
175
-        } elseif (!$this->discriminatorFieldName && $object->discriminatorFieldName) {
175
+        } elseif ( ! $this->discriminatorFieldName && $object->discriminatorFieldName) {
176 176
             $this->discriminatorFieldName = $object->discriminatorFieldName;
177 177
             $this->discriminatorMap       = $object->discriminatorMap;
178 178
         }
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
             $this->discriminatorBaseClass = $object->discriminatorBaseClass;
188 188
         }
189 189
 
190
-        if ($this->discriminatorMap && !$this->getReflection()->isAbstract()) {
190
+        if ($this->discriminatorMap && ! $this->getReflection()->isAbstract()) {
191 191
             if (false === $typeValue = array_search($this->name, $this->discriminatorMap, true)) {
192 192
                 throw new InvalidMetadataException(sprintf(
193 193
                     'The sub-class "%s" is not listed in the discriminator of the base class "%s".',
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
             $this->discriminatorValue = $typeValue;
200 200
 
201 201
             if (isset($this->propertyMetadata[$this->discriminatorFieldName])
202
-                && !$this->propertyMetadata[$this->discriminatorFieldName] instanceof StaticPropertyMetadata
202
+                && ! $this->propertyMetadata[$this->discriminatorFieldName] instanceof StaticPropertyMetadata
203 203
             ) {
204 204
                 throw new InvalidMetadataException(sprintf(
205 205
                     'The discriminator field name "%s" of the base-class "%s" conflicts with a regular property of the sub-class "%s".',
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
                 ));
210 210
             }
211 211
 
212
-            $discriminatorProperty                                 = new StaticPropertyMetadata(
212
+            $discriminatorProperty = new StaticPropertyMetadata(
213 213
                 $this->name,
214 214
                 $this->discriminatorFieldName,
215 215
                 $typeValue,
@@ -227,12 +227,12 @@  discard block
 block discarded – undo
227 227
 
228 228
     public function registerNamespace(string $uri, ?string $prefix = null): void
229 229
     {
230
-        if (!is_string($uri)) {
230
+        if ( ! is_string($uri)) {
231 231
             throw new InvalidMetadataException(sprintf('$uri is expected to be a strings, but got value %s.', json_encode($uri)));
232 232
         }
233 233
 
234 234
         if ($prefix !== null) {
235
-            if (!is_string($prefix)) {
235
+            if ( ! is_string($prefix)) {
236 236
                 throw new InvalidMetadataException(sprintf('$prefix is expected to be a strings, but got value %s.', json_encode($prefix)));
237 237
             }
238 238
         } else {
Please login to merge, or discard this patch.
src/Metadata/Driver/AnnotationDriver.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
             }
136 136
         }
137 137
 
138
-        if (!$excludeAll) {
138
+        if ( ! $excludeAll) {
139 139
             foreach ($class->getProperties() as $property) {
140 140
                 if ($property->class !== $name || (isset($property->info) && $property->info['class'] !== $name)) {
141 141
                     continue;
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
                     } elseif ($annot instanceof Expose) {
167 167
                         $isExpose = true;
168 168
                         if (null !== $annot->if) {
169
-                            $propertyMetadata->excludeIf = '!(' . $annot->if . ')';
169
+                            $propertyMetadata->excludeIf = '!('.$annot->if.')';
170 170
                         }
171 171
                     } elseif ($annot instanceof Exclude) {
172 172
                         if (null !== $annot->if) {
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
                                 throw new InvalidMetadataException(sprintf(
216 216
                                     'Invalid group name "%s" on "%s", did you mean to create multiple groups?',
217 217
                                     implode(', ', $propertyMetadata->groups),
218
-                                    $propertyMetadata->class . '->' . $propertyMetadata->name
218
+                                    $propertyMetadata->class.'->'.$propertyMetadata->name
219 219
                                 ));
220 220
                             }
221 221
                         }
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
                     }
238 238
                 }
239 239
 
240
-                if (!$propertyMetadata->serializedName) {
240
+                if ( ! $propertyMetadata->serializedName) {
241 241
                     $propertyMetadata->serializedName = $this->namingStrategy->translateName($propertyMetadata);
242 242
                 }
243 243
 
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
                     }
248 248
                 }
249 249
 
250
-                if ((ExclusionPolicy::NONE === $exclusionPolicy && !$isExclude)
250
+                if ((ExclusionPolicy::NONE === $exclusionPolicy && ! $isExclude)
251 251
                     || (ExclusionPolicy::ALL === $exclusionPolicy && $isExpose)
252 252
                 ) {
253 253
                     $propertyMetadata->setAccessor($accessType, $accessor[0], $accessor[1]);
Please login to merge, or discard this patch.