Completed
Pull Request — master (#819)
by Michael
19:45 queued 17:36
created
src/JMS/Serializer/Handler/DateHandler.php 2 patches
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.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
                     'type' => $type,
54 54
                     'format' => $format,
55 55
                     'direction' => GraphNavigator::DIRECTION_SERIALIZATION,
56
-                    'method' => 'serialize' . $type,
56
+                    'method' => 'serialize'.$type,
57 57
                 );
58 58
             }
59 59
         }
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
     private function isDataXmlNull($data)
117 117
     {
118 118
         $attributes = $data->attributes('xsi', true);
119
-        return isset($attributes['nil'][0]) && (string)$attributes['nil'][0] === 'true';
119
+        return isset($attributes['nil'][0]) && (string) $attributes['nil'][0] === 'true';
120 120
     }
121 121
 
122 122
     public function deserializeDateTimeFromXml(XmlDeserializationVisitor $visitor, $data, array $type)
@@ -175,13 +175,13 @@  discard block
 block discarded – undo
175 175
 
176 176
     private function parseDateTime($data, array $type, $immutable = false)
177 177
     {
178
-        $timezone = !empty($type['params'][1]) ? new \DateTimeZone($type['params'][1]) : $this->defaultTimezone;
178
+        $timezone = ! empty($type['params'][1]) ? new \DateTimeZone($type['params'][1]) : $this->defaultTimezone;
179 179
         $format = $this->getDeserializationFormat($type);
180 180
 
181 181
         if ($immutable) {
182
-            $datetime = \DateTimeImmutable::createFromFormat($format, (string)$data, $timezone);
182
+            $datetime = \DateTimeImmutable::createFromFormat($format, (string) $data, $timezone);
183 183
         } else {
184
-            $datetime = \DateTime::createFromFormat($format, (string)$data, $timezone);
184
+            $datetime = \DateTime::createFromFormat($format, (string) $data, $timezone);
185 185
         }
186 186
 
187 187
         if (false === $datetime) {
@@ -236,15 +236,15 @@  discard block
 block discarded – undo
236 236
         $format = 'P';
237 237
 
238 238
         if (0 < $dateInterval->y) {
239
-            $format .= $dateInterval->y . 'Y';
239
+            $format .= $dateInterval->y.'Y';
240 240
         }
241 241
 
242 242
         if (0 < $dateInterval->m) {
243
-            $format .= $dateInterval->m . 'M';
243
+            $format .= $dateInterval->m.'M';
244 244
         }
245 245
 
246 246
         if (0 < $dateInterval->d) {
247
-            $format .= $dateInterval->d . 'D';
247
+            $format .= $dateInterval->d.'D';
248 248
         }
249 249
 
250 250
         if (0 < $dateInterval->h || 0 < $dateInterval->i || 0 < $dateInterval->s) {
@@ -252,15 +252,15 @@  discard block
 block discarded – undo
252 252
         }
253 253
 
254 254
         if (0 < $dateInterval->h) {
255
-            $format .= $dateInterval->h . 'H';
255
+            $format .= $dateInterval->h.'H';
256 256
         }
257 257
 
258 258
         if (0 < $dateInterval->i) {
259
-            $format .= $dateInterval->i . 'M';
259
+            $format .= $dateInterval->i.'M';
260 260
         }
261 261
 
262 262
         if (0 < $dateInterval->s) {
263
-            $format .= $dateInterval->s . 'S';
263
+            $format .= $dateInterval->s.'S';
264 264
         }
265 265
 
266 266
         if ($format === 'P') {
Please login to merge, or discard this patch.
EventDispatcher/Subscriber/SymfonyValidatorValidatorSubscriber.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
             ? null
57 57
             : $context->attributes->get('validation_groups')->get();
58 58
 
59
-        if (!$groups) {
59
+        if ( ! $groups) {
60 60
             return;
61 61
         }
62 62
 
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/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/GraphNavigator.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -82,8 +82,7 @@
 block discarded – undo
82 82
         ObjectConstructorInterface $objectConstructor,
83 83
         EventDispatcherInterface $dispatcher = null,
84 84
         ExpressionEvaluatorInterface $expressionEvaluator = null
85
-    )
86
-    {
85
+    ) {
87 86
         $this->dispatcher = $dispatcher;
88 87
         $this->metadataFactory = $metadataFactory;
89 88
         $this->handlerRegistry = $handlerRegistry;
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
             case 'resource':
151 151
                 $msg = 'Resources are not supported in serialized data.';
152 152
                 if ($context instanceof SerializationContext && null !== $path = $context->getPath()) {
153
-                    $msg .= ' Path: ' . $path;
153
+                    $msg .= ' Path: '.$path;
154 154
                 }
155 155
 
156 156
                 throw new RuntimeException($msg);
@@ -206,11 +206,11 @@  discard block
 block discarded – undo
206 206
                 /** @var $metadata ClassMetadata */
207 207
                 $metadata = $this->metadataFactory->getMetadataForClass($type['name']);
208 208
 
209
-                if ($metadata->usingExpression && !$this->expressionExclusionStrategy) {
209
+                if ($metadata->usingExpression && ! $this->expressionExclusionStrategy) {
210 210
                     throw new ExpressionLanguageRequiredException("To use conditional exclude/expose in {$metadata->name} you must configure the expression language.");
211 211
                 }
212 212
 
213
-                if ($context instanceof DeserializationContext && !empty($metadata->discriminatorMap) && $type['name'] === $metadata->discriminatorBaseClass) {
213
+                if ($context instanceof DeserializationContext && ! empty($metadata->discriminatorMap) && $type['name'] === $metadata->discriminatorBaseClass) {
214 214
                     $metadata = $this->resolveMetadata($data, $metadata);
215 215
                 }
216 216
 
@@ -280,22 +280,22 @@  discard block
 block discarded – undo
280 280
     {
281 281
         switch (true) {
282 282
             case is_array($data) && isset($data[$metadata->discriminatorFieldName]):
283
-                $typeValue = (string)$data[$metadata->discriminatorFieldName];
283
+                $typeValue = (string) $data[$metadata->discriminatorFieldName];
284 284
                 break;
285 285
 
286 286
             // Check XML attribute for discriminatorFieldName
287 287
             case is_object($data) && $metadata->xmlDiscriminatorAttribute && isset($data[$metadata->discriminatorFieldName]):
288
-                $typeValue = (string)$data[$metadata->discriminatorFieldName];
288
+                $typeValue = (string) $data[$metadata->discriminatorFieldName];
289 289
                 break;
290 290
 
291 291
             // Check XML element with namespace for discriminatorFieldName
292
-            case is_object($data) && !$metadata->xmlDiscriminatorAttribute && null !== $metadata->xmlDiscriminatorNamespace && isset($data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}):
293
-                $typeValue = (string)$data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName};
292
+            case is_object($data) && ! $metadata->xmlDiscriminatorAttribute && null !== $metadata->xmlDiscriminatorNamespace && isset($data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}):
293
+                $typeValue = (string) $data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName};
294 294
                 break;
295 295
 
296 296
             // Check XML element for discriminatorFieldName
297 297
             case is_object($data) && isset($data->{$metadata->discriminatorFieldName}):
298
-                $typeValue = (string)$data->{$metadata->discriminatorFieldName};
298
+                $typeValue = (string) $data->{$metadata->discriminatorFieldName};
299 299
                 break;
300 300
 
301 301
             default:
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
                 ));
307 307
         }
308 308
 
309
-        if (!isset($metadata->discriminatorMap[$typeValue])) {
309
+        if ( ! isset($metadata->discriminatorMap[$typeValue])) {
310 310
             throw new \LogicException(sprintf(
311 311
                 'The type value "%s" does not exist in the discriminator map of class "%s". Available types: %s',
312 312
                 $typeValue,
Please login to merge, or discard this patch.
src/JMS/Serializer/Serializer.php 2 patches
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.
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/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/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/YamlSerializationVisitor.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
         $isHash = isset($type['params'][1]);
85 85
 
86 86
         $count = $this->writer->changeCount;
87
-        $isList = (isset($type['params'][0]) && !isset($type['params'][1]))
87
+        $isList = (isset($type['params'][0]) && ! isset($type['params'][1]))
88 88
             || array_keys($data) === range(0, count($data) - 1);
89 89
 
90 90
         foreach ($data as $k => $v) {
@@ -92,10 +92,10 @@  discard block
 block discarded – undo
92 92
                 continue;
93 93
             }
94 94
 
95
-            if ($isList && !$isHash) {
95
+            if ($isList && ! $isHash) {
96 96
                 $this->writer->writeln('-');
97 97
             } else {
98
-                $this->writer->writeln(Inline::dump($k) . ':');
98
+                $this->writer->writeln(Inline::dump($k).':');
99 99
             }
100 100
 
101 101
             $this->writer->indent();
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
             if (null !== $v = $this->navigator->accept($v, $this->getElementType($type), $context)) {
104 104
                 $this->writer
105 105
                     ->rtrim(false)
106
-                    ->writeln(' ' . $v);
106
+                    ->writeln(' '.$v);
107 107
             }
108 108
 
109 109
             $this->writer->outdent();
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 
134 134
     public function visitDouble($data, array $type, Context $context)
135 135
     {
136
-        $v = (string)$data;
136
+        $v = (string) $data;
137 137
 
138 138
         if ('' === $this->writer->content) {
139 139
             $this->writer->writeln($v);
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 
145 145
     public function visitInteger($data, array $type, Context $context)
146 146
     {
147
-        $v = (string)$data;
147
+        $v = (string) $data;
148 148
 
149 149
         if ('' === $this->writer->content) {
150 150
             $this->writer->writeln($v);
@@ -167,9 +167,9 @@  discard block
 block discarded – undo
167 167
 
168 168
         $name = $this->namingStrategy->translateName($metadata);
169 169
 
170
-        if (!$metadata->inline) {
170
+        if ( ! $metadata->inline) {
171 171
             $this->writer
172
-                ->writeln(Inline::dump($name) . ':')
172
+                ->writeln(Inline::dump($name).':')
173 173
                 ->indent();
174 174
         }
175 175
 
@@ -180,12 +180,12 @@  discard block
 block discarded – undo
180 180
         if (null !== $v = $this->navigator->accept($v, $metadata->type, $context)) {
181 181
             $this->writer
182 182
                 ->rtrim(false)
183
-                ->writeln(' ' . $v);
184
-        } elseif ($count === $this->writer->changeCount && !$metadata->inline) {
183
+                ->writeln(' '.$v);
184
+        } elseif ($count === $this->writer->changeCount && ! $metadata->inline) {
185 185
             $this->writer->revert();
186 186
         }
187 187
 
188
-        if (!$metadata->inline) {
188
+        if ( ! $metadata->inline) {
189 189
             $this->writer->outdent();
190 190
         }
191 191
         $this->revertCurrentMetadata();
Please login to merge, or discard this patch.