Completed
Pull Request — master (#745)
by Joseph
04:46
created
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 2 patches
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.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
         if (array_key_exists('virtual_properties', $config)) {
54 54
             foreach ($config['virtual_properties'] as $methodName => $propertySettings) {
55 55
                 if (isset($propertySettings['exp'])) {
56
-                    $virtualPropertyMetadata = new ExpressionPropertyMetadata( $name, $methodName, $propertySettings['exp']);
56
+                    $virtualPropertyMetadata = new ExpressionPropertyMetadata($name, $methodName, $propertySettings['exp']);
57 57
                     unset($propertySettings['exp']);
58 58
 
59 59
                 } else {
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
                     }
108 108
 
109 109
                     if (isset($pConfig['expose_if'])) {
110
-                        $pMetadata->excludeIf = "!(" . $pConfig['expose_if'].")";
110
+                        $pMetadata->excludeIf = "!(".$pConfig['expose_if'].")";
111 111
                     }
112 112
 
113 113
                     if (isset($pConfig['serialized_name'])) {
@@ -127,15 +127,15 @@  discard block
 block discarded – undo
127 127
 
128 128
                         $colConfig = $pConfig['xml_list'];
129 129
                         if (isset($colConfig['inline'])) {
130
-                            $pMetadata->xmlCollectionInline = (Boolean)$colConfig['inline'];
130
+                            $pMetadata->xmlCollectionInline = (Boolean) $colConfig['inline'];
131 131
                         }
132 132
 
133 133
                         if (isset($colConfig['entry_name'])) {
134
-                            $pMetadata->xmlEntryName = (string)$colConfig['entry_name'];
134
+                            $pMetadata->xmlEntryName = (string) $colConfig['entry_name'];
135 135
                         }
136 136
 
137 137
                         if (isset($colConfig['skip_when_empty'])) {
138
-                            $pMetadata->xmlCollectionSkipWhenEmpty = (Boolean)$colConfig['skip_when_empty'];
138
+                            $pMetadata->xmlCollectionSkipWhenEmpty = (Boolean) $colConfig['skip_when_empty'];
139 139
                         } else {
140 140
                             $pMetadata->xmlCollectionSkipWhenEmpty = true;
141 141
                         }
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/XmlDeserializationVisitor.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -226,7 +226,7 @@
 block discarded – undo
226 226
             throw new RuntimeException(sprintf('You must define a type for %s::$%s.', $metadata->reflection->class, $metadata->name));
227 227
         }
228 228
 
229
-       if ($metadata->xmlAttribute) {
229
+        if ($metadata->xmlAttribute) {
230 230
 
231 231
             $attributes = $data->attributes($metadata->xmlNamespace);
232 232
             if (isset($attributes[$name])) {
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
         if (false !== stripos($data, '<!doctype')) {
69 69
             $internalSubset = $this->getDomDocumentTypeEntitySubset($data);
70
-            if (!in_array($internalSubset, $this->doctypeWhitelist, true)) {
70
+            if ( ! in_array($internalSubset, $this->doctypeWhitelist, true)) {
71 71
                 throw new InvalidArgumentException(sprintf(
72 72
                     'The document type "%s" is not allowed. If it is safe, you may add it to the whitelist configuration.',
73 73
                     $internalSubset
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 
157 157
         if ($namespace === null && $this->objectMetadataStack->count()) {
158 158
             $classMetadata = $this->objectMetadataStack->top();
159
-            $namespace = isset($classMetadata->xmlNamespaces[''])?$classMetadata->xmlNamespaces['']:$namespace;
159
+            $namespace = isset($classMetadata->xmlNamespaces['']) ? $classMetadata->xmlNamespaces[''] : $namespace;
160 160
         }
161 161
 
162 162
         if (null !== $namespace) {
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
             $nodes = $data->xpath($entryName);
168 168
         }
169 169
 
170
-        if (!count($nodes)) {
170
+        if ( ! count($nodes)) {
171 171
             if (null === $this->result) {
172 172
                 return $this->result = array();
173 173
             }
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 
259 259
         if ($metadata->xmlCollection) {
260 260
             $enclosingElem = $data;
261
-            if (!$metadata->xmlCollectionInline) {
261
+            if ( ! $metadata->xmlCollectionInline) {
262 262
                 $enclosingElem = $data->children($metadata->xmlNamespace)->$name;
263 263
             }
264 264
 
@@ -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
                 return;
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
                 return;
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
      */
369 369
     private function getDomDocumentTypeEntitySubset($data)
370 370
     {
371
-        if (!is_string($data)) {
371
+        if ( ! is_string($data)) {
372 372
             $data = (string) $data;
373 373
         }
374 374
 
Please login to merge, or discard this patch.
src/JMS/Serializer/Handler/DateHandler.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -72,8 +72,7 @@  discard block
 block discarded – undo
72 72
         \DateTimeInterface $date,
73 73
         array $type,
74 74
         Context $context
75
-    )
76
-    {
75
+    ) {
77 76
         if ($visitor instanceof XmlSerializationVisitor && false === $this->xmlCData) {
78 77
             return $visitor->visitSimpleString($date->format($this->getFormat($type)), $type, $context);
79 78
         }
@@ -96,8 +95,7 @@  discard block
 block discarded – undo
96 95
         \DateTimeImmutable $date,
97 96
         array $type,
98 97
         Context $context
99
-    )
100
-    {
98
+    ) {
101 99
         return $this->serializeDateTimeInterface($visitor, $date, $type, $context);
102 100
     }
103 101
 
Please login to merge, or discard this patch.
src/JMS/Serializer/SerializationContext.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,6 @@
 block discarded – undo
18 18
 
19 19
 namespace JMS\Serializer;
20 20
 
21
-use JMS\Serializer\Exception\LogicException;
22 21
 use JMS\Serializer\Exception\RuntimeException;
23 22
 use Metadata\MetadataFactoryInterface;
24 23
 
Please login to merge, or discard this patch.