@@ -54,14 +54,14 @@ discard block |
||
54 | 54 | if ($this->nestedGroups) { |
55 | 55 | $groups = $this->getGroupsFor($navigatorContext); |
56 | 56 | |
57 | - if (!$property->groups) { |
|
58 | - return !in_array(self::DEFAULT_GROUP, $groups); |
|
57 | + if ( ! $property->groups) { |
|
58 | + return ! in_array(self::DEFAULT_GROUP, $groups); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | return $this->shouldSkipUsingGroups($property, $groups); |
62 | 62 | } else { |
63 | - if (!$property->groups) { |
|
64 | - return !isset($this->groups[self::DEFAULT_GROUP]); |
|
63 | + if ( ! $property->groups) { |
|
64 | + return ! isset($this->groups[self::DEFAULT_GROUP]); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | foreach ($property->groups as $group) { |
@@ -87,14 +87,14 @@ discard block |
||
87 | 87 | |
88 | 88 | public function getGroupsFor(Context $navigatorContext): array |
89 | 89 | { |
90 | - if (!$this->nestedGroups) { |
|
90 | + if ( ! $this->nestedGroups) { |
|
91 | 91 | return array_keys($this->groups); |
92 | 92 | } |
93 | 93 | |
94 | 94 | $paths = $navigatorContext->getCurrentPath(); |
95 | 95 | $groups = $this->groups; |
96 | 96 | foreach ($paths as $index => $path) { |
97 | - if (!array_key_exists($path, $groups)) { |
|
97 | + if ( ! array_key_exists($path, $groups)) { |
|
98 | 98 | if ($index > 0) { |
99 | 99 | $groups = [self::DEFAULT_GROUP]; |
100 | 100 | } else { |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | } |
106 | 106 | |
107 | 107 | $groups = $groups[$path]; |
108 | - if (!array_filter($groups, 'is_string')) { |
|
108 | + if ( ! array_filter($groups, 'is_string')) { |
|
109 | 109 | $groups += [self::DEFAULT_GROUP]; |
110 | 110 | } |
111 | 111 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | |
140 | 140 | switch ($type['name']) { |
141 | 141 | case 'NULL': |
142 | - if (!$this->shouldSerializeNull && !$this->isRootNullAllowed()) { |
|
142 | + if ( ! $this->shouldSerializeNull && ! $this->isRootNullAllowed()) { |
|
143 | 143 | throw new NotAcceptableException(); |
144 | 144 | } |
145 | 145 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | case 'resource': |
170 | 170 | $msg = 'Resources are not supported in serialized data.'; |
171 | 171 | if (null !== $path = $this->context->getPath()) { |
172 | - $msg .= ' Path: ' . $path; |
|
172 | + $msg .= ' Path: '.$path; |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | throw new RuntimeException($msg); |
@@ -235,8 +235,8 @@ discard block |
||
235 | 235 | throw new ExcludedClassException(); |
236 | 236 | } |
237 | 237 | |
238 | - if (!is_object($data)) { |
|
239 | - throw new InvalidArgumentException('Value at ' . $this->context->getPath() . ' is expected to be an object of class ' . $type['name'] . ' but is of type ' . gettype($data)); |
|
238 | + if ( ! is_object($data)) { |
|
239 | + throw new InvalidArgumentException('Value at '.$this->context->getPath().' is expected to be an object of class '.$type['name'].' but is of type '.gettype($data)); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | $this->context->pushClassMetadata($metadata); |
@@ -55,7 +55,7 @@ |
||
55 | 55 | |
56 | 56 | private function buildAnnotation(array $attributes): ?object |
57 | 57 | { |
58 | - if (!isset($attributes[0])) { |
|
58 | + if ( ! isset($attributes[0])) { |
|
59 | 59 | return null; |
60 | 60 | } |
61 | 61 |
@@ -10,9 +10,9 @@ discard block |
||
10 | 10 | { |
11 | 11 | private function loadAnnotationParameters(array $vars): void |
12 | 12 | { |
13 | - if (!array_key_exists('values', $vars)) { |
|
13 | + if ( ! array_key_exists('values', $vars)) { |
|
14 | 14 | $values = []; |
15 | - } elseif (!is_array($vars['values'])) { |
|
15 | + } elseif ( ! is_array($vars['values'])) { |
|
16 | 16 | $values = ['value' => $vars['values']]; |
17 | 17 | } else { |
18 | 18 | $values = $vars['values']; |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | } |
31 | 31 | |
32 | 32 | foreach ($vars as $key => $value) { |
33 | - if (!property_exists(static::class, $key)) { |
|
33 | + if ( ! property_exists(static::class, $key)) { |
|
34 | 34 | throw new InvalidArgumentException(sprintf('Unknown property "%s" on annotation "%s".', $key, static::class)); |
35 | 35 | } |
36 | 36 |
@@ -50,7 +50,7 @@ |
||
50 | 50 | |
51 | 51 | $driver = new AnnotationDriver($annotationReader, $this->propertyNamingStrategy, $this->typeParser); |
52 | 52 | |
53 | - if (!empty($metadataDirs)) { |
|
53 | + if ( ! empty($metadataDirs)) { |
|
54 | 54 | $fileLocator = new FileLocator($metadataDirs); |
55 | 55 | $driver = new DriverChain([ |
56 | 56 | new YamlDriver($fileLocator, $this->propertyNamingStrategy, $this->typeParser, $this->expressionEvaluator), |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | public function getFilters() |
36 | 36 | { |
37 | 37 | return [ |
38 | - new TwigFilter($this->serializationFunctionsPrefix . 'serialize', [$this, 'serialize']), |
|
38 | + new TwigFilter($this->serializationFunctionsPrefix.'serialize', [$this, 'serialize']), |
|
39 | 39 | ]; |
40 | 40 | } |
41 | 41 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | public function getFunctions() |
48 | 48 | { |
49 | 49 | return [ |
50 | - new TwigFunction($this->serializationFunctionsPrefix . 'serialization_context', '\JMS\Serializer\SerializationContext::create'), |
|
50 | + new TwigFunction($this->serializationFunctionsPrefix.'serialization_context', '\JMS\Serializer\SerializationContext::create'), |
|
51 | 51 | ]; |
52 | 52 | } |
53 | 53 |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | public function getFilters() |
21 | 21 | { |
22 | 22 | return [ |
23 | - new TwigFilter($this->serializationFunctionsPrefix . 'serialize', [SerializerRuntimeHelper::class, 'serialize']), |
|
23 | + new TwigFilter($this->serializationFunctionsPrefix.'serialize', [SerializerRuntimeHelper::class, 'serialize']), |
|
24 | 24 | ]; |
25 | 25 | } |
26 | 26 | |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | public function getFunctions() |
33 | 33 | { |
34 | 34 | return [ |
35 | - new TwigFunction($this->serializationFunctionsPrefix . 'serialization_context', '\JMS\Serializer\SerializationContext::create'), |
|
35 | + new TwigFunction($this->serializationFunctionsPrefix.'serialization_context', '\JMS\Serializer\SerializationContext::create'), |
|
36 | 36 | ]; |
37 | 37 | } |
38 | 38 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | 'type' => $type, |
48 | 48 | 'format' => $format, |
49 | 49 | 'direction' => GraphNavigatorInterface::DIRECTION_SERIALIZATION, |
50 | - 'method' => 'serialize' . $type, |
|
50 | + 'method' => 'serialize'.$type, |
|
51 | 51 | ]; |
52 | 52 | } |
53 | 53 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | 'type' => \DateTimeInterface::class, |
56 | 56 | 'direction' => GraphNavigatorInterface::DIRECTION_DESERIALIZATION, |
57 | 57 | 'format' => $format, |
58 | - 'method' => 'deserializeDateTimeFrom' . ucfirst($format), |
|
58 | + 'method' => 'deserializeDateTimeFrom'.ucfirst($format), |
|
59 | 59 | ]; |
60 | 60 | |
61 | 61 | $methods[] = [ |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | */ |
232 | 232 | private function parseDateTime($data, array $type, bool $immutable = false): \DateTimeInterface |
233 | 233 | { |
234 | - $timezone = !empty($type['params'][1]) ? new \DateTimeZone($type['params'][1]) : $this->defaultTimezone; |
|
234 | + $timezone = ! empty($type['params'][1]) ? new \DateTimeZone($type['params'][1]) : $this->defaultTimezone; |
|
235 | 235 | $formats = $this->getDeserializationFormats($type); |
236 | 236 | |
237 | 237 | $formatTried = []; |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | throw new RuntimeException(sprintf( |
257 | 257 | 'Invalid datetime "%s", expected one of the format %s.', |
258 | 258 | $data, |
259 | - '"' . implode('", "', $formatTried) . '"' |
|
259 | + '"'.implode('", "', $formatTried).'"' |
|
260 | 260 | )); |
261 | 261 | } |
262 | 262 | |
@@ -304,15 +304,15 @@ discard block |
||
304 | 304 | $format = 'P'; |
305 | 305 | |
306 | 306 | if (0 < $dateInterval->y) { |
307 | - $format .= $dateInterval->y . 'Y'; |
|
307 | + $format .= $dateInterval->y.'Y'; |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | if (0 < $dateInterval->m) { |
311 | - $format .= $dateInterval->m . 'M'; |
|
311 | + $format .= $dateInterval->m.'M'; |
|
312 | 312 | } |
313 | 313 | |
314 | 314 | if (0 < $dateInterval->d) { |
315 | - $format .= $dateInterval->d . 'D'; |
|
315 | + $format .= $dateInterval->d.'D'; |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | if (0 < $dateInterval->h || 0 < $dateInterval->i || 0 < $dateInterval->s) { |
@@ -320,15 +320,15 @@ discard block |
||
320 | 320 | } |
321 | 321 | |
322 | 322 | if (0 < $dateInterval->h) { |
323 | - $format .= $dateInterval->h . 'H'; |
|
323 | + $format .= $dateInterval->h.'H'; |
|
324 | 324 | } |
325 | 325 | |
326 | 326 | if (0 < $dateInterval->i) { |
327 | - $format .= $dateInterval->i . 'M'; |
|
327 | + $format .= $dateInterval->i.'M'; |
|
328 | 328 | } |
329 | 329 | |
330 | 330 | if (0 < $dateInterval->s) { |
331 | - $format .= $dateInterval->s . 'S'; |
|
331 | + $format .= $dateInterval->s.'S'; |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | if ('P' === $format) { |
@@ -25,7 +25,7 @@ |
||
25 | 25 | All the other cases should work as expected. |
26 | 26 | The alternative here is to use the explicit syntax Groups(groups=['value' => '...']) |
27 | 27 | */ |
28 | - if (count($values) > 0 && ((!isset($values['value']) && !isset($values['groups'])) || count($values) > 1) && 0 === count($groups)) { |
|
28 | + if (count($values) > 0 && (( ! isset($values['value']) && ! isset($values['groups'])) || count($values) > 1) && 0 === count($groups)) { |
|
29 | 29 | $vars['groups'] = $values; |
30 | 30 | $vars['values'] = []; |
31 | 31 | } |