Completed
Pull Request — master (#884)
by Robert
13:50
created
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.
src/JMS/Serializer/Annotation/ExclusionPolicy.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
 
34 34
     public function __construct(array $values)
35 35
     {
36
-        if (!\is_string($values['value'])) {
36
+        if ( ! \is_string($values['value'])) {
37 37
             throw new RuntimeException('"value" must be a string.');
38 38
         }
39 39
 
Please login to merge, or discard this patch.
src/JMS/Serializer/Handler/HandlerRegistry.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -34,10 +34,10 @@  discard block
 block discarded – undo
34 34
 
35 35
         switch ($direction) {
36 36
             case GraphNavigator::DIRECTION_DESERIALIZATION:
37
-                return 'deserialize' . $type . 'From' . $format;
37
+                return 'deserialize'.$type.'From'.$format;
38 38
 
39 39
             case GraphNavigator::DIRECTION_SERIALIZATION:
40
-                return 'serialize' . $type . 'To' . $format;
40
+                return 'serialize'.$type.'To'.$format;
41 41
 
42 42
             default:
43 43
                 throw new LogicException(sprintf('The direction %s does not exist; see GraphNavigator::DIRECTION_??? constants.', json_encode($direction)));
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     public function registerSubscribingHandler(SubscribingHandlerInterface $handler)
53 53
     {
54 54
         foreach ($handler->getSubscribingMethods() as $methodData) {
55
-            if (!isset($methodData['type'], $methodData['format'])) {
55
+            if ( ! isset($methodData['type'], $methodData['format'])) {
56 56
                 throw new RuntimeException(sprintf('For each subscribing method a "type" and "format" attribute must be given, but only got "%s" for %s.', implode('" and "', array_keys($methodData)), \get_class($handler)));
57 57
             }
58 58
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 
80 80
     public function getHandler($direction, $typeName, $format)
81 81
     {
82
-        if (!isset($this->handlers[$direction][$typeName][$format])) {
82
+        if ( ! isset($this->handlers[$direction][$typeName][$format])) {
83 83
             return null;
84 84
         }
85 85
 
Please login to merge, or discard this patch.
src/JMS/Serializer/Handler/LazyHandlerRegistry.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
     public function __construct($container, array $handlers = array())
30 30
     {
31
-        if (!$container instanceof PsrContainerInterface && !$container instanceof ContainerInterface) {
31
+        if ( ! $container instanceof PsrContainerInterface && ! $container instanceof ContainerInterface) {
32 32
             throw new \InvalidArgumentException(sprintf('The container must be an instance of %s or %s (%s given).', PsrContainerInterface::class, ContainerInterface::class, \is_object($container) ? \get_class($container) : \gettype($container)));
33 33
         }
34 34
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
             return $this->initializedHandlers[$direction][$typeName][$format];
49 49
         }
50 50
 
51
-        if (!isset($this->handlers[$direction][$typeName][$format])) {
51
+        if ( ! isset($this->handlers[$direction][$typeName][$format])) {
52 52
             return null;
53 53
         }
54 54
 
Please login to merge, or discard this patch.
src/JMS/Serializer/Serializer.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
         }
107 107
 
108 108
         return $this->serializationVisitors->get($format)
109
-            ->map(function (VisitorInterface $visitor) use ($context, $data, $format) {
109
+            ->map(function(VisitorInterface $visitor) use ($context, $data, $format) {
110 110
                 $type = $context->getInitialType() !== null ? $this->typeParser->parse($context->getInitialType()) : null;
111 111
 
112 112
                 $this->visit($visitor, $context, $visitor->prepare($data), $format, $type);
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         }
124 124
 
125 125
         return $this->deserializationVisitors->get($format)
126
-            ->map(function (VisitorInterface $visitor) use ($context, $data, $format, $type) {
126
+            ->map(function(VisitorInterface $visitor) use ($context, $data, $format, $type) {
127 127
                 $preparedData = $visitor->prepare($data);
128 128
                 $navigatorResult = $this->visit($visitor, $context, $preparedData, $format, $this->typeParser->parse($type));
129 129
 
@@ -142,13 +142,13 @@  discard block
 block discarded – undo
142 142
         }
143 143
 
144 144
         return $this->serializationVisitors->get('json')
145
-            ->map(function (JsonSerializationVisitor $visitor) use ($context, $data) {
145
+            ->map(function(JsonSerializationVisitor $visitor) use ($context, $data) {
146 146
                 $type = $context->getInitialType() !== null ? $this->typeParser->parse($context->getInitialType()) : null;
147 147
 
148 148
                 $this->visit($visitor, $context, $data, 'json', $type);
149 149
                 $result = $this->convertArrayObjects($visitor->getRoot());
150 150
 
151
-                if (!\is_array($result)) {
151
+                if ( ! \is_array($result)) {
152 152
                     throw new RuntimeException(sprintf(
153 153
                         'The input data of type "%s" did not convert to an array, but got a result of type "%s".',
154 154
                         \is_object($data) ? \get_class($data) : \gettype($data),
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
         }
172 172
 
173 173
         return $this->deserializationVisitors->get('json')
174
-            ->map(function (JsonDeserializationVisitor $visitor) use ($data, $type, $context) {
174
+            ->map(function(JsonDeserializationVisitor $visitor) use ($data, $type, $context) {
175 175
                 $navigatorResult = $this->visit($visitor, $context, $data, 'json', $this->typeParser->parse($type));
176 176
 
177 177
                 return $this->handleDeserializeResult($visitor->getResult(), $navigatorResult);
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
     private function convertArrayObjects($data)
207 207
     {
208 208
         if ($data instanceof \ArrayObject || $data instanceof \stdClass) {
209
-            $data = (array)$data;
209
+            $data = (array) $data;
210 210
         }
211 211
         if (\is_array($data)) {
212 212
             foreach ($data as $k => $v) {
Please login to merge, or discard this patch.
src/JMS/Serializer/Expression/ExpressionEvaluator.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -64,13 +64,13 @@
 block discarded – undo
64 64
      */
65 65
     public function evaluate($expression, array $data = array())
66 66
     {
67
-        if (!\is_string($expression)) {
67
+        if ( ! \is_string($expression)) {
68 68
             return $expression;
69 69
         }
70 70
 
71 71
         $context = $data + $this->context;
72 72
 
73
-        if (!array_key_exists($expression, $this->cache)) {
73
+        if ( ! array_key_exists($expression, $this->cache)) {
74 74
             $this->cache[$expression] = $this->expressionLanguage->parse($expression, array_keys($context));
75 75
         }
76 76
 
Please login to merge, or discard this patch.
src/JMS/Serializer/GenericDeserializationVisitor.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 
59 59
     public function visitString($data, array $type, Context $context)
60 60
     {
61
-        $data = (string)$data;
61
+        $data = (string) $data;
62 62
 
63 63
         if (null === $this->result) {
64 64
             $this->result = $data;
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 
70 70
     public function visitBoolean($data, array $type, Context $context)
71 71
     {
72
-        $data = (Boolean)$data;
72
+        $data = (Boolean) $data;
73 73
 
74 74
         if (null === $this->result) {
75 75
             $this->result = $data;
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 
81 81
     public function visitInteger($data, array $type, Context $context)
82 82
     {
83
-        $data = (integer)$data;
83
+        $data = (integer) $data;
84 84
 
85 85
         if (null === $this->result) {
86 86
             $this->result = $data;
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
     public function visitDouble($data, array $type, Context $context)
93 93
     {
94
-        $data = (double)$data;
94
+        $data = (double) $data;
95 95
 
96 96
         if (null === $this->result) {
97 97
             $this->result = $data;
@@ -102,12 +102,12 @@  discard block
 block discarded – undo
102 102
 
103 103
     public function visitArray($data, array $type, Context $context)
104 104
     {
105
-        if (!\is_array($data)) {
105
+        if ( ! \is_array($data)) {
106 106
             throw new RuntimeException(sprintf('Expected array, but got %s: %s', \gettype($data), json_encode($data)));
107 107
         }
108 108
 
109 109
         // If no further parameters were given, keys/values are just passed as is.
110
-        if (!$type['params']) {
110
+        if ( ! $type['params']) {
111 111
             if (null === $this->result) {
112 112
                 $this->result = $data;
113 113
             }
@@ -166,15 +166,15 @@  discard block
 block discarded – undo
166 166
             return;
167 167
         }
168 168
 
169
-        if (!\is_array($data)) {
169
+        if ( ! \is_array($data)) {
170 170
             throw new RuntimeException(sprintf('Invalid data "%s"(%s), expected "%s".', $data, $metadata->type['name'], $metadata->reflection->class));
171 171
         }
172 172
 
173
-        if (!array_key_exists($name, $data)) {
173
+        if ( ! array_key_exists($name, $data)) {
174 174
             return;
175 175
         }
176 176
 
177
-        if (!$metadata->type) {
177
+        if ( ! $metadata->type) {
178 178
             throw new RuntimeException(sprintf('You must define a type for %s::$%s.', $metadata->reflection->class, $metadata->name));
179 179
         }
180 180
 
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
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
      */
62 62
     public function writeln($content)
63 63
     {
64
-        $this->write($content . "\n");
64
+        $this->write($content."\n");
65 65
 
66 66
         return $this;
67 67
     }
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
         $lines = explode("\n", $content);
86 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
             ) {
91 91
                 $addition .= str_repeat(' ', $this->indentationLevel * $this->indentationSpaces);
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 
108 108
     public function rtrim($preserveNewLines = true)
109 109
     {
110
-        if (!$preserveNewLines) {
110
+        if ( ! $preserveNewLines) {
111 111
             $this->content = rtrim($this->content);
112 112
 
113 113
             return $this;
Please login to merge, or discard this patch.
src/JMS/Serializer/XmlDeserializationVisitor.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 
69 69
         if (false !== stripos($data, '<!doctype')) {
70 70
             $internalSubset = $this->getDomDocumentTypeEntitySubset($data);
71
-            if (!in_array($internalSubset, $this->doctypeWhitelist, true)) {
71
+            if ( ! in_array($internalSubset, $this->doctypeWhitelist, true)) {
72 72
                 throw new InvalidArgumentException(sprintf(
73 73
                     'The document type "%s" is not allowed. If it is safe, you may add it to the whitelist configuration.',
74 74
                     $internalSubset
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 
91 91
     private function emptyStringToSpaceCharacter($data)
92 92
     {
93
-        return $data === '' ? ' ' : (string)$data;
93
+        return $data === '' ? ' ' : (string) $data;
94 94
     }
95 95
 
96 96
     public function visitNull($data, array $type, Context $context)
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 
101 101
     public function visitString($data, array $type, Context $context)
102 102
     {
103
-        $data = (string)$data;
103
+        $data = (string) $data;
104 104
 
105 105
         if (null === $this->result) {
106 106
             $this->result = $data;
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 
112 112
     public function visitBoolean($data, array $type, Context $context)
113 113
     {
114
-        $data = (string)$data;
114
+        $data = (string) $data;
115 115
 
116 116
         if ('true' === $data || '1' === $data) {
117 117
             $data = true;
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 
131 131
     public function visitInteger($data, array $type, Context $context)
132 132
     {
133
-        $data = (integer)$data;
133
+        $data = (integer) $data;
134 134
 
135 135
         if (null === $this->result) {
136 136
             $this->result = $data;
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 
142 142
     public function visitDouble($data, array $type, Context $context)
143 143
     {
144
-        $data = (double)$data;
144
+        $data = (double) $data;
145 145
 
146 146
         if (null === $this->result) {
147 147
             $this->result = $data;
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
             $nodes = $data->xpath($entryName);
193 193
         }
194 194
 
195
-        if (!\count($nodes)) {
195
+        if ( ! \count($nodes)) {
196 196
             if (null === $this->result) {
197 197
                 return $this->result = array();
198 198
             }
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
                 $nodes = $data->children($namespace)->$entryName;
232 232
                 foreach ($nodes as $v) {
233 233
                     $attrs = $v->attributes();
234
-                    if (!isset($attrs[$this->currentMetadata->xmlKeyAttribute])) {
234
+                    if ( ! isset($attrs[$this->currentMetadata->xmlKeyAttribute])) {
235 235
                         throw new RuntimeException(sprintf('The key attribute "%s" must be set for each entry of the map.', $this->currentMetadata->xmlKeyAttribute));
236 236
                     }
237 237
 
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
             $name = $this->namingStrategy->translateName($metadata);
264 264
         }
265 265
 
266
-        if (!$metadata->type) {
266
+        if ( ! $metadata->type) {
267 267
             throw new RuntimeException(sprintf('You must define a type for %s::$%s.', $metadata->reflection->class, $metadata->name));
268 268
         }
269 269
 
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 
288 288
         if ($metadata->xmlCollection) {
289 289
             $enclosingElem = $data;
290
-            if (!$metadata->xmlCollectionInline) {
290
+            if ( ! $metadata->xmlCollectionInline) {
291 291
                 $enclosingElem = $data->children($metadata->xmlNamespace)->$name;
292 292
             }
293 293
 
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 
302 302
         if ($metadata->xmlNamespace) {
303 303
             $node = $data->children($metadata->xmlNamespace)->$name;
304
-            if (!$node->count()) {
304
+            if ( ! $node->count()) {
305 305
                 return;
306 306
             }
307 307
         } else {
@@ -311,9 +311,9 @@  discard block
 block discarded – undo
311 311
             if (isset($namespaces[''])) {
312 312
                 $prefix = uniqid('ns-');
313 313
                 $data->registerXPathNamespace($prefix, $namespaces['']);
314
-                $nodes = $data->xpath('./' . $prefix . ':' . $name);
314
+                $nodes = $data->xpath('./'.$prefix.':'.$name);
315 315
             } else {
316
-                $nodes = $data->xpath('./' . $name);
316
+                $nodes = $data->xpath('./'.$name);
317 317
             }
318 318
             if (empty($nodes)) {
319 319
                 return;
Please login to merge, or discard this patch.