@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | case 'resource': |
156 | 156 | $msg = 'Resources are not supported in serialized data.'; |
157 | 157 | if ($context instanceof SerializationContext && null !== $path = $context->getPath()) { |
158 | - $msg .= ' Path: ' . $path; |
|
158 | + $msg .= ' Path: '.$path; |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | throw new RuntimeException($msg); |
@@ -211,11 +211,11 @@ discard block |
||
211 | 211 | /** @var $metadata ClassMetadata */ |
212 | 212 | $metadata = $this->metadataFactory->getMetadataForClass($type['name']); |
213 | 213 | |
214 | - if ($metadata->usingExpression && !$this->expressionExclusionStrategy) { |
|
214 | + if ($metadata->usingExpression && ! $this->expressionExclusionStrategy) { |
|
215 | 215 | throw new ExpressionLanguageRequiredException("To use conditional exclude/expose in {$metadata->name} you must configure the expression language."); |
216 | 216 | } |
217 | 217 | |
218 | - if ($context instanceof DeserializationContext && !empty($metadata->discriminatorMap) && $type['name'] === $metadata->discriminatorBaseClass) { |
|
218 | + if ($context instanceof DeserializationContext && ! empty($metadata->discriminatorMap) && $type['name'] === $metadata->discriminatorBaseClass) { |
|
219 | 219 | $metadata = $this->resolveMetadata($data, $metadata); |
220 | 220 | } |
221 | 221 | |
@@ -285,22 +285,22 @@ discard block |
||
285 | 285 | { |
286 | 286 | switch (true) { |
287 | 287 | case \is_array($data) && 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 attribute for discriminatorFieldName |
292 | 292 | case \is_object($data) && $metadata->xmlDiscriminatorAttribute && isset($data[$metadata->discriminatorFieldName]): |
293 | - $typeValue = (string)$data[$metadata->discriminatorFieldName]; |
|
293 | + $typeValue = (string) $data[$metadata->discriminatorFieldName]; |
|
294 | 294 | break; |
295 | 295 | |
296 | 296 | // Check XML element with namespace for discriminatorFieldName |
297 | - case \is_object($data) && !$metadata->xmlDiscriminatorAttribute && null !== $metadata->xmlDiscriminatorNamespace && isset($data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}): |
|
298 | - $typeValue = (string)$data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}; |
|
297 | + case \is_object($data) && ! $metadata->xmlDiscriminatorAttribute && null !== $metadata->xmlDiscriminatorNamespace && isset($data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}): |
|
298 | + $typeValue = (string) $data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}; |
|
299 | 299 | break; |
300 | 300 | |
301 | 301 | // Check XML element for discriminatorFieldName |
302 | 302 | case \is_object($data) && isset($data->{$metadata->discriminatorFieldName}): |
303 | - $typeValue = (string)$data->{$metadata->discriminatorFieldName}; |
|
303 | + $typeValue = (string) $data->{$metadata->discriminatorFieldName}; |
|
304 | 304 | break; |
305 | 305 | |
306 | 306 | default: |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | )); |
312 | 312 | } |
313 | 313 | |
314 | - if (!isset($metadata->discriminatorMap[$typeValue])) { |
|
314 | + if ( ! isset($metadata->discriminatorMap[$typeValue])) { |
|
315 | 315 | throw new \LogicException(sprintf( |
316 | 316 | 'The type value "%s" does not exist in the discriminator map of class "%s". Available types: %s', |
317 | 317 | $typeValue, |
@@ -30,7 +30,7 @@ |
||
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 |
@@ -33,7 +33,7 @@ |
||
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 |
@@ -34,10 +34,10 @@ discard block |
||
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 |
||
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 |
||
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 |
@@ -28,7 +28,7 @@ discard block |
||
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 |
||
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 |
@@ -106,7 +106,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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) { |
@@ -64,13 +64,13 @@ |
||
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 |
@@ -58,7 +58,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -61,7 +61,7 @@ discard block |
||
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 |
||
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 |
||
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; |