@@ -40,14 +40,14 @@ discard block |
||
40 | 40 | // If the set type name is not an actual class, but a faked type for which a custom handler exists, we do not |
41 | 41 | // modify it with this subscriber. Also, we forgo autoloading here as an instance of this type is already created, |
42 | 42 | // so it must be loaded if its a real class. |
43 | - $virtualType = !class_exists($type['name'], false); |
|
43 | + $virtualType = ! class_exists($type['name'], false); |
|
44 | 44 | |
45 | 45 | if ( |
46 | 46 | $object instanceof PersistentCollection |
47 | 47 | || $object instanceof MongoDBPersistentCollection |
48 | 48 | || $object instanceof PHPCRPersistentCollection |
49 | 49 | ) { |
50 | - if (!$virtualType) { |
|
50 | + if ( ! $virtualType) { |
|
51 | 51 | $event->setType('ArrayCollection'); |
52 | 52 | } |
53 | 53 | |
@@ -56,13 +56,13 @@ discard block |
||
56 | 56 | |
57 | 57 | if ( |
58 | 58 | ($this->skipVirtualTypeInit && $virtualType) || |
59 | - (!$object instanceof Proxy && !$object instanceof LazyLoadingInterface) |
|
59 | + ( ! $object instanceof Proxy && ! $object instanceof LazyLoadingInterface) |
|
60 | 60 | ) { |
61 | 61 | return; |
62 | 62 | } |
63 | 63 | |
64 | 64 | // do not initialize the proxy if is going to be excluded by-class by some exclusion strategy |
65 | - if (false === $this->initializeExcluded && !$virtualType) { |
|
65 | + if (false === $this->initializeExcluded && ! $virtualType) { |
|
66 | 66 | $context = $event->getContext(); |
67 | 67 | $exclusionStrategy = $context->getExclusionStrategy(); |
68 | 68 | $metadata = $context->getMetadataFactory()->getMetadataForClass(get_parent_class($object)); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $object->__load(); |
78 | 78 | } |
79 | 79 | |
80 | - if (!$virtualType) { |
|
80 | + if ( ! $virtualType) { |
|
81 | 81 | $event->setType(get_parent_class($object), $type['params']); |
82 | 82 | } |
83 | 83 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | { |
87 | 87 | $type = $event->getType(); |
88 | 88 | // is a virtual type? then there is no need to change the event name |
89 | - if (!class_exists($type['name'], false)) { |
|
89 | + if ( ! class_exists($type['name'], false)) { |
|
90 | 90 | return; |
91 | 91 | } |
92 | 92 |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | |
85 | 85 | if (false !== stripos($data, '<!doctype')) { |
86 | 86 | $internalSubset = $this->getDomDocumentTypeEntitySubset($data); |
87 | - if (!in_array($internalSubset, $this->doctypeWhitelist, true)) { |
|
87 | + if ( ! in_array($internalSubset, $this->doctypeWhitelist, true)) { |
|
88 | 88 | throw new InvalidArgumentException(sprintf( |
89 | 89 | 'The document type "%s" is not allowed. If it is safe, you may add it to the whitelist configuration.', |
90 | 90 | $internalSubset |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | $nodes = $data->xpath($entryName); |
210 | 210 | } |
211 | 211 | |
212 | - if (null === $nodes || !\count($nodes)) { |
|
212 | + if (null === $nodes || ! \count($nodes)) { |
|
213 | 213 | return []; |
214 | 214 | } |
215 | 215 | |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | $nodes = $data->children($namespace)->$entryName; |
238 | 238 | foreach ($nodes as $v) { |
239 | 239 | $attrs = $v->attributes(); |
240 | - if (!isset($attrs[$this->currentMetadata->xmlKeyAttribute])) { |
|
240 | + if ( ! isset($attrs[$this->currentMetadata->xmlKeyAttribute])) { |
|
241 | 241 | throw new RuntimeException(sprintf('The key attribute "%s" must be set for each entry of the map.', $this->currentMetadata->xmlKeyAttribute)); |
242 | 242 | } |
243 | 243 | |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | return (string) $data->attributes($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}; |
268 | 268 | |
269 | 269 | // Check XML element with namespace for discriminatorFieldName |
270 | - case !$metadata->xmlDiscriminatorAttribute && null !== $metadata->xmlDiscriminatorNamespace && isset($data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}): |
|
270 | + case ! $metadata->xmlDiscriminatorAttribute && null !== $metadata->xmlDiscriminatorNamespace && isset($data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}): |
|
271 | 271 | return (string) $data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}; |
272 | 272 | |
273 | 273 | // Check XML element for discriminatorFieldName |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | $name = $metadata->serializedName; |
298 | 298 | |
299 | 299 | if (true === $metadata->inline) { |
300 | - if (!$metadata->type) { |
|
300 | + if ( ! $metadata->type) { |
|
301 | 301 | throw RuntimeException::noMetadataForProperty($metadata->class, $metadata->name); |
302 | 302 | } |
303 | 303 | |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | if ($metadata->xmlAttribute) { |
308 | 308 | $attributes = $data->attributes($metadata->xmlNamespace); |
309 | 309 | if (isset($attributes[$name])) { |
310 | - if (!$metadata->type) { |
|
310 | + if ( ! $metadata->type) { |
|
311 | 311 | throw RuntimeException::noMetadataForProperty($metadata->class, $metadata->name); |
312 | 312 | } |
313 | 313 | |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | } |
319 | 319 | |
320 | 320 | if ($metadata->xmlValue) { |
321 | - if (!$metadata->type) { |
|
321 | + if ( ! $metadata->type) { |
|
322 | 322 | throw RuntimeException::noMetadataForProperty($metadata->class, $metadata->name); |
323 | 323 | } |
324 | 324 | |
@@ -327,12 +327,12 @@ discard block |
||
327 | 327 | |
328 | 328 | if ($metadata->xmlCollection) { |
329 | 329 | $enclosingElem = $data; |
330 | - if (!$metadata->xmlCollectionInline) { |
|
330 | + if ( ! $metadata->xmlCollectionInline) { |
|
331 | 331 | $enclosingElem = $data->children($metadata->xmlNamespace)->$name; |
332 | 332 | } |
333 | 333 | |
334 | 334 | $this->setCurrentMetadata($metadata); |
335 | - if (!$metadata->type) { |
|
335 | + if ( ! $metadata->type) { |
|
336 | 336 | throw RuntimeException::noMetadataForProperty($metadata->class, $metadata->name); |
337 | 337 | } |
338 | 338 | |
@@ -344,13 +344,13 @@ discard block |
||
344 | 344 | |
345 | 345 | if ($metadata->xmlNamespace) { |
346 | 346 | $node = $data->children($metadata->xmlNamespace)->$name; |
347 | - if (!$node->count()) { |
|
347 | + if ( ! $node->count()) { |
|
348 | 348 | throw new NotAcceptableException(); |
349 | 349 | } |
350 | 350 | } elseif ('' === $metadata->xmlNamespace) { |
351 | 351 | // See #1087 - element must be like: <element xmlns="" /> - https://www.w3.org/TR/REC-xml-names/#iri-use |
352 | 352 | // Use of an empty string in a namespace declaration turns it into an "undeclaration". |
353 | - $nodes = $data->xpath('./' . $name); |
|
353 | + $nodes = $data->xpath('./'.$name); |
|
354 | 354 | if (empty($nodes)) { |
355 | 355 | throw new NotAcceptableException(); |
356 | 356 | } |
@@ -361,9 +361,9 @@ discard block |
||
361 | 361 | if (isset($namespaces[''])) { |
362 | 362 | $prefix = uniqid('ns-'); |
363 | 363 | $data->registerXPathNamespace($prefix, $namespaces['']); |
364 | - $nodes = $data->xpath('./' . $prefix . ':' . $name); |
|
364 | + $nodes = $data->xpath('./'.$prefix.':'.$name); |
|
365 | 365 | } else { |
366 | - $nodes = $data->xpath('./' . $name); |
|
366 | + $nodes = $data->xpath('./'.$name); |
|
367 | 367 | } |
368 | 368 | |
369 | 369 | if (empty($nodes)) { |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | $this->setCurrentMetadata($metadata); |
378 | 378 | } |
379 | 379 | |
380 | - if (!$metadata->type) { |
|
380 | + if ( ! $metadata->type) { |
|
381 | 381 | throw RuntimeException::noMetadataForProperty($metadata->class, $metadata->name); |
382 | 382 | } |
383 | 383 |
@@ -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 | } |