Passed
Pull Request — master (#927)
by Michael
03:08
created
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.