Passed
Pull Request — master (#927)
by Michael
03:08
created
src/Handler/StdClassHandler.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
         $classMetadata = $context->getMetadataFactory()->getMetadataForClass('stdClass');
53 53
         $visitor->startVisitingObject($classMetadata, $stdClass, ['name' => 'stdClass'], $context);
54 54
 
55
-        foreach ((array)$stdClass as $name => $value) {
55
+        foreach ((array) $stdClass as $name => $value) {
56 56
             $metadata = new StaticPropertyMetadata('stdClass', $name, $value);
57 57
             $visitor->visitProperty($metadata, $value);
58 58
         }
Please login to merge, or discard this patch.
src/Construction/DoctrineObjectConstructor.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
         // Locate possible ObjectManager
66 66
         $objectManager = $this->managerRegistry->getManagerForClass($metadata->name);
67 67
 
68
-        if (!$objectManager) {
68
+        if ( ! $objectManager) {
69 69
             // No ObjectManager found, proceed with normal deserialization
70 70
             return $this->fallbackConstructor->construct($visitor, $metadata, $data, $type, $context);
71 71
         }
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
         }
80 80
 
81 81
         // Managed entity, check for proxy load
82
-        if (!\is_array($data)) {
82
+        if ( ! \is_array($data)) {
83 83
             // Single identifier, load proxy
84 84
             return $objectManager->getReference($metadata->name, $data);
85 85
         }
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
         $identifierList = [];
90 90
 
91 91
         foreach ($classMetadata->getIdentifierFieldNames() as $name) {
92
-            if (!array_key_exists($name, $data)) {
92
+            if ( ! array_key_exists($name, $data)) {
93 93
                 return $this->fallbackConstructor->construct($visitor, $metadata, $data, $type, $context);
94 94
             }
95 95
 
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
@@ -66,13 +66,13 @@
 block discarded – undo
66 66
      */
67 67
     public function evaluate($expression, array $data = [])
68 68
     {
69
-        if (!\is_string($expression)) {
69
+        if ( ! \is_string($expression)) {
70 70
             return $expression;
71 71
         }
72 72
 
73 73
         $context = $data + $this->context;
74 74
 
75
-        if (!array_key_exists($expression, $this->cache)) {
75
+        if ( ! array_key_exists($expression, $this->cache)) {
76 76
             $this->cache[$expression] = $this->expressionLanguage->parse($expression, array_keys($context));
77 77
         }
78 78
 
Please login to merge, or discard this patch.
src/Exclusion/GroupsExclusionStrategy.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
     {
56 56
         $groups = $this->getGroupsFor($navigatorContext);
57 57
 
58
-        if (!$property->groups) {
59
-            return !in_array(self::DEFAULT_GROUP, $groups);
58
+        if ( ! $property->groups) {
59
+            return ! in_array(self::DEFAULT_GROUP, $groups);
60 60
         }
61 61
 
62 62
         return $this->shouldSkipUsingGroups($property, $groups);
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 
80 80
         $groups = $this->groups;
81 81
         foreach ($paths as $index => $path) {
82
-            if (!array_key_exists($path, $groups)) {
82
+            if ( ! array_key_exists($path, $groups)) {
83 83
                 if ($index > 0) {
84 84
                     $groups = [self::DEFAULT_GROUP];
85 85
                 }
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
                 break;
88 88
             }
89 89
 
90
-            if (!is_array($groups[$path])) {
90
+            if ( ! is_array($groups[$path])) {
91 91
                 throw new RuntimeException(sprintf('The group value for the property path "%s" should be an array, "%s" given', $index, gettype($groups[$path])));
92 92
             }
93 93
 
Please login to merge, or discard this patch.
src/Context.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
             $this->addExclusionStrategy(new VersionExclusionStrategy($this->attributes['version']));
90 90
         }
91 91
 
92
-        if (!empty($this->attributes['max_depth_checks'])) {
92
+        if ( ! empty($this->attributes['max_depth_checks'])) {
93 93
             $this->addExclusionStrategy(new DepthExclusionStrategy());
94 94
         }
95 95
 
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 
137 137
     private function assertMutable(): void
138 138
     {
139
-        if (!$this->initialized) {
139
+        if ( ! $this->initialized) {
140 140
             return;
141 141
         }
142 142
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
             throw new LogicException('The groups must not be empty.');
169 169
         }
170 170
 
171
-        $this->attributes['groups'] = (array)$groups;
171
+        $this->attributes['groups'] = (array) $groups;
172 172
 
173 173
         return $this;
174 174
     }
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
     {
226 226
         $metadata = $this->metadataStack->pop();
227 227
 
228
-        if (!$metadata instanceof PropertyMetadata) {
228
+        if ( ! $metadata instanceof PropertyMetadata) {
229 229
             throw new RuntimeException('Context metadataStack not working well');
230 230
         }
231 231
     }
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
     {
235 235
         $metadata = $this->metadataStack->pop();
236 236
 
237
-        if (!$metadata instanceof ClassMetadata) {
237
+        if ( ! $metadata instanceof ClassMetadata) {
238 238
             throw new RuntimeException('Context metadataStack not working well');
239 239
         }
240 240
     }
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
      */
250 250
     public function getCurrentPath()
251 251
     {
252
-        if (!$this->metadataStack) {
252
+        if ( ! $this->metadataStack) {
253 253
             return [];
254 254
         }
255 255
 
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
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 
38 38
     public static function getDefaultMethodName($eventName)
39 39
     {
40
-        return 'on' . str_replace(['_', '.'], '', $eventName);
40
+        return 'on'.str_replace(['_', '.'], '', $eventName);
41 41
     }
42 42
 
43 43
     /**
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
     public function addSubscriber(EventSubscriberInterface $subscriber)
61 61
     {
62 62
         foreach ($subscriber->getSubscribedEvents() as $eventData) {
63
-            if (!isset($eventData['event'])) {
63
+            if ( ! isset($eventData['event'])) {
64 64
                 throw new InvalidArgumentException(sprintf('Each event must have a "event" key.'));
65 65
             }
66 66
 
@@ -75,30 +75,30 @@  discard block
 block discarded – undo
75 75
 
76 76
     public function hasListeners($eventName, $class, $format)
77 77
     {
78
-        if (!isset($this->listeners[$eventName])) {
78
+        if ( ! isset($this->listeners[$eventName])) {
79 79
             return false;
80 80
         }
81 81
 
82
-        if (!isset($this->classListeners[$eventName][$class][$format])) {
82
+        if ( ! isset($this->classListeners[$eventName][$class][$format])) {
83 83
             $this->classListeners[$eventName][$class][$format] = $this->initializeListeners($eventName, $class, $format);
84 84
         }
85 85
 
86
-        return !!$this->classListeners[$eventName][$class][$format];
86
+        return ! ! $this->classListeners[$eventName][$class][$format];
87 87
     }
88 88
 
89 89
     public function dispatch($eventName, $class, $format, Event $event)
90 90
     {
91
-        if (!isset($this->listeners[$eventName])) {
91
+        if ( ! isset($this->listeners[$eventName])) {
92 92
             return;
93 93
         }
94 94
 
95 95
         $object = $event instanceof ObjectEvent ? $event->getObject() : null;
96
-        $objectClass = $object ? (get_class($object) . $class) : $class;
96
+        $objectClass = $object ? (get_class($object).$class) : $class;
97 97
 
98
-        if (!isset($this->classListeners[$eventName][$objectClass][$format])) {
98
+        if ( ! isset($this->classListeners[$eventName][$objectClass][$format])) {
99 99
             $this->classListeners[$eventName][$objectClass][$format] = [];
100 100
             foreach ($this->initializeListeners($eventName, $class, $format) as $listener) {
101
-                if ($listener[3] !== null && !($object instanceof $listener[3])) {
101
+                if ($listener[3] !== null && ! ($object instanceof $listener[3])) {
102 102
                     continue;
103 103
                 }
104 104
 
Please login to merge, or discard this patch.
src/XmlDeserializationVisitor.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 
61 61
         if (false !== stripos($data, '<!doctype')) {
62 62
             $internalSubset = $this->getDomDocumentTypeEntitySubset($data);
63
-            if (!in_array($internalSubset, $this->doctypeWhitelist, true)) {
63
+            if ( ! in_array($internalSubset, $this->doctypeWhitelist, true)) {
64 64
                 throw new InvalidArgumentException(sprintf(
65 65
                     'The document type "%s" is not allowed. If it is safe, you may add it to the whitelist configuration.',
66 66
                     $internalSubset
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 
83 83
     private function emptyStringToSpaceCharacter($data)
84 84
     {
85
-        return $data === '' ? ' ' : (string)$data;
85
+        return $data === '' ? ' ' : (string) $data;
86 86
     }
87 87
 
88 88
     public function visitNull($data, array $type): void
@@ -92,12 +92,12 @@  discard block
 block discarded – undo
92 92
 
93 93
     public function visitString($data, array $type): string
94 94
     {
95
-        return (string)$data;
95
+        return (string) $data;
96 96
     }
97 97
 
98 98
     public function visitBoolean($data, array $type): bool
99 99
     {
100
-        $data = (string)$data;
100
+        $data = (string) $data;
101 101
 
102 102
         if ('true' === $data || '1' === $data) {
103 103
             return true;
@@ -110,12 +110,12 @@  discard block
 block discarded – undo
110 110
 
111 111
     public function visitInteger($data, array $type): int
112 112
     {
113
-        return (integer)$data;
113
+        return (integer) $data;
114 114
     }
115 115
 
116 116
     public function visitDouble($data, array $type): float
117 117
     {
118
-        return (double)$data;
118
+        return (double) $data;
119 119
     }
120 120
 
121 121
     public function visitArray($data, array $type): array
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
             $nodes = $data->xpath($entryName);
161 161
         }
162 162
 
163
-        if (!\count($nodes)) {
163
+        if ( ! \count($nodes)) {
164 164
             return [];
165 165
         }
166 166
 
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
                 $nodes = $data->children($namespace)->$entryName;
189 189
                 foreach ($nodes as $v) {
190 190
                     $attrs = $v->attributes();
191
-                    if (!isset($attrs[$this->currentMetadata->xmlKeyAttribute])) {
191
+                    if ( ! isset($attrs[$this->currentMetadata->xmlKeyAttribute])) {
192 192
                         throw new RuntimeException(sprintf('The key attribute "%s" must be set for each entry of the map.', $this->currentMetadata->xmlKeyAttribute));
193 193
                     }
194 194
 
@@ -208,18 +208,18 @@  discard block
 block discarded – undo
208 208
         switch (true) {
209 209
             // Check XML attribute without namespace for discriminatorFieldName
210 210
             case $metadata->xmlDiscriminatorAttribute && null === $metadata->xmlDiscriminatorNamespace && isset($data->attributes()->{$metadata->discriminatorFieldName}):
211
-                return (string)$data->attributes()->{$metadata->discriminatorFieldName};
211
+                return (string) $data->attributes()->{$metadata->discriminatorFieldName};
212 212
 
213 213
             // Check XML attribute with namespace for discriminatorFieldName
214 214
             case $metadata->xmlDiscriminatorAttribute && null !== $metadata->xmlDiscriminatorNamespace && isset($data->attributes($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}):
215
-                return (string)$data->attributes($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName};
215
+                return (string) $data->attributes($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName};
216 216
 
217 217
             // Check XML element with namespace for discriminatorFieldName
218
-            case !$metadata->xmlDiscriminatorAttribute && null !== $metadata->xmlDiscriminatorNamespace && isset($data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}):
219
-                return  (string)$data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName};
218
+            case ! $metadata->xmlDiscriminatorAttribute && null !== $metadata->xmlDiscriminatorNamespace && isset($data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}):
219
+                return  (string) $data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName};
220 220
             // Check XML element for discriminatorFieldName
221 221
             case isset($data->{$metadata->discriminatorFieldName}):
222
-                return (string)$data->{$metadata->discriminatorFieldName};
222
+                return (string) $data->{$metadata->discriminatorFieldName};
223 223
 
224 224
             default:
225 225
                 throw new LogicException(sprintf(
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
     {
241 241
         $name = $metadata->serializedName;
242 242
 
243
-        if (!$metadata->type) {
243
+        if ( ! $metadata->type) {
244 244
             throw new RuntimeException(sprintf('You must define a type for %s::$%s.', $metadata->reflection->class, $metadata->name));
245 245
         }
246 246
 
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 
261 261
         if ($metadata->xmlCollection) {
262 262
             $enclosingElem = $data;
263
-            if (!$metadata->xmlCollectionInline) {
263
+            if ( ! $metadata->xmlCollectionInline) {
264 264
                 $enclosingElem = $data->children($metadata->xmlNamespace)->$name;
265 265
             }
266 266
 
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 
273 273
         if ($metadata->xmlNamespace) {
274 274
             $node = $data->children($metadata->xmlNamespace)->$name;
275
-            if (!$node->count()) {
275
+            if ( ! $node->count()) {
276 276
                 throw new NotAcceptableException();
277 277
             }
278 278
         } else {
@@ -282,9 +282,9 @@  discard block
 block discarded – undo
282 282
             if (isset($namespaces[''])) {
283 283
                 $prefix = uniqid('ns-');
284 284
                 $data->registerXPathNamespace($prefix, $namespaces['']);
285
-                $nodes = $data->xpath('./' . $prefix . ':' . $name);
285
+                $nodes = $data->xpath('./'.$prefix.':'.$name);
286 286
             } else {
287
-                $nodes = $data->xpath('./' . $name);
287
+                $nodes = $data->xpath('./'.$name);
288 288
             }
289 289
             if (empty($nodes)) {
290 290
                 throw new NotAcceptableException();
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 
398 398
             $xsiAttributes = $value->attributes('http://www.w3.org/2001/XMLSchema-instance');
399 399
             if (isset($xsiAttributes['nil'])
400
-                && ((string)$xsiAttributes['nil'] === 'true' || (string)$xsiAttributes['nil'] === '1')
400
+                && ((string) $xsiAttributes['nil'] === 'true' || (string) $xsiAttributes['nil'] === '1')
401 401
             ) {
402 402
                 return true;
403 403
             }
Please login to merge, or discard this patch.