Completed
Pull Request — master (#1167)
by Nik
10:38
created
src/GraphNavigator/SerializationGraphNavigator.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 
115 115
         switch ($type['name']) {
116 116
             case 'NULL':
117
-                if (!$this->shouldSerializeNull) {
117
+                if ( ! $this->shouldSerializeNull) {
118 118
                     throw new NotAcceptableException();
119 119
                 }
120 120
                 return $this->visitor->visitNull($data, $type);
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
             case 'resource':
141 141
                 $msg = 'Resources are not supported in serialized data.';
142 142
                 if (null !== $path = $this->context->getPath()) {
143
-                    $msg .= ' Path: ' . $path;
143
+                    $msg .= ' Path: '.$path;
144 144
                 }
145 145
 
146 146
                 throw new RuntimeException($msg);
Please login to merge, or discard this patch.
src/Handler/ConstraintViolationHandler.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
                     'direction' => GraphNavigatorInterface::DIRECTION_SERIALIZATION,
27 27
                     'type' => $type,
28 28
                     'format' => $format,
29
-                    'method' => $method . 'To' . $format,
29
+                    'method' => $method.'To'.$format,
30 30
                 ];
31 31
             }
32 32
         }
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     public function serializeListToXml(XmlSerializationVisitor $visitor, ConstraintViolationList $list, array $type): void
38 38
     {
39 39
         $currentNode = $visitor->getCurrentNode();
40
-        if (!$currentNode) {
40
+        if ( ! $currentNode) {
41 41
             $visitor->createRoot();
42 42
         }
43 43
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
         $violationNode = $visitor->getDocument()->createElement('violation');
57 57
 
58 58
         $parent = $visitor->getCurrentNode();
59
-        if (!$parent) {
59
+        if ( ! $parent) {
60 60
             $visitor->setCurrentAndRootNode($violationNode);
61 61
         } else {
62 62
             $parent->appendChild($violationNode);
Please login to merge, or discard this patch.
src/Accessor/DefaultAccessorStrategy.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -69,9 +69,9 @@  discard block
 block discarded – undo
69 69
         }
70 70
 
71 71
         if (null === $metadata->getter) {
72
-            if (!isset($this->readAccessors[$metadata->class])) {
72
+            if ( ! isset($this->readAccessors[$metadata->class])) {
73 73
                 if (true === $metadata->forceReflectionAccess) {
74
-                    $this->readAccessors[$metadata->class] = function ($o, $name) use ($metadata) {
74
+                    $this->readAccessors[$metadata->class] = function($o, $name) use ($metadata) {
75 75
                         $ref = $this->propertyReflectionCache[$metadata->class][$name] ?? null;
76 76
                         if (null === $ref) {
77 77
                             $ref = new \ReflectionProperty($metadata->class, $name);
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
                         return $ref->getValue($o);
83 83
                     };
84 84
                 } else {
85
-                    $this->readAccessors[$metadata->class] = \Closure::bind(static function ($o, $name) {
85
+                    $this->readAccessors[$metadata->class] = \Closure::bind(static function($o, $name) {
86 86
                         return $o->$name;
87 87
                     }, null, $metadata->class);
88 88
                 }
@@ -104,9 +104,9 @@  discard block
 block discarded – undo
104 104
         }
105 105
 
106 106
         if (null === $metadata->setter) {
107
-            if (!isset($this->writeAccessors[$metadata->class])) {
107
+            if ( ! isset($this->writeAccessors[$metadata->class])) {
108 108
                 if (true === $metadata->forceReflectionAccess) {
109
-                    $this->writeAccessors[$metadata->class] = function ($o, $name, $value) use ($metadata): void {
109
+                    $this->writeAccessors[$metadata->class] = function($o, $name, $value) use ($metadata): void {
110 110
                         $ref = $this->propertyReflectionCache[$metadata->class][$name] ?? null;
111 111
                         if (null === $ref) {
112 112
                             $ref = new \ReflectionProperty($metadata->class, $name);
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
                         $ref->setValue($o, $value);
118 118
                     };
119 119
                 } else {
120
-                    $this->writeAccessors[$metadata->class] = \Closure::bind(static function ($o, $name, $value): void {
120
+                    $this->writeAccessors[$metadata->class] = \Closure::bind(static function($o, $name, $value): void {
121 121
                         $o->$name = $value;
122 122
                     }, null, $metadata->class);
123 123
                 }
Please login to merge, or discard this patch.
src/Ordering/AlphabeticalPropertyOrderingStrategy.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
     {
16 16
         uasort(
17 17
             $properties,
18
-            static function (PropertyMetadata $a, PropertyMetadata $b): int {
18
+            static function(PropertyMetadata $a, PropertyMetadata $b): int {
19 19
                 return strcmp($a->name, $b->name);
20 20
             }
21 21
         );
Please login to merge, or discard this patch.
src/GraphNavigator/DeserializationGraphNavigator.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -166,11 +166,11 @@  discard block
 block discarded – undo
166 166
                 /** @var ClassMetadata $metadata */
167 167
                 $metadata = $this->metadataFactory->getMetadataForClass($type['name']);
168 168
 
169
-                if ($metadata->usingExpression && !$this->expressionExclusionStrategy) {
169
+                if ($metadata->usingExpression && ! $this->expressionExclusionStrategy) {
170 170
                     throw new ExpressionLanguageRequiredException(sprintf('To use conditional exclude/expose in %s you must configure the expression language.', $metadata->name));
171 171
                 }
172 172
 
173
-                if (!empty($metadata->discriminatorMap) && $type['name'] === $metadata->discriminatorBaseClass) {
173
+                if ( ! empty($metadata->discriminatorMap) && $type['name'] === $metadata->discriminatorBaseClass) {
174 174
                     $metadata = $this->resolveMetadata($data, $metadata);
175 175
                 }
176 176
 
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
     {
222 222
         $typeValue = $this->visitor->visitDiscriminatorMapProperty($data, $metadata);
223 223
 
224
-        if (!isset($metadata->discriminatorMap[$typeValue])) {
224
+        if ( ! isset($metadata->discriminatorMap[$typeValue])) {
225 225
             throw new LogicException(sprintf(
226 226
                 'The type value "%s" does not exist in the discriminator map of class "%s". Available types: %s',
227 227
                 $typeValue,
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
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 
82 82
         if (false !== stripos($data, '<!doctype')) {
83 83
             $internalSubset = $this->getDomDocumentTypeEntitySubset($data);
84
-            if (!in_array($internalSubset, $this->doctypeWhitelist, true)) {
84
+            if ( ! in_array($internalSubset, $this->doctypeWhitelist, true)) {
85 85
                 throw new InvalidArgumentException(sprintf(
86 86
                     'The document type "%s" is not allowed. If it is safe, you may add it to the whitelist configuration.',
87 87
                     $internalSubset
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
             $nodes = $data->xpath($entryName);
198 198
         }
199 199
 
200
-        if (!\count($nodes)) {
200
+        if ( ! \count($nodes)) {
201 201
             return [];
202 202
         }
203 203
 
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
                 $nodes = $data->children($namespace)->$entryName;
226 226
                 foreach ($nodes as $v) {
227 227
                     $attrs = $v->attributes();
228
-                    if (!isset($attrs[$this->currentMetadata->xmlKeyAttribute])) {
228
+                    if ( ! isset($attrs[$this->currentMetadata->xmlKeyAttribute])) {
229 229
                         throw new RuntimeException(sprintf('The key attribute "%s" must be set for each entry of the map.', $this->currentMetadata->xmlKeyAttribute));
230 230
                     }
231 231
 
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
                 return (string) $data->attributes($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName};
255 255
 
256 256
             // Check XML element with namespace for discriminatorFieldName
257
-            case !$metadata->xmlDiscriminatorAttribute && null !== $metadata->xmlDiscriminatorNamespace && isset($data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}):
257
+            case ! $metadata->xmlDiscriminatorAttribute && null !== $metadata->xmlDiscriminatorNamespace && isset($data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}):
258 258
                 return (string) $data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName};
259 259
             // Check XML element for discriminatorFieldName
260 260
             case isset($data->{$metadata->discriminatorFieldName}):
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
         $name = $metadata->serializedName;
283 283
 
284 284
         if (true === $metadata->inline) {
285
-            if (!$metadata->type) {
285
+            if ( ! $metadata->type) {
286 286
                 throw RuntimeException::noMetadataForProperty($metadata->class, $metadata->name);
287 287
             }
288 288
             return $this->navigator->accept($data, $metadata->type);
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
         if ($metadata->xmlAttribute) {
291 291
             $attributes = $data->attributes($metadata->xmlNamespace);
292 292
             if (isset($attributes[$name])) {
293
-                if (!$metadata->type) {
293
+                if ( ! $metadata->type) {
294 294
                     throw RuntimeException::noMetadataForProperty($metadata->class, $metadata->name);
295 295
                 }
296 296
                 return $this->navigator->accept($attributes[$name], $metadata->type);
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
         }
301 301
 
302 302
         if ($metadata->xmlValue) {
303
-            if (!$metadata->type) {
303
+            if ( ! $metadata->type) {
304 304
                 throw RuntimeException::noMetadataForProperty($metadata->class, $metadata->name);
305 305
             }
306 306
             return $this->navigator->accept($data, $metadata->type);
@@ -308,12 +308,12 @@  discard block
 block discarded – undo
308 308
 
309 309
         if ($metadata->xmlCollection) {
310 310
             $enclosingElem = $data;
311
-            if (!$metadata->xmlCollectionInline) {
311
+            if ( ! $metadata->xmlCollectionInline) {
312 312
                 $enclosingElem = $data->children($metadata->xmlNamespace)->$name;
313 313
             }
314 314
 
315 315
             $this->setCurrentMetadata($metadata);
316
-            if (!$metadata->type) {
316
+            if ( ! $metadata->type) {
317 317
                 throw RuntimeException::noMetadataForProperty($metadata->class, $metadata->name);
318 318
             }
319 319
             $v = $this->navigator->accept($enclosingElem, $metadata->type);
@@ -323,13 +323,13 @@  discard block
 block discarded – undo
323 323
 
324 324
         if ($metadata->xmlNamespace) {
325 325
             $node = $data->children($metadata->xmlNamespace)->$name;
326
-            if (!$node->count()) {
326
+            if ( ! $node->count()) {
327 327
                 throw new NotAcceptableException();
328 328
             }
329 329
         } elseif ('' === $metadata->xmlNamespace) {
330 330
             // See #1087 - element must be like: <element xmlns="" /> - https://www.w3.org/TR/REC-xml-names/#iri-use
331 331
             // Use of an empty string in a namespace declaration turns it into an "undeclaration".
332
-            $nodes = $data->xpath('./' . $name);
332
+            $nodes = $data->xpath('./'.$name);
333 333
             if (empty($nodes)) {
334 334
                 throw new NotAcceptableException();
335 335
             }
@@ -339,9 +339,9 @@  discard block
 block discarded – undo
339 339
             if (isset($namespaces[''])) {
340 340
                 $prefix = uniqid('ns-');
341 341
                 $data->registerXPathNamespace($prefix, $namespaces['']);
342
-                $nodes = $data->xpath('./' . $prefix . ':' . $name);
342
+                $nodes = $data->xpath('./'.$prefix.':'.$name);
343 343
             } else {
344
-                $nodes = $data->xpath('./' . $name);
344
+                $nodes = $data->xpath('./'.$name);
345 345
             }
346 346
             if (empty($nodes)) {
347 347
                 throw new NotAcceptableException();
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
             $this->setCurrentMetadata($metadata);
354 354
         }
355 355
 
356
-        if (!$metadata->type) {
356
+        if ( ! $metadata->type) {
357 357
             throw RuntimeException::noMetadataForProperty($metadata->class, $metadata->name);
358 358
         }
359 359
         return $this->navigator->accept($node, $metadata->type);
Please login to merge, or discard this patch.
src/EventDispatcher/EventDispatcher.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
     public static function getDefaultMethodName(string $eventName): string
32 32
     {
33
-        return 'on' . str_replace(['_', '.'], '', $eventName);
33
+        return 'on'.str_replace(['_', '.'], '', $eventName);
34 34
     }
35 35
 
36 36
     /**
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
     public function addSubscriber(EventSubscriberInterface $subscriber): void
57 57
     {
58 58
         foreach ($subscriber->getSubscribedEvents() as $eventData) {
59
-            if (!isset($eventData['event'])) {
59
+            if ( ! isset($eventData['event'])) {
60 60
                 throw new InvalidArgumentException(sprintf('Each event must have a "event" key.'));
61 61
             }
62 62
 
@@ -71,33 +71,33 @@  discard block
 block discarded – undo
71 71
 
72 72
     public function hasListeners(string $eventName, string $class, string $format): bool
73 73
     {
74
-        if (!isset($this->listeners[$eventName])) {
74
+        if ( ! isset($this->listeners[$eventName])) {
75 75
             return false;
76 76
         }
77 77
 
78
-        if (!isset($this->classListeners[$eventName][$class][$format])) {
78
+        if ( ! isset($this->classListeners[$eventName][$class][$format])) {
79 79
             $this->classListeners[$eventName][$class][$format] = $this->initializeListeners($eventName, $class, $format);
80 80
         }
81 81
 
82
-        return !!$this->classListeners[$eventName][$class][$format];
82
+        return ! ! $this->classListeners[$eventName][$class][$format];
83 83
     }
84 84
 
85 85
     public function dispatch(string $eventName, string $class, string $format, Event $event): void
86 86
     {
87
-        if (!isset($this->listeners[$eventName])) {
87
+        if ( ! isset($this->listeners[$eventName])) {
88 88
             return;
89 89
         }
90 90
 
91 91
         $object = $event instanceof ObjectEvent ? $event->getObject() : null;
92 92
         $realClass = is_object($object) ? get_class($object) : '';
93
-        $objectClass = $realClass !== $class ? ($realClass . $class) : $class;
93
+        $objectClass = $realClass !== $class ? ($realClass.$class) : $class;
94 94
 
95
-        if (!isset($this->classListeners[$eventName][$objectClass][$format])) {
95
+        if ( ! isset($this->classListeners[$eventName][$objectClass][$format])) {
96 96
             $this->classListeners[$eventName][$objectClass][$format] = $this->initializeListeners($eventName, $class, $format);
97 97
         }
98 98
 
99 99
         foreach ($this->classListeners[$eventName][$objectClass][$format] as $listener) {
100
-            if (!empty($listener[3]) && !($object instanceof $listener[3])) {
100
+            if ( ! empty($listener[3]) && ! ($object instanceof $listener[3])) {
101 101
                 continue;
102 102
             }
103 103
 
Please login to merge, or discard this patch.
src/EventDispatcher/LazyEventDispatcher.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
      */
21 21
     public function __construct($container)
22 22
     {
23
-        if (!$container instanceof PsrContainerInterface && !$container instanceof ContainerInterface) {
23
+        if ( ! $container instanceof PsrContainerInterface && ! $container instanceof ContainerInterface) {
24 24
             throw new InvalidArgumentException(sprintf('The container must be an instance of %s or %s (%s given).', PsrContainerInterface::class, ContainerInterface::class, \is_object($container) ? \get_class($container) : \gettype($container)));
25 25
         }
26 26
 
@@ -35,11 +35,11 @@  discard block
 block discarded – undo
35 35
         $listeners = parent::initializeListeners($eventName, $loweredClass, $format);
36 36
 
37 37
         foreach ($listeners as &$listener) {
38
-            if (!\is_array($listener[0]) || !\is_string($listener[0][0])) {
38
+            if ( ! \is_array($listener[0]) || ! \is_string($listener[0][0])) {
39 39
                 continue;
40 40
             }
41 41
 
42
-            if (!$this->container->has($listener[0][0])) {
42
+            if ( ! $this->container->has($listener[0][0])) {
43 43
                 continue;
44 44
             }
45 45
 
Please login to merge, or discard this patch.
src/SerializationContext.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
      */
63 63
     public function startVisiting($object): void
64 64
     {
65
-        if (!\is_object($object)) {
65
+        if ( ! \is_object($object)) {
66 66
             return;
67 67
         }
68 68
         $this->visitingSet->attach($object);
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
      */
75 75
     public function stopVisiting($object): void
76 76
     {
77
-        if (!\is_object($object)) {
77
+        if ( ! \is_object($object)) {
78 78
             return;
79 79
         }
80 80
         $this->visitingSet->detach($object);
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
      */
91 91
     public function isVisiting($object): bool
92 92
     {
93
-        if (!\is_object($object)) {
93
+        if ( ! \is_object($object)) {
94 94
             return false;
95 95
         }
96 96
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
             $path[] = \get_class($obj);
105 105
         }
106 106
 
107
-        if (!$path) {
107
+        if ( ! $path) {
108 108
             return null;
109 109
         }
110 110
 
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 
124 124
     public function getObject(): ?object
125 125
     {
126
-        return !$this->visitingStack->isEmpty() ? $this->visitingStack->top() : null;
126
+        return ! $this->visitingStack->isEmpty() ? $this->visitingStack->top() : null;
127 127
     }
128 128
 
129 129
     public function getVisitingStack(): \SplStack
Please login to merge, or discard this patch.