Completed
Pull Request — master (#1248)
by Саша
24:01 queued 08:58
created
src/Exclusion/GroupsExclusionStrategy.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -60,14 +60,14 @@  discard block
 block discarded – undo
60 60
         if ($this->nestedGroups) {
61 61
             $groups = $this->getGroupsFor($navigatorContext);
62 62
 
63
-            if (!$property->groups) {
64
-                return !in_array(self::DEFAULT_GROUP, $groups);
63
+            if ( ! $property->groups) {
64
+                return ! in_array(self::DEFAULT_GROUP, $groups);
65 65
             }
66 66
 
67 67
             return $this->shouldSkipUsingGroups($property, $groups);
68 68
         } else {
69
-            if (!$property->groups) {
70
-                return !isset($this->groups[self::DEFAULT_GROUP]);
69
+            if ( ! $property->groups) {
70
+                return ! isset($this->groups[self::DEFAULT_GROUP]);
71 71
             }
72 72
 
73 73
             foreach ($property->groups as $group) {
@@ -92,21 +92,21 @@  discard block
 block discarded – undo
92 92
 
93 93
     public function getGroupsFor(Context $navigatorContext): array
94 94
     {
95
-        if (!$this->nestedGroups) {
95
+        if ( ! $this->nestedGroups) {
96 96
             return array_keys($this->groups);
97 97
         }
98 98
 
99 99
         $paths = $navigatorContext->getCurrentPath();
100 100
         $groups = $this->groups;
101 101
         foreach ($paths as $index => $path) {
102
-            if (!array_key_exists($path, $groups)) {
102
+            if ( ! array_key_exists($path, $groups)) {
103 103
                 if ($index > 0) {
104 104
                     $groups = [self::DEFAULT_GROUP];
105 105
                 }
106 106
                 break;
107 107
             }
108 108
             $groups = $groups[$path];
109
-            if (!array_filter($groups, 'is_string')) {
109
+            if ( ! array_filter($groups, 'is_string')) {
110 110
                 $groups += [self::DEFAULT_GROUP];
111 111
             }
112 112
         }
Please login to merge, or discard this patch.
src/Serializer.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 
115 115
     private function getNavigator(int $direction): GraphNavigatorInterface
116 116
     {
117
-        if (!isset($this->graphNavigators[$direction])) {
117
+        if ( ! isset($this->graphNavigators[$direction])) {
118 118
             throw new RuntimeException(
119 119
                 sprintf(
120 120
                     'Can not find a graph navigator for the direction "%s".',
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
             ? $this->serializationVisitors
133 133
             : $this->deserializationVisitors;
134 134
 
135
-        if (!isset($factories[$format])) {
135
+        if ( ! isset($factories[$format])) {
136 136
             throw new UnsupportedFormatException(
137 137
                 sprintf(
138 138
                     'The format "%s" is not supported for %s.',
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
         $result = $this->visit($navigator, $visitor, $context, $data, 'json', $type);
197 197
         $result = $this->convertArrayObjects($result);
198 198
 
199
-        if (!\is_array($result)) {
199
+        if ( ! \is_array($result)) {
200 200
             throw new RuntimeException(sprintf(
201 201
                 'The input data of type "%s" did not convert to an array, but got a result of type "%s".',
202 202
                 \is_object($data) ? \get_class($data) : \gettype($data),
Please login to merge, or discard this patch.
src/XmlSerializationVisitor.php 1 patch
Spacing   +17 added lines, -17 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
         }
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
             $node = $this->navigator->accept($v, $metadata->type);
243 243
             $this->revertCurrentMetadata();
244 244
 
245
-            if (!$node instanceof \DOMCharacterData) {
245
+            if ( ! $node instanceof \DOMCharacterData) {
246 246
                 throw new RuntimeException(sprintf('Unsupported value for XML attribute for %s. Expected character data, but got %s.', $metadata->name, json_encode($v)));
247 247
             }
248 248
 
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
         }
253 253
 
254 254
         if (($metadata->xmlValue && $this->currentNode->childNodes->length > 0)
255
-            || (!$metadata->xmlValue && $this->hasValue)
255
+            || ( ! $metadata->xmlValue && $this->hasValue)
256 256
         ) {
257 257
             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));
258 258
         }
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
             $node = $this->navigator->accept($v, $metadata->type);
265 265
             $this->revertCurrentMetadata();
266 266
 
267
-            if (!$node instanceof \DOMCharacterData) {
267
+            if ( ! $node instanceof \DOMCharacterData) {
268 268
                 throw new RuntimeException(sprintf('Unsupported value for property %s::$%s. Expected character data, but got %s.', $metadata->reflection->class, $metadata->reflection->name, \is_object($node) ? \get_class($node) : \gettype($node)));
269 269
             }
270 270
 
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
         }
275 275
 
276 276
         if ($metadata->xmlAttributeMap) {
277
-            if (!\is_array($v)) {
277
+            if ( ! \is_array($v)) {
278 278
                 throw new RuntimeException(sprintf('Unsupported value type for XML attribute map. Expected array but got %s.', \gettype($v)));
279 279
             }
280 280
 
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
                 $node = $this->navigator->accept($value, null);
284 284
                 $this->revertCurrentMetadata();
285 285
 
286
-                if (!$node instanceof \DOMCharacterData) {
286
+                if ( ! $node instanceof \DOMCharacterData) {
287 287
                     throw new RuntimeException(sprintf('Unsupported value for a XML attribute map value. Expected character data, but got %s.', json_encode($v)));
288 288
                 }
289 289
 
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
             return;
294 294
         }
295 295
 
296
-        if ($addEnclosingElement = !$this->isInLineCollection($metadata) && !$metadata->inline) {
296
+        if ($addEnclosingElement = ! $this->isInLineCollection($metadata) && ! $metadata->inline) {
297 297
             $namespace = null !== $metadata->xmlNamespace
298 298
                 ? $metadata->xmlNamespace
299 299
                 : $this->getClassDefaultNamespace($this->objectMetadataStack->top());
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 
338 338
     private function isSkippableEmptyObject(?\DOMElement $node, PropertyMetadata $metadata): bool
339 339
     {
340
-        return null === $node && !$metadata->xmlCollection && $metadata->skipWhenEmpty;
340
+        return null === $node && ! $metadata->xmlCollection && $metadata->skipWhenEmpty;
341 341
     }
342 342
 
343 343
     private function isSkippableCollection(PropertyMetadata $metadata): bool
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 
348 348
     private function isElementEmpty(\DOMElement $element): bool
349 349
     {
350
-        return !$element->hasChildNodes() && !$element->hasAttributes();
350
+        return ! $element->hasChildNodes() && ! $element->hasAttributes();
351 351
     }
352 352
 
353 353
     public function endVisitingObject(ClassMetadata $metadata, object $data, array $type): void
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
         foreach ($metadata->xmlNamespaces as $prefix => $uri) {
454 454
             $attribute = 'xmlns';
455 455
             if ('' !== $prefix) {
456
-                $attribute .= ':' . $prefix;
456
+                $attribute .= ':'.$prefix;
457 457
             } elseif ($element->namespaceURI === $uri) {
458 458
                 continue;
459 459
             }
@@ -478,19 +478,19 @@  discard block
 block discarded – undo
478 478
         if ($this->currentNode->isDefaultNamespace($namespace)) {
479 479
             return $this->document->createElementNS($namespace, $tagName);
480 480
         }
481
-        if (!($prefix = $this->currentNode->lookupPrefix($namespace)) && !($prefix = $this->document->lookupPrefix($namespace))) {
482
-            $prefix = 'ns-' . substr(sha1($namespace), 0, 8);
481
+        if ( ! ($prefix = $this->currentNode->lookupPrefix($namespace)) && ! ($prefix = $this->document->lookupPrefix($namespace))) {
482
+            $prefix = 'ns-'.substr(sha1($namespace), 0, 8);
483 483
         }
484
-        return $this->document->createElementNS($namespace, $prefix . ':' . $tagName);
484
+        return $this->document->createElementNS($namespace, $prefix.':'.$tagName);
485 485
     }
486 486
 
487 487
     private function setAttributeOnNode(\DOMElement $node, string $name, string $value, ?string $namespace = null): void
488 488
     {
489 489
         if (null !== $namespace) {
490
-            if (!$prefix = $node->lookupPrefix($namespace)) {
491
-                $prefix = 'ns-' . substr(sha1($namespace), 0, 8);
490
+            if ( ! $prefix = $node->lookupPrefix($namespace)) {
491
+                $prefix = 'ns-'.substr(sha1($namespace), 0, 8);
492 492
             }
493
-            $node->setAttributeNS($namespace, $prefix . ':' . $name, $value);
493
+            $node->setAttributeNS($namespace, $prefix.':'.$name, $value);
494 494
         } else {
495 495
             $node->setAttribute($name, $value);
496 496
         }
Please login to merge, or discard this patch.
src/EventDispatcher/Subscriber/DoctrineProxySubscriber.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -39,13 +39,13 @@  discard block
 block discarded – undo
39 39
         // If the set type name is not an actual class, but a faked type for which a custom handler exists, we do not
40 40
         // modify it with this subscriber. Also, we forgo autoloading here as an instance of this type is already created,
41 41
         // so it must be loaded if its a real class.
42
-        $virtualType = !class_exists($type['name'], false);
42
+        $virtualType = ! class_exists($type['name'], false);
43 43
 
44 44
         if ($object instanceof PersistentCollection
45 45
             || $object instanceof MongoDBPersistentCollection
46 46
             || $object instanceof PHPCRPersistentCollection
47 47
         ) {
48
-            if (!$virtualType) {
48
+            if ( ! $virtualType) {
49 49
                 $event->setType('ArrayCollection');
50 50
             }
51 51
 
@@ -53,13 +53,13 @@  discard block
 block discarded – undo
53 53
         }
54 54
 
55 55
         if (($this->skipVirtualTypeInit && $virtualType) ||
56
-            (!$object instanceof Proxy && !$object instanceof LazyLoadingInterface)
56
+            ( ! $object instanceof Proxy && ! $object instanceof LazyLoadingInterface)
57 57
         ) {
58 58
             return;
59 59
         }
60 60
 
61 61
         // do not initialize the proxy if is going to be excluded by-class by some exclusion strategy
62
-        if (false === $this->initializeExcluded && !$virtualType) {
62
+        if (false === $this->initializeExcluded && ! $virtualType) {
63 63
             $context = $event->getContext();
64 64
             $exclusionStrategy = $context->getExclusionStrategy();
65 65
             $metadata = $context->getMetadataFactory()->getMetadataForClass(get_parent_class($object));
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
             $object->__load();
75 75
         }
76 76
 
77
-        if (!$virtualType) {
77
+        if ( ! $virtualType) {
78 78
             $event->setType(get_parent_class($object), $type['params']);
79 79
         }
80 80
     }
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
     {
84 84
         $type = $event->getType();
85 85
         // is a virtual type? then there is no need to change the event name
86
-        if (!class_exists($type['name'], false)) {
86
+        if ( ! class_exists($type['name'], false)) {
87 87
             return;
88 88
         }
89 89
 
Please login to merge, or discard this patch.
src/Handler/FormErrorHandler.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
 
50 50
     public function __construct(?object $translator = null, string $translationDomain = 'validators')
51 51
     {
52
-        if (null!== $translator && (!$translator instanceof TranslatorInterface && !$translator instanceof TranslatorContract)) {
52
+        if (null !== $translator && ( ! $translator instanceof TranslatorInterface && ! $translator instanceof TranslatorContract)) {
53 53
             throw new \InvalidArgumentException(sprintf(
54 54
                 'The first argument passed to %s must be instance of %s or %s, %s given',
55 55
                 self::class,
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
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
             $this->addExclusionStrategy(new VersionExclusionStrategy($this->attributes['version']));
80 80
         }
81 81
 
82
-        if (!empty($this->attributes['max_depth_checks'])) {
82
+        if ( ! empty($this->attributes['max_depth_checks'])) {
83 83
             $this->addExclusionStrategy(new DepthExclusionStrategy());
84 84
         }
85 85
 
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 
133 133
     final protected function assertMutable(): void
134 134
     {
135
-        if (!$this->initialized) {
135
+        if ( ! $this->initialized) {
136 136
             return;
137 137
         }
138 138
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
     {
209 209
         $metadata = $this->metadataStack->pop();
210 210
 
211
-        if (!$metadata instanceof PropertyMetadata) {
211
+        if ( ! $metadata instanceof PropertyMetadata) {
212 212
             throw new RuntimeException('Context metadataStack not working well');
213 213
         }
214 214
     }
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
     {
218 218
         $metadata = $this->metadataStack->pop();
219 219
 
220
-        if (!$metadata instanceof ClassMetadata) {
220
+        if ( ! $metadata instanceof ClassMetadata) {
221 221
             throw new RuntimeException('Context metadataStack not working well');
222 222
         }
223 223
     }
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
      */
233 233
     public function getCurrentPath(): array
234 234
     {
235
-        if (!$this->metadataStack) {
235
+        if ( ! $this->metadataStack) {
236 236
             return [];
237 237
         }
238 238
 
Please login to merge, or discard this patch.
src/Builder/DefaultDriverFactory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
 
44 44
     public function createDriver(array $metadataDirs, Reader $annotationReader): DriverInterface
45 45
     {
46
-        if (!empty($metadataDirs)) {
46
+        if ( ! empty($metadataDirs)) {
47 47
             $fileLocator = new FileLocator($metadataDirs);
48 48
 
49 49
             $driver = new DriverChain([
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
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     {
37 37
         $this->lexer->moveNext();
38 38
 
39
-        if (!$this->lexer->token) {
39
+        if ( ! $this->lexer->token) {
40 40
             throw new SyntaxError(
41 41
                 'Syntax error, unexpected end of stream'
42 42
             );
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
                 return $this->visitArrayType();
58 58
             }
59 59
             return $this->visitSimpleType();
60
-        } elseif (!$this->root && Lexer::T_ARRAY_START === $this->lexer->token['type']) {
60
+        } elseif ( ! $this->root && Lexer::T_ARRAY_START === $this->lexer->token['type']) {
61 61
             return $this->visitArrayType();
62 62
         }
63 63
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
         $this->match(Lexer::T_TYPE_START);
85 85
 
86 86
         $params = [];
87
-        if (!$this->lexer->isNextToken(Lexer::T_TYPE_END)) {
87
+        if ( ! $this->lexer->isNextToken(Lexer::T_TYPE_END)) {
88 88
             while (true) {
89 89
                 $params[] = $this->visit();
90 90
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
          */
110 110
 
111 111
         $params = [];
112
-        if (!$this->lexer->isNextToken(Lexer::T_ARRAY_END)) {
112
+        if ( ! $this->lexer->isNextToken(Lexer::T_ARRAY_END)) {
113 113
             while (true) {
114 114
                 $params[] = $this->visit();
115 115
                 if ($this->lexer->isNextToken(Lexer::T_ARRAY_END)) {
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 
125 125
     private function match(int $token): void
126 126
     {
127
-        if (!$this->lexer->lookahead) {
127
+        if ( ! $this->lexer->lookahead) {
128 128
             throw new SyntaxError(
129 129
                 sprintf('Syntax error, unexpected end of stream, expected %s', $this->getConstant($token))
130 130
             );
Please login to merge, or discard this patch.
src/Handler/DateHandler.php 1 patch
Spacing   +11 added lines, -11 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',
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
 
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
      */
224 224
     private function parseDateTime($data, array $type, bool $immutable = false): \DateTimeInterface
225 225
     {
226
-        $timezone = !empty($type['params'][1]) ? new \DateTimeZone($type['params'][1]) : $this->defaultTimezone;
226
+        $timezone = ! empty($type['params'][1]) ? new \DateTimeZone($type['params'][1]) : $this->defaultTimezone;
227 227
         $formats = $this->getDeserializationFormats($type);
228 228
 
229 229
         $formatTried = [];
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
         throw new RuntimeException(sprintf(
249 249
             'Invalid datetime "%s", expected one of the format %s.',
250 250
             $data,
251
-            '"' . implode('", "', $formatTried) . '"'
251
+            '"'.implode('", "', $formatTried).'"'
252 252
         ));
253 253
     }
254 254
 
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
                 $f = (float) $match[0];
263 263
             }
264 264
             $dateInterval = new \DateInterval($data);
265
-            $dateInterval->f= $f;
265
+            $dateInterval->f = $f;
266 266
         } catch (\Throwable $e) {
267 267
             throw new RuntimeException(sprintf('Invalid dateinterval "%s", expected ISO 8601 format', $data), 0, $e);
268 268
         }
@@ -295,15 +295,15 @@  discard block
 block discarded – undo
295 295
         $format = 'P';
296 296
 
297 297
         if (0 < $dateInterval->y) {
298
-            $format .= $dateInterval->y . 'Y';
298
+            $format .= $dateInterval->y.'Y';
299 299
         }
300 300
 
301 301
         if (0 < $dateInterval->m) {
302
-            $format .= $dateInterval->m . 'M';
302
+            $format .= $dateInterval->m.'M';
303 303
         }
304 304
 
305 305
         if (0 < $dateInterval->d) {
306
-            $format .= $dateInterval->d . 'D';
306
+            $format .= $dateInterval->d.'D';
307 307
         }
308 308
 
309 309
         if (0 < $dateInterval->h || 0 < $dateInterval->i || 0 < $dateInterval->s) {
@@ -311,15 +311,15 @@  discard block
 block discarded – undo
311 311
         }
312 312
 
313 313
         if (0 < $dateInterval->h) {
314
-            $format .= $dateInterval->h . 'H';
314
+            $format .= $dateInterval->h.'H';
315 315
         }
316 316
 
317 317
         if (0 < $dateInterval->i) {
318
-            $format .= $dateInterval->i . 'M';
318
+            $format .= $dateInterval->i.'M';
319 319
         }
320 320
 
321 321
         if (0 < $dateInterval->s) {
322
-            $format .= $dateInterval->s . 'S';
322
+            $format .= $dateInterval->s.'S';
323 323
         }
324 324
 
325 325
         if ('P' === $format) {
Please login to merge, or discard this patch.