Completed
Pull Request — master (#754)
by Dmitriy
15:21
created
src/JMS/Serializer/Annotation/VirtualProperty.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
         }
39 39
 
40 40
         foreach ($data as $key => $value) {
41
-            if (!property_exists(__CLASS__, $key)) {
41
+            if ( ! property_exists(__CLASS__, $key)) {
42 42
                 throw new \BadMethodCallException(sprintf('Unknown property "%s" on annotation "%s".', $key, __CLASS__));
43 43
             }
44 44
             $this->{$key} = $value;
Please login to merge, or discard this patch.
src/JMS/Serializer/Exclusion/GroupsExclusionStrategy.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@
 block discarded – undo
76 76
 
77 77
         $groups = $this->groups;
78 78
         foreach ($paths as $index => $path) {
79
-            if (!array_key_exists($path, $groups)) {
79
+            if ( ! array_key_exists($path, $groups)) {
80 80
                 if ($index > 0) {
81 81
                     $groups = array(self::DEFAULT_GROUP);
82 82
                 }
Please login to merge, or discard this patch.
src/JMS/Serializer/Serializer.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -83,8 +83,7 @@
 block discarded – undo
83 83
         EventDispatcherInterface $dispatcher = null,
84 84
         TypeParser $typeParser = null,
85 85
         ExpressionEvaluatorInterface $expressionEvaluator = null
86
-    )
87
-    {
86
+    ) {
88 87
         $this->factory = $factory;
89 88
         $this->handlerRegistry = $handlerRegistry;
90 89
         $this->objectConstructor = $objectConstructor;
Please login to merge, or discard this patch.
src/JMS/Serializer/Handler/StdClassHandler.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
         $classMetadata = $context->getMetadataFactory()->getMetadataForClass('stdClass');
51 51
         $visitor->startVisitingObject($classMetadata, $stdClass, array('name' => 'stdClass'), $context);
52 52
 
53
-        foreach ((array)$stdClass as $name => $value) {
53
+        foreach ((array) $stdClass as $name => $value) {
54 54
             $metadata = new StaticPropertyMetadata('stdClass', $name, $value);
55 55
             $visitor->visitProperty($metadata, $value, $context);
56 56
         }
Please login to merge, or discard this patch.
src/JMS/Serializer/XmlSerializationVisitor.php 2 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -132,6 +132,9 @@  discard block
 block discarded – undo
132 132
         return $doCData ? $this->document->createCDATASection($data) : $this->document->createTextNode((string) $data);
133 133
     }
134 134
 
135
+    /**
136
+     * @param string $data
137
+     */
135 138
     public function visitSimpleString($data, array $type, Context $context)
136 139
     {
137 140
         if (null === $this->document) {
@@ -478,6 +481,9 @@  discard block
 block discarded – undo
478 481
         return $this->document->createElementNS($namespace, $prefix . ':' . $tagName);
479 482
     }
480 483
 
484
+    /**
485
+     * @param string $value
486
+     */
481 487
     private function setAttributeOnNode(\DOMElement $node, $name, $value, $namespace = null)
482 488
     {
483 489
         if (null !== $namespace) {
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
             $this->document = $this->createDocument(null, null, false);
209 209
             if ($metadata->xmlRootName) {
210 210
                 $rootName = $metadata->xmlRootName;
211
-                $rootNamespace = $metadata->xmlRootNamespace?:$this->getClassDefaultNamespace($metadata);
211
+                $rootNamespace = $metadata->xmlRootNamespace ?: $this->getClassDefaultNamespace($metadata);
212 212
             } else {
213 213
                 $rootName = $this->defaultRootName;
214 214
                 $rootNamespace = $this->defaultRootNamespace;
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
             return;
292 292
         }
293 293
 
294
-        if ($addEnclosingElement = !$this->isInLineCollection($metadata) && ! $metadata->inline) {
294
+        if ($addEnclosingElement = ! $this->isInLineCollection($metadata) && ! $metadata->inline) {
295 295
             $elementName = $this->namingStrategy->translateName($metadata);
296 296
 
297 297
             $namespace = null !== $metadata->xmlNamespace
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 
335 335
     private function isEmptyObject($node, PropertyMetadata $metadata)
336 336
     {
337
-        return $node === null && !$metadata->xmlCollection;
337
+        return $node === null && ! $metadata->xmlCollection;
338 338
     }
339 339
 
340 340
     private function isSkippableCollection(PropertyMetadata $metadata)
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 
345 345
     private function isElementEmpty(\DOMElement $element)
346 346
     {
347
-        return !$element->hasChildNodes() && !$element->hasAttributes();
347
+        return ! $element->hasChildNodes() && ! $element->hasAttributes();
348 348
     }
349 349
 
350 350
     public function endVisitingObject(ClassMetadata $metadata, $data, array $type, Context $context)
@@ -482,17 +482,17 @@  discard block
 block discarded – undo
482 482
         if ($this->currentNode->isDefaultNamespace($namespace)) {
483 483
             return $this->document->createElementNS($namespace, $tagName);
484 484
         }
485
-        if (!($prefix = $this->currentNode->lookupPrefix($namespace)) && !($prefix = $this->document->lookupPrefix($namespace))) {
486
-            $prefix = 'ns-'.  substr(sha1($namespace), 0, 8);
485
+        if ( ! ($prefix = $this->currentNode->lookupPrefix($namespace)) && ! ($prefix = $this->document->lookupPrefix($namespace))) {
486
+            $prefix = 'ns-'.substr(sha1($namespace), 0, 8);
487 487
         }
488
-        return $this->document->createElementNS($namespace, $prefix . ':' . $tagName);
488
+        return $this->document->createElementNS($namespace, $prefix.':'.$tagName);
489 489
     }
490 490
 
491 491
     private function setAttributeOnNode(\DOMElement $node, $name, $value, $namespace = null)
492 492
     {
493 493
         if (null !== $namespace) {
494
-            if (!$prefix = $node->lookupPrefix($namespace)) {
495
-                $prefix = 'ns-'.  substr(sha1($namespace), 0, 8);
494
+            if ( ! $prefix = $node->lookupPrefix($namespace)) {
495
+                $prefix = 'ns-'.substr(sha1($namespace), 0, 8);
496 496
             }
497 497
             $node->setAttributeNS($namespace, $prefix.':'.$name, $value);
498 498
         } else {
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
 
503 503
     private function getClassDefaultNamespace(ClassMetadata $metadata)
504 504
     {
505
-        return (isset($metadata->xmlNamespaces[''])?$metadata->xmlNamespaces['']:null);
505
+        return (isset($metadata->xmlNamespaces['']) ? $metadata->xmlNamespaces[''] : null);
506 506
     }
507 507
 
508 508
     /**
Please login to merge, or discard this patch.
src/JMS/Serializer/Annotation/SerializedName.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
 
31 31
     public function __construct(array $values)
32 32
     {
33
-        if (!isset($values['value']) || !is_string($values['value'])) {
33
+        if ( ! isset($values['value']) || ! is_string($values['value'])) {
34 34
             throw new RuntimeException(sprintf('"value" must be a string.'));
35 35
         }
36 36
 
Please login to merge, or discard this patch.