Completed
Pull Request — master (#886)
by Florent
10:43
created
src/JMS/Serializer/YamlSerializationVisitor.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
         $isHash = isset($type['params'][1]);
86 86
 
87 87
         $count = $this->writer->changeCount;
88
-        $isList = (isset($type['params'][0]) && !isset($type['params'][1]))
88
+        $isList = (isset($type['params'][0]) && ! isset($type['params'][1]))
89 89
             || array_keys($data) === range(0, \count($data) - 1);
90 90
 
91 91
         foreach ($data as $k => $v) {
@@ -93,10 +93,10 @@  discard block
 block discarded – undo
93 93
                 continue;
94 94
             }
95 95
 
96
-            if ($isList && !$isHash) {
96
+            if ($isList && ! $isHash) {
97 97
                 $this->writer->writeln('-');
98 98
             } else {
99
-                $this->writer->writeln(Inline::dump($k) . ':');
99
+                $this->writer->writeln(Inline::dump($k).':');
100 100
             }
101 101
 
102 102
             $this->writer->indent();
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
             if (null !== $v = $this->navigator->accept($v, $this->getElementType($type), $context)) {
105 105
                 $this->writer
106 106
                     ->rtrim(false)
107
-                    ->writeln(' ' . $v);
107
+                    ->writeln(' '.$v);
108 108
             }
109 109
 
110 110
             $this->writer->outdent();
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 
135 135
     public function visitDouble($data, array $type, Context $context)
136 136
     {
137
-        $v = (string)$data;
137
+        $v = (string) $data;
138 138
 
139 139
         if ('' === $this->writer->content) {
140 140
             $this->writer->writeln($v);
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 
146 146
     public function visitInteger($data, array $type, Context $context)
147 147
     {
148
-        $v = (string)$data;
148
+        $v = (string) $data;
149 149
 
150 150
         if ('' === $this->writer->content) {
151 151
             $this->writer->writeln($v);
@@ -172,9 +172,9 @@  discard block
 block discarded – undo
172 172
             $name = $this->namingStrategy->translateName($metadata);
173 173
         }
174 174
 
175
-        if (!$metadata->inline) {
175
+        if ( ! $metadata->inline) {
176 176
             $this->writer
177
-                ->writeln(Inline::dump($name) . ':')
177
+                ->writeln(Inline::dump($name).':')
178 178
                 ->indent();
179 179
         }
180 180
 
@@ -185,12 +185,12 @@  discard block
 block discarded – undo
185 185
         if (null !== $v = $this->navigator->accept($v, $metadata->type, $context)) {
186 186
             $this->writer
187 187
                 ->rtrim(false)
188
-                ->writeln(' ' . $v);
189
-        } elseif ($count === $this->writer->changeCount && !$metadata->inline) {
188
+                ->writeln(' '.$v);
189
+        } elseif ($count === $this->writer->changeCount && ! $metadata->inline) {
190 190
             $this->writer->revert();
191 191
         }
192 192
 
193
-        if (!$metadata->inline) {
193
+        if ( ! $metadata->inline) {
194 194
             $this->writer->outdent();
195 195
         }
196 196
         $this->revertCurrentMetadata();
Please login to merge, or discard this patch.
src/JMS/Serializer/XmlSerializationVisitor.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -125,24 +125,24 @@  discard block
 block discarded – undo
125 125
 
126 126
         if (null === $this->document) {
127 127
             $this->document = $this->createDocument(null, null, true);
128
-            $this->currentNode->appendChild($doCData ? $this->document->createCDATASection($data) : $this->document->createTextNode((string)$data));
128
+            $this->currentNode->appendChild($doCData ? $this->document->createCDATASection($data) : $this->document->createTextNode((string) $data));
129 129
 
130 130
             return;
131 131
         }
132 132
 
133
-        return $doCData ? $this->document->createCDATASection($data) : $this->document->createTextNode((string)$data);
133
+        return $doCData ? $this->document->createCDATASection($data) : $this->document->createTextNode((string) $data);
134 134
     }
135 135
 
136 136
     public function visitSimpleString($data, array $type, Context $context)
137 137
     {
138 138
         if (null === $this->document) {
139 139
             $this->document = $this->createDocument(null, null, true);
140
-            $this->currentNode->appendChild($this->document->createTextNode((string)$data));
140
+            $this->currentNode->appendChild($this->document->createTextNode((string) $data));
141 141
 
142 142
             return;
143 143
         }
144 144
 
145
-        return $this->document->createTextNode((string)$data);
145
+        return $this->document->createTextNode((string) $data);
146 146
     }
147 147
 
148 148
     public function visitBoolean($data, array $type, Context $context)
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
             $this->setCurrentNode($entryNode);
191 191
 
192 192
             if (null !== $keyAttributeName) {
193
-                $entryNode->setAttribute($keyAttributeName, (string)$k);
193
+                $entryNode->setAttribute($keyAttributeName, (string) $k);
194 194
             }
195 195
 
196 196
             if (null !== $node = $this->navigator->accept($v, $this->getElementType($type), $context)) {
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
             $node = $this->navigator->accept($v, $metadata->type, $context);
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
             if ($this->namingStrategy instanceof AdvancedNamingStrategyInterface) {
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
         }
257 257
 
258 258
         if (($metadata->xmlValue && $this->currentNode->childNodes->length > 0)
259
-            || (!$metadata->xmlValue && $this->hasValue)
259
+            || ( ! $metadata->xmlValue && $this->hasValue)
260 260
         ) {
261 261
             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));
262 262
         }
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
             $node = $this->navigator->accept($v, $metadata->type, $context);
269 269
             $this->revertCurrentMetadata();
270 270
 
271
-            if (!$node instanceof \DOMCharacterData) {
271
+            if ( ! $node instanceof \DOMCharacterData) {
272 272
                 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)));
273 273
             }
274 274
 
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
         }
279 279
 
280 280
         if ($metadata->xmlAttributeMap) {
281
-            if (!\is_array($v)) {
281
+            if ( ! \is_array($v)) {
282 282
                 throw new RuntimeException(sprintf('Unsupported value type for XML attribute map. Expected array but got %s.', \gettype($v)));
283 283
             }
284 284
 
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
                 $node = $this->navigator->accept($value, null, $context);
288 288
                 $this->revertCurrentMetadata();
289 289
 
290
-                if (!$node instanceof \DOMCharacterData) {
290
+                if ( ! $node instanceof \DOMCharacterData) {
291 291
                     throw new RuntimeException(sprintf('Unsupported value for a XML attribute map value. Expected character data, but got %s.', json_encode($v)));
292 292
                 }
293 293
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
             return;
298 298
         }
299 299
 
300
-        if ($addEnclosingElement = !$this->isInLineCollection($metadata) && !$metadata->inline) {
300
+        if ($addEnclosingElement = ! $this->isInLineCollection($metadata) && ! $metadata->inline) {
301 301
             if ($this->namingStrategy instanceof AdvancedNamingStrategyInterface) {
302 302
                 $elementName = $this->namingStrategy->getPropertyName($metadata, $context);
303 303
             } else {
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 
345 345
     private function isSkippableEmptyObject($node, PropertyMetadata $metadata)
346 346
     {
347
-        return $node === null && !$metadata->xmlCollection && $metadata->skipWhenEmpty;
347
+        return $node === null && ! $metadata->xmlCollection && $metadata->skipWhenEmpty;
348 348
     }
349 349
 
350 350
     private function isSkippableCollection(PropertyMetadata $metadata)
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 
355 355
     private function isElementEmpty(\DOMElement $element)
356 356
     {
357
-        return !$element->hasChildNodes() && !$element->hasAttributes();
357
+        return ! $element->hasChildNodes() && ! $element->hasAttributes();
358 358
     }
359 359
 
360 360
     public function endVisitingObject(ClassMetadata $metadata, $data, array $type, Context $context)
@@ -433,12 +433,12 @@  discard block
 block discarded – undo
433 433
     {
434 434
         if (null === $this->document) {
435 435
             $this->document = $this->createDocument(null, null, true);
436
-            $this->currentNode->appendChild($textNode = $this->document->createTextNode((string)$data));
436
+            $this->currentNode->appendChild($textNode = $this->document->createTextNode((string) $data));
437 437
 
438 438
             return $textNode;
439 439
         }
440 440
 
441
-        return $this->document->createTextNode((string)$data);
441
+        return $this->document->createTextNode((string) $data);
442 442
     }
443 443
 
444 444
     /**
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
 
456 456
     private function attachNullNamespace()
457 457
     {
458
-        if (!$this->nullWasVisited) {
458
+        if ( ! $this->nullWasVisited) {
459 459
             $this->document->documentElement->setAttributeNS(
460 460
                 'http://www.w3.org/2000/xmlns/',
461 461
                 'xmlns:xsi',
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
         foreach ($metadata->xmlNamespaces as $prefix => $uri) {
477 477
             $attribute = 'xmlns';
478 478
             if ($prefix !== '') {
479
-                $attribute .= ':' . $prefix;
479
+                $attribute .= ':'.$prefix;
480 480
             } elseif ($element->namespaceURI === $uri) {
481 481
                 continue;
482 482
             }
@@ -492,19 +492,19 @@  discard block
 block discarded – undo
492 492
         if ($this->currentNode->isDefaultNamespace($namespace)) {
493 493
             return $this->document->createElementNS($namespace, $tagName);
494 494
         }
495
-        if (!($prefix = $this->currentNode->lookupPrefix($namespace)) && !($prefix = $this->document->lookupPrefix($namespace))) {
496
-            $prefix = 'ns-' . substr(sha1($namespace), 0, 8);
495
+        if ( ! ($prefix = $this->currentNode->lookupPrefix($namespace)) && ! ($prefix = $this->document->lookupPrefix($namespace))) {
496
+            $prefix = 'ns-'.substr(sha1($namespace), 0, 8);
497 497
         }
498
-        return $this->document->createElementNS($namespace, $prefix . ':' . $tagName);
498
+        return $this->document->createElementNS($namespace, $prefix.':'.$tagName);
499 499
     }
500 500
 
501 501
     private function setAttributeOnNode(\DOMElement $node, $name, $value, $namespace = null)
502 502
     {
503 503
         if (null !== $namespace) {
504
-            if (!$prefix = $node->lookupPrefix($namespace)) {
505
-                $prefix = 'ns-' . substr(sha1($namespace), 0, 8);
504
+            if ( ! $prefix = $node->lookupPrefix($namespace)) {
505
+                $prefix = 'ns-'.substr(sha1($namespace), 0, 8);
506 506
             }
507
-            $node->setAttributeNS($namespace, $prefix . ':' . $name, $value);
507
+            $node->setAttributeNS($namespace, $prefix.':'.$name, $value);
508 508
         } else {
509 509
             $node->setAttribute($name, $value);
510 510
         }
@@ -528,6 +528,6 @@  discard block
 block discarded – undo
528 528
      */
529 529
     public function setFormatOutput($formatOutput)
530 530
     {
531
-        $this->formatOutput = (boolean)$formatOutput;
531
+        $this->formatOutput = (boolean) $formatOutput;
532 532
     }
533 533
 }
Please login to merge, or discard this patch.
src/JMS/Serializer/Metadata/Driver/YamlDriver.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
     {
36 36
         $config = Yaml::parse(file_get_contents($file));
37 37
 
38
-        if (!isset($config[$name = $class->name])) {
38
+        if ( ! isset($config[$name = $class->name])) {
39 39
             throw new RuntimeException(sprintf('Expected metadata for class %s to be defined in %s.', $class->name, $file));
40 40
         }
41 41
 
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
         $metadata->fileResources[] = $file;
45 45
         $metadata->fileResources[] = $class->getFileName();
46 46
         $exclusionPolicy = isset($config['exclusion_policy']) ? strtoupper($config['exclusion_policy']) : 'NONE';
47
-        $excludeAll = isset($config['exclude']) ? (Boolean)$config['exclude'] : false;
47
+        $excludeAll = isset($config['exclude']) ? (Boolean) $config['exclude'] : false;
48 48
         $classAccessType = isset($config['access_type']) ? $config['access_type'] : PropertyMetadata::ACCESS_TYPE_PROPERTY;
49
-        $readOnlyClass = isset($config['read_only']) ? (Boolean)$config['read_only'] : false;
49
+        $readOnlyClass = isset($config['read_only']) ? (Boolean) $config['read_only'] : false;
50 50
         $this->addClassProperties($metadata, $config);
51 51
 
52 52
         $propertiesMetadata = array();
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
 
59 59
                 } else {
60 60
 
61
-                    if (!$class->hasMethod($methodName)) {
62
-                        throw new RuntimeException('The method ' . $methodName . ' not found in class ' . $class->name);
61
+                    if ( ! $class->hasMethod($methodName)) {
62
+                        throw new RuntimeException('The method '.$methodName.' not found in class '.$class->name);
63 63
                     }
64 64
                     $virtualPropertyMetadata = new VirtualPropertyMetadata($name, $methodName);
65 65
                 }
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
             }
69 69
         }
70 70
 
71
-        if (!$excludeAll) {
71
+        if ( ! $excludeAll) {
72 72
             foreach ($class->getProperties() as $property) {
73 73
                 if ($property->class !== $name || (isset($property->info) && $property->info['class'] !== $name)) {
74 74
                     continue;
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
                     $pConfig = $config['properties'][$pName];
89 89
 
90 90
                     if (isset($pConfig['exclude'])) {
91
-                        $isExclude = (Boolean)$pConfig['exclude'];
91
+                        $isExclude = (Boolean) $pConfig['exclude'];
92 92
                     }
93 93
 
94 94
                     if ($isExclude) {
@@ -96,35 +96,35 @@  discard block
 block discarded – undo
96 96
                     }
97 97
 
98 98
                     if (isset($pConfig['expose'])) {
99
-                        $isExpose = (Boolean)$pConfig['expose'];
99
+                        $isExpose = (Boolean) $pConfig['expose'];
100 100
                     }
101 101
 
102 102
                     if (isset($pConfig['skip_when_empty'])) {
103
-                        $pMetadata->skipWhenEmpty = (Boolean)$pConfig['skip_when_empty'];
103
+                        $pMetadata->skipWhenEmpty = (Boolean) $pConfig['skip_when_empty'];
104 104
                     }
105 105
 
106 106
                     if (isset($pConfig['since_version'])) {
107
-                        $pMetadata->sinceVersion = (string)$pConfig['since_version'];
107
+                        $pMetadata->sinceVersion = (string) $pConfig['since_version'];
108 108
                     }
109 109
 
110 110
                     if (isset($pConfig['until_version'])) {
111
-                        $pMetadata->untilVersion = (string)$pConfig['until_version'];
111
+                        $pMetadata->untilVersion = (string) $pConfig['until_version'];
112 112
                     }
113 113
 
114 114
                     if (isset($pConfig['exclude_if'])) {
115
-                        $pMetadata->excludeIf = (string)$pConfig['exclude_if'];
115
+                        $pMetadata->excludeIf = (string) $pConfig['exclude_if'];
116 116
                     }
117 117
 
118 118
                     if (isset($pConfig['expose_if'])) {
119
-                        $pMetadata->excludeIf = "!(" . $pConfig['expose_if'] . ")";
119
+                        $pMetadata->excludeIf = "!(".$pConfig['expose_if'].")";
120 120
                     }
121 121
 
122 122
                     if (isset($pConfig['serialized_name'])) {
123
-                        $pMetadata->serializedName = (string)$pConfig['serialized_name'];
123
+                        $pMetadata->serializedName = (string) $pConfig['serialized_name'];
124 124
                     }
125 125
 
126 126
                     if (isset($pConfig['type'])) {
127
-                        $pMetadata->setType((string)$pConfig['type']);
127
+                        $pMetadata->setType((string) $pConfig['type']);
128 128
                     }
129 129
 
130 130
                     if (isset($pConfig['groups'])) {
@@ -136,21 +136,21 @@  discard block
 block discarded – undo
136 136
 
137 137
                         $colConfig = $pConfig['xml_list'];
138 138
                         if (isset($colConfig['inline'])) {
139
-                            $pMetadata->xmlCollectionInline = (Boolean)$colConfig['inline'];
139
+                            $pMetadata->xmlCollectionInline = (Boolean) $colConfig['inline'];
140 140
                         }
141 141
 
142 142
                         if (isset($colConfig['entry_name'])) {
143
-                            $pMetadata->xmlEntryName = (string)$colConfig['entry_name'];
143
+                            $pMetadata->xmlEntryName = (string) $colConfig['entry_name'];
144 144
                         }
145 145
 
146 146
                         if (isset($colConfig['skip_when_empty'])) {
147
-                            $pMetadata->xmlCollectionSkipWhenEmpty = (Boolean)$colConfig['skip_when_empty'];
147
+                            $pMetadata->xmlCollectionSkipWhenEmpty = (Boolean) $colConfig['skip_when_empty'];
148 148
                         } else {
149 149
                             $pMetadata->xmlCollectionSkipWhenEmpty = true;
150 150
                         }
151 151
 
152 152
                         if (isset($colConfig['namespace'])) {
153
-                            $pMetadata->xmlEntryNamespace = (string)$colConfig['namespace'];
153
+                            $pMetadata->xmlEntryNamespace = (string) $colConfig['namespace'];
154 154
                         }
155 155
                     }
156 156
 
@@ -159,15 +159,15 @@  discard block
 block discarded – undo
159 159
 
160 160
                         $colConfig = $pConfig['xml_map'];
161 161
                         if (isset($colConfig['inline'])) {
162
-                            $pMetadata->xmlCollectionInline = (Boolean)$colConfig['inline'];
162
+                            $pMetadata->xmlCollectionInline = (Boolean) $colConfig['inline'];
163 163
                         }
164 164
 
165 165
                         if (isset($colConfig['entry_name'])) {
166
-                            $pMetadata->xmlEntryName = (string)$colConfig['entry_name'];
166
+                            $pMetadata->xmlEntryName = (string) $colConfig['entry_name'];
167 167
                         }
168 168
 
169 169
                         if (isset($colConfig['namespace'])) {
170
-                            $pMetadata->xmlEntryNamespace = (string)$colConfig['namespace'];
170
+                            $pMetadata->xmlEntryNamespace = (string) $colConfig['namespace'];
171 171
                         }
172 172
 
173 173
                         if (isset($colConfig['key_attribute_name'])) {
@@ -179,33 +179,33 @@  discard block
 block discarded – undo
179 179
                     if (isset($pConfig['xml_element'])) {
180 180
                         $colConfig = $pConfig['xml_element'];
181 181
                         if (isset($colConfig['cdata'])) {
182
-                            $pMetadata->xmlElementCData = (Boolean)$colConfig['cdata'];
182
+                            $pMetadata->xmlElementCData = (Boolean) $colConfig['cdata'];
183 183
                         }
184 184
 
185 185
                         if (isset($colConfig['namespace'])) {
186
-                            $pMetadata->xmlNamespace = (string)$colConfig['namespace'];
186
+                            $pMetadata->xmlNamespace = (string) $colConfig['namespace'];
187 187
                         }
188 188
                     }
189 189
 
190 190
                     if (isset($pConfig['xml_attribute'])) {
191
-                        $pMetadata->xmlAttribute = (Boolean)$pConfig['xml_attribute'];
191
+                        $pMetadata->xmlAttribute = (Boolean) $pConfig['xml_attribute'];
192 192
                     }
193 193
 
194 194
                     if (isset($pConfig['xml_attribute_map'])) {
195
-                        $pMetadata->xmlAttributeMap = (Boolean)$pConfig['xml_attribute_map'];
195
+                        $pMetadata->xmlAttributeMap = (Boolean) $pConfig['xml_attribute_map'];
196 196
                     }
197 197
 
198 198
                     if (isset($pConfig['xml_value'])) {
199
-                        $pMetadata->xmlValue = (Boolean)$pConfig['xml_value'];
199
+                        $pMetadata->xmlValue = (Boolean) $pConfig['xml_value'];
200 200
                     }
201 201
 
202 202
                     if (isset($pConfig['xml_key_value_pairs'])) {
203
-                        $pMetadata->xmlKeyValuePairs = (Boolean)$pConfig['xml_key_value_pairs'];
203
+                        $pMetadata->xmlKeyValuePairs = (Boolean) $pConfig['xml_key_value_pairs'];
204 204
                     }
205 205
 
206 206
                     //we need read_only before setter and getter set, because that method depends on flag being set
207 207
                     if (isset($pConfig['read_only'])) {
208
-                        $pMetadata->readOnly = (Boolean)$pConfig['read_only'];
208
+                        $pMetadata->readOnly = (Boolean) $pConfig['read_only'];
209 209
                     } else {
210 210
                         $pMetadata->readOnly = $pMetadata->readOnly || $readOnlyClass;
211 211
                     }
@@ -217,14 +217,14 @@  discard block
 block discarded – undo
217 217
                     );
218 218
 
219 219
                     if (isset($pConfig['inline'])) {
220
-                        $pMetadata->inline = (Boolean)$pConfig['inline'];
220
+                        $pMetadata->inline = (Boolean) $pConfig['inline'];
221 221
                     }
222 222
 
223 223
                     if (isset($pConfig['max_depth'])) {
224
-                        $pMetadata->maxDepth = (int)$pConfig['max_depth'];
224
+                        $pMetadata->maxDepth = (int) $pConfig['max_depth'];
225 225
                     }
226 226
                 }
227
-                if ((ExclusionPolicy::NONE === $exclusionPolicy && !$isExclude)
227
+                if ((ExclusionPolicy::NONE === $exclusionPolicy && ! $isExclude)
228 228
                     || (ExclusionPolicy::ALL === $exclusionPolicy && $isExpose)
229 229
                 ) {
230 230
                     $metadata->addPropertyMetadata($pMetadata);
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 
266 266
     private function addClassProperties(ClassMetadata $metadata, array $config)
267 267
     {
268
-        if (isset($config['custom_accessor_order']) && !isset($config['accessor_order'])) {
268
+        if (isset($config['custom_accessor_order']) && ! isset($config['accessor_order'])) {
269 269
             $config['accessor_order'] = 'custom';
270 270
         }
271 271
 
@@ -274,11 +274,11 @@  discard block
 block discarded – undo
274 274
         }
275 275
 
276 276
         if (isset($config['xml_root_name'])) {
277
-            $metadata->xmlRootName = (string)$config['xml_root_name'];
277
+            $metadata->xmlRootName = (string) $config['xml_root_name'];
278 278
         }
279 279
 
280 280
         if (isset($config['xml_root_namespace'])) {
281
-            $metadata->xmlRootNamespace = (string)$config['xml_root_namespace'];
281
+            $metadata->xmlRootNamespace = (string) $config['xml_root_namespace'];
282 282
         }
283 283
 
284 284
         if (array_key_exists('xml_namespaces', $config)) {
@@ -293,25 +293,25 @@  discard block
 block discarded – undo
293 293
             if (isset($config['discriminator']['disabled']) && true === $config['discriminator']['disabled']) {
294 294
                 $metadata->discriminatorDisabled = true;
295 295
             } else {
296
-                if (!isset($config['discriminator']['field_name'])) {
296
+                if ( ! isset($config['discriminator']['field_name'])) {
297 297
                     throw new RuntimeException('The "field_name" attribute must be set for discriminators.');
298 298
                 }
299 299
 
300
-                if (!isset($config['discriminator']['map']) || !\is_array($config['discriminator']['map'])) {
300
+                if ( ! isset($config['discriminator']['map']) || ! \is_array($config['discriminator']['map'])) {
301 301
                     throw new RuntimeException('The "map" attribute must be set, and be an array for discriminators.');
302 302
                 }
303 303
                 $groups = isset($config['discriminator']['groups']) ? $config['discriminator']['groups'] : array();
304 304
                 $metadata->setDiscriminator($config['discriminator']['field_name'], $config['discriminator']['map'], $groups);
305 305
 
306 306
                 if (isset($config['discriminator']['xml_attribute'])) {
307
-                    $metadata->xmlDiscriminatorAttribute = (bool)$config['discriminator']['xml_attribute'];
307
+                    $metadata->xmlDiscriminatorAttribute = (bool) $config['discriminator']['xml_attribute'];
308 308
                 }
309 309
                 if (isset($config['discriminator']['xml_element'])) {
310 310
                     if (isset($config['discriminator']['xml_element']['cdata'])) {
311
-                        $metadata->xmlDiscriminatorCData = (bool)$config['discriminator']['xml_element']['cdata'];
311
+                        $metadata->xmlDiscriminatorCData = (bool) $config['discriminator']['xml_element']['cdata'];
312 312
                     }
313 313
                     if (isset($config['discriminator']['xml_element']['namespace'])) {
314
-                        $metadata->xmlDiscriminatorNamespace = (string)$config['discriminator']['xml_element']['namespace'];
314
+                        $metadata->xmlDiscriminatorNamespace = (string) $config['discriminator']['xml_element']['namespace'];
315 315
                     }
316 316
                 }
317 317
 
@@ -323,13 +323,13 @@  discard block
 block discarded – undo
323 323
     {
324 324
         if (\is_string($config)) {
325 325
             $config = array($config);
326
-        } elseif (!\is_array($config)) {
326
+        } elseif ( ! \is_array($config)) {
327 327
             throw new RuntimeException(sprintf('callback methods expects a string, or an array of strings that represent method names, but got %s.', json_encode($config['pre_serialize'])));
328 328
         }
329 329
 
330 330
         $methods = array();
331 331
         foreach ($config as $name) {
332
-            if (!$class->hasMethod($name)) {
332
+            if ( ! $class->hasMethod($name)) {
333 333
                 throw new RuntimeException(sprintf('The method %s does not exist in class %s.', $name, $class->name));
334 334
             }
335 335
 
Please login to merge, or discard this patch.
src/JMS/Serializer/Metadata/PropertyMetadata.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
     public function __construct($class, $name)
60 60
     {
61 61
         parent::__construct($class, $name);
62
-        $this->closureAccessor = \Closure::bind(function ($o, $name) {
62
+        $this->closureAccessor = \Closure::bind(function($o, $name) {
63 63
             return $o->$name;
64 64
         }, null, $class);
65 65
     }
@@ -69,22 +69,22 @@  discard block
 block discarded – undo
69 69
             $class = $this->reflection->getDeclaringClass();
70 70
 
71 71
             if (empty($getter)) {
72
-                if ($class->hasMethod('get' . $this->name) && $class->getMethod('get' . $this->name)->isPublic()) {
73
-                    $getter = 'get' . $this->name;
74
-                } elseif ($class->hasMethod('is' . $this->name) && $class->getMethod('is' . $this->name)->isPublic()) {
75
-                    $getter = 'is' . $this->name;
76
-                } elseif ($class->hasMethod('has' . $this->name) && $class->getMethod('has' . $this->name)->isPublic()) {
77
-                    $getter = 'has' . $this->name;
72
+                if ($class->hasMethod('get'.$this->name) && $class->getMethod('get'.$this->name)->isPublic()) {
73
+                    $getter = 'get'.$this->name;
74
+                } elseif ($class->hasMethod('is'.$this->name) && $class->getMethod('is'.$this->name)->isPublic()) {
75
+                    $getter = 'is'.$this->name;
76
+                } elseif ($class->hasMethod('has'.$this->name) && $class->getMethod('has'.$this->name)->isPublic()) {
77
+                    $getter = 'has'.$this->name;
78 78
                 } else {
79
-                    throw new RuntimeException(sprintf('There is neither a public %s method, nor a public %s method, nor a public %s method in class %s. Please specify which public method should be used for retrieving the value of the property %s.', 'get' . ucfirst($this->name), 'is' . ucfirst($this->name), 'has' . ucfirst($this->name), $this->class, $this->name));
79
+                    throw new RuntimeException(sprintf('There is neither a public %s method, nor a public %s method, nor a public %s method in class %s. Please specify which public method should be used for retrieving the value of the property %s.', 'get'.ucfirst($this->name), 'is'.ucfirst($this->name), 'has'.ucfirst($this->name), $this->class, $this->name));
80 80
                 }
81 81
             }
82 82
 
83
-            if (empty($setter) && !$this->readOnly) {
84
-                if ($class->hasMethod('set' . $this->name) && $class->getMethod('set' . $this->name)->isPublic()) {
85
-                    $setter = 'set' . $this->name;
83
+            if (empty($setter) && ! $this->readOnly) {
84
+                if ($class->hasMethod('set'.$this->name) && $class->getMethod('set'.$this->name)->isPublic()) {
85
+                    $setter = 'set'.$this->name;
86 86
                 } else {
87
-                    throw new RuntimeException(sprintf('There is no public %s method in class %s. Please specify which public method should be used for setting the value of the property %s.', 'set' . ucfirst($this->name), $this->class, $this->name));
87
+                    throw new RuntimeException(sprintf('There is no public %s method in class %s. Please specify which public method should be used for setting the value of the property %s.', 'set'.ucfirst($this->name), $this->class, $this->name));
88 88
                 }
89 89
             }
90 90
         }
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 
200 200
         parent::unserialize($parentStr);
201 201
 
202
-        $this->closureAccessor = \Closure::bind(function ($o, $name) {
202
+        $this->closureAccessor = \Closure::bind(function($o, $name) {
203 203
             return $o->$name;
204 204
         }, null, $this->class);
205 205
     }
Please login to merge, or discard this patch.