Passed
Pull Request — master (#928)
by Gabriel
03:30 queued 01:04
created
src/XmlDeserializationVisitor.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 
64 64
         if (false !== stripos($data, '<!doctype')) {
65 65
             $internalSubset = $this->getDomDocumentTypeEntitySubset($data);
66
-            if (!in_array($internalSubset, $this->doctypeWhitelist, true)) {
66
+            if ( ! in_array($internalSubset, $this->doctypeWhitelist, true)) {
67 67
                 throw new InvalidArgumentException(sprintf(
68 68
                     'The document type "%s" is not allowed. If it is safe, you may add it to the whitelist configuration.',
69 69
                     $internalSubset
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 
86 86
     private function emptyStringToSpaceCharacter($data)
87 87
     {
88
-        return $data === '' ? ' ' : (string)$data;
88
+        return $data === '' ? ' ' : (string) $data;
89 89
     }
90 90
 
91 91
     public function visitNull($data, array $type): void
@@ -95,12 +95,12 @@  discard block
 block discarded – undo
95 95
 
96 96
     public function visitString($data, array $type): string
97 97
     {
98
-        return (string)$data;
98
+        return (string) $data;
99 99
     }
100 100
 
101 101
     public function visitBoolean($data, array $type): bool
102 102
     {
103
-        $data = (string)$data;
103
+        $data = (string) $data;
104 104
 
105 105
         if ('true' === $data || '1' === $data) {
106 106
             return true;
@@ -113,12 +113,12 @@  discard block
 block discarded – undo
113 113
 
114 114
     public function visitInteger($data, array $type): int
115 115
     {
116
-        return (integer)$data;
116
+        return (integer) $data;
117 117
     }
118 118
 
119 119
     public function visitDouble($data, array $type): float
120 120
     {
121
-        return (double)$data;
121
+        return (double) $data;
122 122
     }
123 123
 
124 124
     public function visitArray($data, array $type): array
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
             $nodes = $data->xpath($entryName);
164 164
         }
165 165
 
166
-        if (!\count($nodes)) {
166
+        if ( ! \count($nodes)) {
167 167
             return array();
168 168
         }
169 169
 
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
                 $nodes = $data->children($namespace)->$entryName;
192 192
                 foreach ($nodes as $v) {
193 193
                     $attrs = $v->attributes();
194
-                    if (!isset($attrs[$this->currentMetadata->xmlKeyAttribute])) {
194
+                    if ( ! isset($attrs[$this->currentMetadata->xmlKeyAttribute])) {
195 195
                         throw new RuntimeException(sprintf('The key attribute "%s" must be set for each entry of the map.', $this->currentMetadata->xmlKeyAttribute));
196 196
                     }
197 197
 
@@ -211,18 +211,18 @@  discard block
 block discarded – undo
211 211
         switch (true) {
212 212
             // Check XML attribute without namespace for discriminatorFieldName
213 213
             case $metadata->xmlDiscriminatorAttribute && null === $metadata->xmlDiscriminatorNamespace && isset($data->attributes()->{$metadata->discriminatorFieldName}):
214
-                return (string)$data->attributes()->{$metadata->discriminatorFieldName};
214
+                return (string) $data->attributes()->{$metadata->discriminatorFieldName};
215 215
 
216 216
             // Check XML attribute with namespace for discriminatorFieldName
217 217
             case $metadata->xmlDiscriminatorAttribute && null !== $metadata->xmlDiscriminatorNamespace && isset($data->attributes($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}):
218
-                return (string)$data->attributes($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName};
218
+                return (string) $data->attributes($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName};
219 219
 
220 220
             // Check XML element with namespace for discriminatorFieldName
221
-            case !$metadata->xmlDiscriminatorAttribute && null !== $metadata->xmlDiscriminatorNamespace && isset($data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}):
222
-                return  (string)$data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName};
221
+            case ! $metadata->xmlDiscriminatorAttribute && null !== $metadata->xmlDiscriminatorNamespace && isset($data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}):
222
+                return  (string) $data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName};
223 223
             // Check XML element for discriminatorFieldName
224 224
             case isset($data->{$metadata->discriminatorFieldName}):
225
-                return (string)$data->{$metadata->discriminatorFieldName};
225
+                return (string) $data->{$metadata->discriminatorFieldName};
226 226
 
227 227
             default:
228 228
                 throw new LogicException(sprintf(
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
     {
244 244
         $name = $metadata->serializedName;
245 245
 
246
-        if (!$metadata->type) {
246
+        if ( ! $metadata->type) {
247 247
             throw new RuntimeException(sprintf('You must define a type for %s::$%s.', $metadata->reflection->class, $metadata->name));
248 248
         }
249 249
 
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 
264 264
         if ($metadata->xmlCollection) {
265 265
             $enclosingElem = $data;
266
-            if (!$metadata->xmlCollectionInline) {
266
+            if ( ! $metadata->xmlCollectionInline) {
267 267
                 $enclosingElem = $data->children($metadata->xmlNamespace)->$name;
268 268
             }
269 269
 
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 
276 276
         if ($metadata->xmlNamespace) {
277 277
             $node = $data->children($metadata->xmlNamespace)->$name;
278
-            if (!$node->count()) {
278
+            if ( ! $node->count()) {
279 279
                 throw new NotAcceptableException();
280 280
             }
281 281
         } else {
@@ -285,9 +285,9 @@  discard block
 block discarded – undo
285 285
             if (isset($namespaces[''])) {
286 286
                 $prefix = uniqid('ns-');
287 287
                 $data->registerXPathNamespace($prefix, $namespaces['']);
288
-                $nodes = $data->xpath('./' . $prefix . ':' . $name);
288
+                $nodes = $data->xpath('./'.$prefix.':'.$name);
289 289
             } else {
290
-                $nodes = $data->xpath('./' . $name);
290
+                $nodes = $data->xpath('./'.$name);
291 291
             }
292 292
             if (empty($nodes)) {
293 293
                 throw new NotAcceptableException();
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
 
401 401
             $xsiAttributes = $value->attributes('http://www.w3.org/2001/XMLSchema-instance');
402 402
             if (isset($xsiAttributes['nil'])
403
-                && ((string)$xsiAttributes['nil'] === 'true' || (string)$xsiAttributes['nil'] === '1')
403
+                && ((string) $xsiAttributes['nil'] === 'true' || (string) $xsiAttributes['nil'] === '1')
404 404
             ) {
405 405
                 return true;
406 406
             }
Please login to merge, or discard this patch.