Completed
Pull Request — master (#576)
by Pavel
02:49
created
src/JMS/Serializer/SerializerBuilder.php 1 patch
Unused Use Statements   -6 removed lines patch added patch discarded remove patch
@@ -23,17 +23,11 @@
 block discarded – undo
23 23
 use JMS\Serializer\Handler\PhpCollectionHandler;
24 24
 use JMS\Serializer\Handler\PropelCollectionHandler;
25 25
 use JMS\Serializer\Exception\RuntimeException;
26
-use Metadata\Driver\DriverInterface;
27 26
 use Metadata\MetadataFactory;
28
-use JMS\Serializer\Metadata\Driver\AnnotationDriver;
29 27
 use JMS\Serializer\Handler\HandlerRegistry;
30 28
 use JMS\Serializer\Construction\UnserializeObjectConstructor;
31 29
 use PhpCollection\Map;
32 30
 use JMS\Serializer\EventDispatcher\EventDispatcher;
33
-use Metadata\Driver\DriverChain;
34
-use JMS\Serializer\Metadata\Driver\YamlDriver;
35
-use JMS\Serializer\Metadata\Driver\XmlDriver;
36
-use Metadata\Driver\FileLocator;
37 31
 use JMS\Serializer\Handler\DateHandler;
38 32
 use JMS\Serializer\Handler\ArrayCollectionHandler;
39 33
 use JMS\Serializer\Construction\ObjectConstructorInterface;
Please login to merge, or discard this patch.
src/JMS/Serializer/EventDispatcher/EventDispatcher.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@
 block discarded – undo
80 80
             $this->classListeners[$eventName][$loweredClass][$format] = $this->initializeListeners($eventName, $loweredClass, $format);
81 81
         }
82 82
 
83
-        return !!$this->classListeners[$eventName][$loweredClass][$format];
83
+        return ! ! $this->classListeners[$eventName][$loweredClass][$format];
84 84
     }
85 85
 
86 86
     public function dispatch($eventName, $class, $format, Event $event)
Please login to merge, or discard this patch.
src/JMS/Serializer/EventDispatcher/Events.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,5 +25,7 @@
 block discarded – undo
25 25
     const PRE_DESERIALIZE = 'serializer.pre_deserialize';
26 26
     const POST_DESERIALIZE = 'serializer.post_deserialize';
27 27
 
28
-    final private function __construct() { }
28
+    final private function __construct()
29
+    {
30
+}
29 31
 }
Please login to merge, or discard this patch.
src/JMS/Serializer/Metadata/Driver/YamlDriver.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -167,7 +167,7 @@
 block discarded – undo
167 167
 
168 168
                     //we need read_only before setter and getter set, because that method depends on flag being set
169 169
                     if (isset($pConfig['read_only'])) {
170
-                          $pMetadata->readOnly = (Boolean) $pConfig['read_only'];
170
+                            $pMetadata->readOnly = (Boolean) $pConfig['read_only'];
171 171
                     } else {
172 172
                         $pMetadata->readOnly = $pMetadata->readOnly || $readOnlyClass;
173 173
                     }
Please login to merge, or discard this patch.
src/JMS/Serializer/TypeParser.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
                 |(.)
50 50
             /x',
51 51
             array(self::T_NAME => 'T_NAME', self::T_STRING => 'T_STRING', self::T_OPEN_BRACKET => 'T_OPEN_BRACKET',
52
-                  self::T_CLOSE_BRACKET => 'T_CLOSE_BRACKET', self::T_COMMA => 'T_COMMA', self::T_NONE => 'T_NONE'),
52
+                    self::T_CLOSE_BRACKET => 'T_CLOSE_BRACKET', self::T_COMMA => 'T_COMMA', self::T_NONE => 'T_NONE'),
53 53
             function($value) {
54 54
                 switch ($value[0]) {
55 55
                     case '"':
Please login to merge, or discard this patch.
src/JMS/Serializer/Util/Writer.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -83,16 +83,16 @@
 block discarded – undo
83 83
         $addition = '';
84 84
 
85 85
         $lines = explode("\n", $content);
86
-        for ($i=0,$c=count($lines); $i<$c; $i++) {
86
+        for ($i = 0, $c = count($lines); $i < $c; $i++) {
87 87
             if ($this->indentationLevel > 0
88
-                && !empty($lines[$i])
88
+                && ! empty($lines[$i])
89 89
                 && ((empty($addition) && "\n" === substr($this->content, -1)) || "\n" === substr($addition, -1))) {
90 90
                 $addition .= str_repeat(' ', $this->indentationLevel * $this->indentationSpaces);
91 91
             }
92 92
 
93 93
             $addition .= $lines[$i];
94 94
 
95
-            if ($i+1 < $c) {
95
+            if ($i + 1 < $c) {
96 96
                 $addition .= "\n";
97 97
             }
98 98
         }
Please login to merge, or discard this patch.
src/JMS/Serializer/YamlSerializationVisitor.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -168,8 +168,8 @@
 block discarded – undo
168 168
 
169 169
         if ( ! $metadata->inline) {
170 170
             $this->writer
171
-                 ->writeln(Inline::dump($name).':')
172
-                 ->indent();
171
+                    ->writeln(Inline::dump($name).':')
172
+                    ->indent();
173 173
         }
174 174
 
175 175
         $this->setCurrentMetadata($metadata);
Please login to merge, or discard this patch.
src/JMS/Serializer/EventDispatcher/Subscriber/DoctrineProxySubscriber.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
         // If the set type name is not an actual class, but a faked type for which a custom handler exists, we do not
37 37
         // modify it with this subscriber. Also, we forgo autoloading here as an instance of this type is already created,
38 38
         // so it must be loaded if its a real class.
39
-        if (! class_exists($type['name'], false)) {
39
+        if ( ! class_exists($type['name'], false)) {
40 40
             return;
41 41
         }
42 42
 
Please login to merge, or discard this patch.
src/JMS/Serializer/XmlSerializationVisitor.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
             $this->document = $this->createDocument(null, null, false);
198 198
             if ($metadata->xmlRootName) {
199 199
                 $rootName = $metadata->xmlRootName;
200
-                $rootNamespace = $metadata->xmlRootNamespace?:$this->getClassDefaultNamespace($metadata);
200
+                $rootNamespace = $metadata->xmlRootNamespace ?: $this->getClassDefaultNamespace($metadata);
201 201
             } else {
202 202
                 $rootName = $this->defaultRootName;
203 203
                 $rootNamespace = $this->defaultRootNamespace;
@@ -444,10 +444,10 @@  discard block
 block discarded – undo
444 444
             if ($this->currentNode->isDefaultNamespace($namespace)) {
445 445
                 return $this->document->createElementNS($namespace, $tagName);
446 446
             } else {
447
-                if (!$prefix = $this->currentNode->lookupPrefix($namespace)) {
448
-                    $prefix = 'ns-'.  substr(sha1($namespace), 0, 8);
447
+                if ( ! $prefix = $this->currentNode->lookupPrefix($namespace)) {
448
+                    $prefix = 'ns-'.substr(sha1($namespace), 0, 8);
449 449
                 }
450
-                return $this->document->createElementNS($namespace, $prefix . ':' . $tagName);
450
+                return $this->document->createElementNS($namespace, $prefix.':'.$tagName);
451 451
             }
452 452
 
453 453
 
@@ -459,8 +459,8 @@  discard block
 block discarded – undo
459 459
     private function setAttributeOnNode(\DOMElement $node, $name, $value, $namespace = null)
460 460
     {
461 461
         if (null !== $namespace) {
462
-            if (!$prefix = $node->lookupPrefix($namespace)) {
463
-                $prefix = 'ns-'.  substr(sha1($namespace), 0, 8);
462
+            if ( ! $prefix = $node->lookupPrefix($namespace)) {
463
+                $prefix = 'ns-'.substr(sha1($namespace), 0, 8);
464 464
             }
465 465
             $node->setAttributeNS($namespace, $prefix.':'.$name, $value);
466 466
         } else {
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
 
471 471
     private function getClassDefaultNamespace(ClassMetadata $metadata)
472 472
     {
473
-        return (isset($metadata->xmlNamespaces[''])?$metadata->xmlNamespaces['']:null);
473
+        return (isset($metadata->xmlNamespaces['']) ? $metadata->xmlNamespaces[''] : null);
474 474
     }
475 475
 
476 476
 }
Please login to merge, or discard this patch.
Doc Comments   +12 added lines patch added patch discarded remove patch
@@ -44,6 +44,9 @@  discard block
 block discarded – undo
44 44
     private $nullWasVisited;
45 45
     private $objectMetadataStack;
46 46
 
47
+    /**
48
+     * @param Naming\PropertyNamingStrategyInterface $namingStrategy
49
+     */
47 50
     public function __construct($namingStrategy)
48 51
     {
49 52
         parent::__construct($namingStrategy);
@@ -126,6 +129,9 @@  discard block
 block discarded – undo
126 129
         return $doCData ? $this->document->createCDATASection($data) : $this->document->createTextNode((string) $data);
127 130
     }
128 131
 
132
+    /**
133
+     * @param string $data
134
+     */
129 135
     public function visitSimpleString($data, array $type, Context $context)
130 136
     {
131 137
         if (null === $this->document) {
@@ -437,6 +443,9 @@  discard block
 block discarded – undo
437 443
         }
438 444
     }
439 445
 
446
+    /**
447
+     * @return \DOMNode
448
+     */
440 449
     private function createElement($tagName, $namespace = null)
441 450
     {
442 451
         if (null !== $namespace) {
@@ -456,6 +465,9 @@  discard block
 block discarded – undo
456 465
         }
457 466
     }
458 467
 
468
+    /**
469
+     * @param string $value
470
+     */
459 471
     private function setAttributeOnNode(\DOMElement $node, $name, $value, $namespace = null)
460 472
     {
461 473
         if (null !== $namespace) {
Please login to merge, or discard this patch.