@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | |
115 | 115 | switch ($type['name']) { |
116 | 116 | case 'NULL': |
117 | - if (!$this->shouldSerializeNull) { |
|
117 | + if ( ! $this->shouldSerializeNull) { |
|
118 | 118 | throw new NotAcceptableException(); |
119 | 119 | } |
120 | 120 | return $this->visitor->visitNull($data, $type); |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | case 'resource': |
141 | 141 | $msg = 'Resources are not supported in serialized data.'; |
142 | 142 | if (null !== $path = $this->context->getPath()) { |
143 | - $msg .= ' Path: ' . $path; |
|
143 | + $msg .= ' Path: '.$path; |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | throw new RuntimeException($msg); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | 'direction' => GraphNavigatorInterface::DIRECTION_SERIALIZATION, |
27 | 27 | 'type' => $type, |
28 | 28 | 'format' => $format, |
29 | - 'method' => $method . 'To' . $format, |
|
29 | + 'method' => $method.'To'.$format, |
|
30 | 30 | ]; |
31 | 31 | } |
32 | 32 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | public function serializeListToXml(XmlSerializationVisitor $visitor, ConstraintViolationList $list, array $type): void |
38 | 38 | { |
39 | 39 | $currentNode = $visitor->getCurrentNode(); |
40 | - if (!$currentNode) { |
|
40 | + if ( ! $currentNode) { |
|
41 | 41 | $visitor->createRoot(); |
42 | 42 | } |
43 | 43 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | $violationNode = $visitor->getDocument()->createElement('violation'); |
57 | 57 | |
58 | 58 | $parent = $visitor->getCurrentNode(); |
59 | - if (!$parent) { |
|
59 | + if ( ! $parent) { |
|
60 | 60 | $visitor->setCurrentAndRootNode($violationNode); |
61 | 61 | } else { |
62 | 62 | $parent->appendChild($violationNode); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | return $value; |
47 | 47 | } |
48 | 48 | |
49 | - return str_replace($escapeChar . $escapeChar, $escapeChar, $value); |
|
49 | + return str_replace($escapeChar.$escapeChar, $escapeChar, $value); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | private function visitCompoundType(TreeNode $element, ?int &$handle, ?int $eldnah): array |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | return [ |
58 | 58 | 'name' => $nameToken->getValueValue(), |
59 | 59 | 'params' => array_map( |
60 | - function (TreeNode $node) use ($handle, $eldnah) { |
|
60 | + function(TreeNode $node) use ($handle, $eldnah) { |
|
61 | 61 | return $node->accept($this, $handle, $eldnah); |
62 | 62 | }, |
63 | 63 | $parameters |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $this->addExclusionStrategy(new VersionExclusionStrategy($this->attributes['version'])); |
69 | 69 | } |
70 | 70 | |
71 | - if (!empty($this->attributes['max_depth_checks'])) { |
|
71 | + if ( ! empty($this->attributes['max_depth_checks'])) { |
|
72 | 72 | $this->addExclusionStrategy(new DepthExclusionStrategy()); |
73 | 73 | } |
74 | 74 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | |
116 | 116 | private function assertMutable(): void |
117 | 117 | { |
118 | - if (!$this->initialized) { |
|
118 | + if ( ! $this->initialized) { |
|
119 | 119 | return; |
120 | 120 | } |
121 | 121 | |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | { |
212 | 212 | $metadata = $this->metadataStack->pop(); |
213 | 213 | |
214 | - if (!$metadata instanceof PropertyMetadata) { |
|
214 | + if ( ! $metadata instanceof PropertyMetadata) { |
|
215 | 215 | throw new RuntimeException('Context metadataStack not working well'); |
216 | 216 | } |
217 | 217 | } |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | { |
221 | 221 | $metadata = $this->metadataStack->pop(); |
222 | 222 | |
223 | - if (!$metadata instanceof ClassMetadata) { |
|
223 | + if ( ! $metadata instanceof ClassMetadata) { |
|
224 | 224 | throw new RuntimeException('Context metadataStack not working well'); |
225 | 225 | } |
226 | 226 | } |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | */ |
236 | 236 | public function getCurrentPath(): array |
237 | 237 | { |
238 | - if (!$this->metadataStack) { |
|
238 | + if ( ! $this->metadataStack) { |
|
239 | 239 | return []; |
240 | 240 | } |
241 | 241 |
@@ -69,9 +69,9 @@ discard block |
||
69 | 69 | } |
70 | 70 | |
71 | 71 | if (null === $metadata->getter) { |
72 | - if (!isset($this->readAccessors[$metadata->class])) { |
|
72 | + if ( ! isset($this->readAccessors[$metadata->class])) { |
|
73 | 73 | if (true === $metadata->forceReflectionAccess) { |
74 | - $this->readAccessors[$metadata->class] = function ($o, $name) use ($metadata) { |
|
74 | + $this->readAccessors[$metadata->class] = function($o, $name) use ($metadata) { |
|
75 | 75 | $ref = $this->propertyReflectionCache[$metadata->class][$name] ?? null; |
76 | 76 | if (null === $ref) { |
77 | 77 | $ref = new \ReflectionProperty($metadata->class, $name); |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | return $ref->getValue($o); |
83 | 83 | }; |
84 | 84 | } else { |
85 | - $this->readAccessors[$metadata->class] = \Closure::bind(static function ($o, $name) { |
|
85 | + $this->readAccessors[$metadata->class] = \Closure::bind(static function($o, $name) { |
|
86 | 86 | return $o->$name; |
87 | 87 | }, null, $metadata->class); |
88 | 88 | } |
@@ -104,9 +104,9 @@ discard block |
||
104 | 104 | } |
105 | 105 | |
106 | 106 | if (null === $metadata->setter) { |
107 | - if (!isset($this->writeAccessors[$metadata->class])) { |
|
107 | + if ( ! isset($this->writeAccessors[$metadata->class])) { |
|
108 | 108 | if (true === $metadata->forceReflectionAccess) { |
109 | - $this->writeAccessors[$metadata->class] = function ($o, $name, $value) use ($metadata): void { |
|
109 | + $this->writeAccessors[$metadata->class] = function($o, $name, $value) use ($metadata): void { |
|
110 | 110 | $ref = $this->propertyReflectionCache[$metadata->class][$name] ?? null; |
111 | 111 | if (null === $ref) { |
112 | 112 | $ref = new \ReflectionProperty($metadata->class, $name); |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | $ref->setValue($o, $value); |
118 | 118 | }; |
119 | 119 | } else { |
120 | - $this->writeAccessors[$metadata->class] = \Closure::bind(static function ($o, $name, $value): void { |
|
120 | + $this->writeAccessors[$metadata->class] = \Closure::bind(static function($o, $name, $value): void { |
|
121 | 121 | $o->$name = $value; |
122 | 122 | }, null, $metadata->class); |
123 | 123 | } |
@@ -15,7 +15,7 @@ |
||
15 | 15 | { |
16 | 16 | uasort( |
17 | 17 | $properties, |
18 | - static function (PropertyMetadata $a, PropertyMetadata $b): int { |
|
18 | + static function(PropertyMetadata $a, PropertyMetadata $b): int { |
|
19 | 19 | return strcmp($a->name, $b->name); |
20 | 20 | } |
21 | 21 | ); |
@@ -166,11 +166,11 @@ discard block |
||
166 | 166 | /** @var ClassMetadata $metadata */ |
167 | 167 | $metadata = $this->metadataFactory->getMetadataForClass($type['name']); |
168 | 168 | |
169 | - if ($metadata->usingExpression && !$this->expressionExclusionStrategy) { |
|
169 | + if ($metadata->usingExpression && ! $this->expressionExclusionStrategy) { |
|
170 | 170 | throw new ExpressionLanguageRequiredException(sprintf('To use conditional exclude/expose in %s you must configure the expression language.', $metadata->name)); |
171 | 171 | } |
172 | 172 | |
173 | - if (!empty($metadata->discriminatorMap) && $type['name'] === $metadata->discriminatorBaseClass) { |
|
173 | + if ( ! empty($metadata->discriminatorMap) && $type['name'] === $metadata->discriminatorBaseClass) { |
|
174 | 174 | $metadata = $this->resolveMetadata($data, $metadata); |
175 | 175 | } |
176 | 176 | |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | { |
222 | 222 | $typeValue = $this->visitor->visitDiscriminatorMapProperty($data, $metadata); |
223 | 223 | |
224 | - if (!isset($metadata->discriminatorMap[$typeValue])) { |
|
224 | + if ( ! isset($metadata->discriminatorMap[$typeValue])) { |
|
225 | 225 | throw new LogicException(sprintf( |
226 | 226 | 'The type value "%s" does not exist in the discriminator map of class "%s". Available types: %s', |
227 | 227 | $typeValue, |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | |
82 | 82 | if (false !== stripos($data, '<!doctype')) { |
83 | 83 | $internalSubset = $this->getDomDocumentTypeEntitySubset($data); |
84 | - if (!in_array($internalSubset, $this->doctypeWhitelist, true)) { |
|
84 | + if ( ! in_array($internalSubset, $this->doctypeWhitelist, true)) { |
|
85 | 85 | throw new InvalidArgumentException(sprintf( |
86 | 86 | 'The document type "%s" is not allowed. If it is safe, you may add it to the whitelist configuration.', |
87 | 87 | $internalSubset |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | $nodes = $data->xpath($entryName); |
198 | 198 | } |
199 | 199 | |
200 | - if (!\count($nodes)) { |
|
200 | + if ( ! \count($nodes)) { |
|
201 | 201 | return []; |
202 | 202 | } |
203 | 203 | |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | $nodes = $data->children($namespace)->$entryName; |
226 | 226 | foreach ($nodes as $v) { |
227 | 227 | $attrs = $v->attributes(); |
228 | - if (!isset($attrs[$this->currentMetadata->xmlKeyAttribute])) { |
|
228 | + if ( ! isset($attrs[$this->currentMetadata->xmlKeyAttribute])) { |
|
229 | 229 | throw new RuntimeException(sprintf('The key attribute "%s" must be set for each entry of the map.', $this->currentMetadata->xmlKeyAttribute)); |
230 | 230 | } |
231 | 231 | |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | return (string) $data->attributes($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}; |
255 | 255 | |
256 | 256 | // Check XML element with namespace for discriminatorFieldName |
257 | - case !$metadata->xmlDiscriminatorAttribute && null !== $metadata->xmlDiscriminatorNamespace && isset($data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}): |
|
257 | + case ! $metadata->xmlDiscriminatorAttribute && null !== $metadata->xmlDiscriminatorNamespace && isset($data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}): |
|
258 | 258 | return (string) $data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}; |
259 | 259 | // Check XML element for discriminatorFieldName |
260 | 260 | case isset($data->{$metadata->discriminatorFieldName}): |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | $name = $metadata->serializedName; |
283 | 283 | |
284 | 284 | if (true === $metadata->inline) { |
285 | - if (!$metadata->type) { |
|
285 | + if ( ! $metadata->type) { |
|
286 | 286 | throw RuntimeException::noMetadataForProperty($metadata->class, $metadata->name); |
287 | 287 | } |
288 | 288 | return $this->navigator->accept($data, $metadata->type); |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | if ($metadata->xmlAttribute) { |
291 | 291 | $attributes = $data->attributes($metadata->xmlNamespace); |
292 | 292 | if (isset($attributes[$name])) { |
293 | - if (!$metadata->type) { |
|
293 | + if ( ! $metadata->type) { |
|
294 | 294 | throw RuntimeException::noMetadataForProperty($metadata->class, $metadata->name); |
295 | 295 | } |
296 | 296 | return $this->navigator->accept($attributes[$name], $metadata->type); |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | } |
301 | 301 | |
302 | 302 | if ($metadata->xmlValue) { |
303 | - if (!$metadata->type) { |
|
303 | + if ( ! $metadata->type) { |
|
304 | 304 | throw RuntimeException::noMetadataForProperty($metadata->class, $metadata->name); |
305 | 305 | } |
306 | 306 | return $this->navigator->accept($data, $metadata->type); |
@@ -308,12 +308,12 @@ discard block |
||
308 | 308 | |
309 | 309 | if ($metadata->xmlCollection) { |
310 | 310 | $enclosingElem = $data; |
311 | - if (!$metadata->xmlCollectionInline) { |
|
311 | + if ( ! $metadata->xmlCollectionInline) { |
|
312 | 312 | $enclosingElem = $data->children($metadata->xmlNamespace)->$name; |
313 | 313 | } |
314 | 314 | |
315 | 315 | $this->setCurrentMetadata($metadata); |
316 | - if (!$metadata->type) { |
|
316 | + if ( ! $metadata->type) { |
|
317 | 317 | throw RuntimeException::noMetadataForProperty($metadata->class, $metadata->name); |
318 | 318 | } |
319 | 319 | $v = $this->navigator->accept($enclosingElem, $metadata->type); |
@@ -323,13 +323,13 @@ discard block |
||
323 | 323 | |
324 | 324 | if ($metadata->xmlNamespace) { |
325 | 325 | $node = $data->children($metadata->xmlNamespace)->$name; |
326 | - if (!$node->count()) { |
|
326 | + if ( ! $node->count()) { |
|
327 | 327 | throw new NotAcceptableException(); |
328 | 328 | } |
329 | 329 | } elseif ('' === $metadata->xmlNamespace) { |
330 | 330 | // See #1087 - element must be like: <element xmlns="" /> - https://www.w3.org/TR/REC-xml-names/#iri-use |
331 | 331 | // Use of an empty string in a namespace declaration turns it into an "undeclaration". |
332 | - $nodes = $data->xpath('./' . $name); |
|
332 | + $nodes = $data->xpath('./'.$name); |
|
333 | 333 | if (empty($nodes)) { |
334 | 334 | throw new NotAcceptableException(); |
335 | 335 | } |
@@ -339,9 +339,9 @@ discard block |
||
339 | 339 | if (isset($namespaces[''])) { |
340 | 340 | $prefix = uniqid('ns-'); |
341 | 341 | $data->registerXPathNamespace($prefix, $namespaces['']); |
342 | - $nodes = $data->xpath('./' . $prefix . ':' . $name); |
|
342 | + $nodes = $data->xpath('./'.$prefix.':'.$name); |
|
343 | 343 | } else { |
344 | - $nodes = $data->xpath('./' . $name); |
|
344 | + $nodes = $data->xpath('./'.$name); |
|
345 | 345 | } |
346 | 346 | if (empty($nodes)) { |
347 | 347 | throw new NotAcceptableException(); |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | $this->setCurrentMetadata($metadata); |
354 | 354 | } |
355 | 355 | |
356 | - if (!$metadata->type) { |
|
356 | + if ( ! $metadata->type) { |
|
357 | 357 | throw RuntimeException::noMetadataForProperty($metadata->class, $metadata->name); |
358 | 358 | } |
359 | 359 | return $this->navigator->accept($node, $metadata->type); |
@@ -39,13 +39,13 @@ discard block |
||
39 | 39 | // If the set type name is not an actual class, but a faked type for which a custom handler exists, we do not |
40 | 40 | // modify it with this subscriber. Also, we forgo autoloading here as an instance of this type is already created, |
41 | 41 | // so it must be loaded if its a real class. |
42 | - $virtualType = !class_exists($type['name'], false); |
|
42 | + $virtualType = ! class_exists($type['name'], false); |
|
43 | 43 | |
44 | 44 | if ($object instanceof PersistentCollection |
45 | 45 | || $object instanceof MongoDBPersistentCollection |
46 | 46 | || $object instanceof PHPCRPersistentCollection |
47 | 47 | ) { |
48 | - if (!$virtualType) { |
|
48 | + if ( ! $virtualType) { |
|
49 | 49 | $event->setType('ArrayCollection'); |
50 | 50 | } |
51 | 51 | |
@@ -53,13 +53,13 @@ discard block |
||
53 | 53 | } |
54 | 54 | |
55 | 55 | if (($this->skipVirtualTypeInit && $virtualType) || |
56 | - (!$object instanceof Proxy && !$object instanceof ORMProxy) |
|
56 | + ( ! $object instanceof Proxy && ! $object instanceof ORMProxy) |
|
57 | 57 | ) { |
58 | 58 | return; |
59 | 59 | } |
60 | 60 | |
61 | 61 | // do not initialize the proxy if is going to be excluded by-class by some exclusion strategy |
62 | - if (false === $this->initializeExcluded && !$virtualType) { |
|
62 | + if (false === $this->initializeExcluded && ! $virtualType) { |
|
63 | 63 | $context = $event->getContext(); |
64 | 64 | $exclusionStrategy = $context->getExclusionStrategy(); |
65 | 65 | $metadata = $context->getMetadataFactory()->getMetadataForClass(get_parent_class($object)); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | $object->__load(); |
72 | 72 | |
73 | - if (!$virtualType) { |
|
73 | + if ( ! $virtualType) { |
|
74 | 74 | $event->setType(get_parent_class($object), $type['params']); |
75 | 75 | } |
76 | 76 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | { |
80 | 80 | $type = $event->getType(); |
81 | 81 | // is a virtual type? then there is no need to change the event name |
82 | - if (!class_exists($type['name'], false)) { |
|
82 | + if ( ! class_exists($type['name'], false)) { |
|
83 | 83 | return; |
84 | 84 | } |
85 | 85 |