@@ -43,7 +43,7 @@ |
||
43 | 43 | */ |
44 | 44 | public function translateName(PropertyMetadata $property): string |
45 | 45 | { |
46 | - $name = preg_replace('/[A-Z]+/', $this->separator . '\\0', $property->name); |
|
46 | + $name = preg_replace('/[A-Z]+/', $this->separator.'\\0', $property->name); |
|
47 | 47 | |
48 | 48 | if ($this->lowerCase) { |
49 | 49 | return strtolower($name); |
@@ -163,11 +163,11 @@ discard block |
||
163 | 163 | /** @var $metadata ClassMetadata */ |
164 | 164 | $metadata = $this->metadataFactory->getMetadataForClass($type['name']); |
165 | 165 | |
166 | - if ($metadata->usingExpression && !$this->expressionExclusionStrategy) { |
|
166 | + if ($metadata->usingExpression && ! $this->expressionExclusionStrategy) { |
|
167 | 167 | throw new ExpressionLanguageRequiredException("To use conditional exclude/expose in {$metadata->name} you must configure the expression language."); |
168 | 168 | } |
169 | 169 | |
170 | - if (!empty($metadata->discriminatorMap) && $type['name'] === $metadata->discriminatorBaseClass) { |
|
170 | + if ( ! empty($metadata->discriminatorMap) && $type['name'] === $metadata->discriminatorBaseClass) { |
|
171 | 171 | $metadata = $this->resolveMetadata($data, $metadata); |
172 | 172 | } |
173 | 173 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | { |
217 | 217 | $typeValue = $this->visitor->visitDiscriminatorMapProperty($data, $metadata); |
218 | 218 | |
219 | - if (!isset($metadata->discriminatorMap[$typeValue])) { |
|
219 | + if ( ! isset($metadata->discriminatorMap[$typeValue])) { |
|
220 | 220 | throw new LogicException(sprintf( |
221 | 221 | 'The type value "%s" does not exist in the discriminator map of class "%s". Available types: %s', |
222 | 222 | $typeValue, |
@@ -37,10 +37,10 @@ discard block |
||
37 | 37 | |
38 | 38 | switch ($direction) { |
39 | 39 | case GraphNavigatorInterface::DIRECTION_DESERIALIZATION: |
40 | - return 'deserialize' . $type . 'From' . $format; |
|
40 | + return 'deserialize'.$type.'From'.$format; |
|
41 | 41 | |
42 | 42 | case GraphNavigatorInterface::DIRECTION_SERIALIZATION: |
43 | - return 'serialize' . $type . 'To' . $format; |
|
43 | + return 'serialize'.$type.'To'.$format; |
|
44 | 44 | |
45 | 45 | default: |
46 | 46 | throw new LogicException(sprintf('The direction %s does not exist; see GraphNavigatorInterface::DIRECTION_??? constants.', json_encode($direction))); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | public function registerSubscribingHandler(SubscribingHandlerInterface $handler): void |
56 | 56 | { |
57 | 57 | foreach ($handler->getSubscribingMethods() as $methodData) { |
58 | - if (!isset($methodData['type'], $methodData['format'])) { |
|
58 | + if ( ! isset($methodData['type'], $methodData['format'])) { |
|
59 | 59 | 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))); |
60 | 60 | } |
61 | 61 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | public function getHandler(int $direction, string $typeName, string $format) |
84 | 84 | { |
85 | - if (!isset($this->handlers[$direction][$typeName][$format])) { |
|
85 | + if ( ! isset($this->handlers[$direction][$typeName][$format])) { |
|
86 | 86 | return null; |
87 | 87 | } |
88 | 88 |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | 'type' => $type, |
56 | 56 | 'format' => $format, |
57 | 57 | 'direction' => GraphNavigatorInterface::DIRECTION_SERIALIZATION, |
58 | - 'method' => 'serialize' . $type, |
|
58 | + 'method' => 'serialize'.$type, |
|
59 | 59 | ]; |
60 | 60 | } |
61 | 61 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | $format = $this->getFormat($type); |
84 | 84 | if ('U' === $format) { |
85 | - return $visitor->visitInteger((int)$date->format($format), $type); |
|
85 | + return $visitor->visitInteger((int) $date->format($format), $type); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | return $visitor->visitString($date->format($this->getFormat($type)), $type); |
@@ -116,7 +116,7 @@ discard block |
||
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) |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | return null; |
144 | 144 | } |
145 | 145 | |
146 | - return $this->parseDateInterval((string)$data); |
|
146 | + return $this->parseDateInterval((string) $data); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | public function deserializeDateTimeFromJson(JsonDeserializationVisitor $visitor, $data, array $type) |
@@ -175,13 +175,13 @@ discard block |
||
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) { |
@@ -240,15 +240,15 @@ discard block |
||
240 | 240 | $format = 'P'; |
241 | 241 | |
242 | 242 | if (0 < $dateInterval->y) { |
243 | - $format .= $dateInterval->y . 'Y'; |
|
243 | + $format .= $dateInterval->y.'Y'; |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | if (0 < $dateInterval->m) { |
247 | - $format .= $dateInterval->m . 'M'; |
|
247 | + $format .= $dateInterval->m.'M'; |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | if (0 < $dateInterval->d) { |
251 | - $format .= $dateInterval->d . 'D'; |
|
251 | + $format .= $dateInterval->d.'D'; |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | if (0 < $dateInterval->h || 0 < $dateInterval->i || 0 < $dateInterval->s) { |
@@ -256,15 +256,15 @@ discard block |
||
256 | 256 | } |
257 | 257 | |
258 | 258 | if (0 < $dateInterval->h) { |
259 | - $format .= $dateInterval->h . 'H'; |
|
259 | + $format .= $dateInterval->h.'H'; |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | if (0 < $dateInterval->i) { |
263 | - $format .= $dateInterval->i . 'M'; |
|
263 | + $format .= $dateInterval->i.'M'; |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | if (0 < $dateInterval->s) { |
267 | - $format .= $dateInterval->s . 'S'; |
|
267 | + $format .= $dateInterval->s.'S'; |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | if ($format === 'P') { |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | |
80 | 80 | public function createRoot(ClassMetadata $metadata = null, $rootName = null, $rootNamespace = null) |
81 | 81 | { |
82 | - if ($metadata !== null && !empty($metadata->xmlRootName)) { |
|
82 | + if ($metadata !== null && ! empty($metadata->xmlRootName)) { |
|
83 | 83 | $rootName = $metadata->xmlRootName; |
84 | 84 | $rootNamespace = $metadata->xmlRootNamespace ?: $this->getClassDefaultNamespace($metadata); |
85 | 85 | } else { |
@@ -112,12 +112,12 @@ discard block |
||
112 | 112 | { |
113 | 113 | $doCData = null !== $this->currentMetadata ? $this->currentMetadata->xmlElementCData : true; |
114 | 114 | |
115 | - return $doCData ? $this->document->createCDATASection($data) : $this->document->createTextNode((string)$data); |
|
115 | + return $doCData ? $this->document->createCDATASection($data) : $this->document->createTextNode((string) $data); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | public function visitSimpleString($data, array $type) |
119 | 119 | { |
120 | - return $this->document->createTextNode((string)$data); |
|
120 | + return $this->document->createTextNode((string) $data); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | public function visitBoolean(bool $data, array $type) |
@@ -127,15 +127,15 @@ discard block |
||
127 | 127 | |
128 | 128 | public function visitInteger(int $data, array $type) |
129 | 129 | { |
130 | - return $this->document->createTextNode((string)$data); |
|
130 | + return $this->document->createTextNode((string) $data); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | public function visitDouble(float $data, array $type) |
134 | 134 | { |
135 | 135 | if (floor($data) === $data) { |
136 | - return $this->document->createTextNode($data . ".0"); |
|
136 | + return $this->document->createTextNode($data.".0"); |
|
137 | 137 | } else { |
138 | - return $this->document->createTextNode((string)$data); |
|
138 | + return $this->document->createTextNode((string) $data); |
|
139 | 139 | } |
140 | 140 | } |
141 | 141 | |
@@ -152,14 +152,14 @@ discard block |
||
152 | 152 | $elType = $this->getElementType($type); |
153 | 153 | foreach ($data as $k => $v) { |
154 | 154 | |
155 | - $tagName = (null !== $this->currentMetadata && $this->currentMetadata->xmlKeyValuePairs && $this->isElementNameValid((string)$k)) ? $k : $entryName; |
|
155 | + $tagName = (null !== $this->currentMetadata && $this->currentMetadata->xmlKeyValuePairs && $this->isElementNameValid((string) $k)) ? $k : $entryName; |
|
156 | 156 | |
157 | 157 | $entryNode = $this->createElement($tagName, $namespace); |
158 | 158 | $this->currentNode->appendChild($entryNode); |
159 | 159 | $this->setCurrentNode($entryNode); |
160 | 160 | |
161 | 161 | if (null !== $keyAttributeName) { |
162 | - $entryNode->setAttribute($keyAttributeName, (string)$k); |
|
162 | + $entryNode->setAttribute($keyAttributeName, (string) $k); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | try { |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | $node = $this->navigator->accept($v, $metadata->type); |
195 | 195 | $this->revertCurrentMetadata(); |
196 | 196 | |
197 | - if (!$node instanceof \DOMCharacterData) { |
|
197 | + if ( ! $node instanceof \DOMCharacterData) { |
|
198 | 198 | throw new RuntimeException(sprintf('Unsupported value for XML attribute for %s. Expected character data, but got %s.', $metadata->name, json_encode($v))); |
199 | 199 | } |
200 | 200 | |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | } |
205 | 205 | |
206 | 206 | if (($metadata->xmlValue && $this->currentNode->childNodes->length > 0) |
207 | - || (!$metadata->xmlValue && $this->hasValue) |
|
207 | + || ( ! $metadata->xmlValue && $this->hasValue) |
|
208 | 208 | ) { |
209 | 209 | throw new RuntimeException(sprintf('If you make use of @XmlValue, all other properties in the class must have the @XmlAttribute annotation. Invalid usage detected in class %s.', $metadata->class)); |
210 | 210 | } |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | $node = $this->navigator->accept($v, $metadata->type); |
217 | 217 | $this->revertCurrentMetadata(); |
218 | 218 | |
219 | - if (!$node instanceof \DOMCharacterData) { |
|
219 | + if ( ! $node instanceof \DOMCharacterData) { |
|
220 | 220 | throw new RuntimeException(sprintf('Unsupported value for property %s::$%s. Expected character data, but got %s.', $metadata->reflection->class, $metadata->reflection->name, \is_object($node) ? \get_class($node) : \gettype($node))); |
221 | 221 | } |
222 | 222 | |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | } |
227 | 227 | |
228 | 228 | if ($metadata->xmlAttributeMap) { |
229 | - if (!\is_array($v)) { |
|
229 | + if ( ! \is_array($v)) { |
|
230 | 230 | throw new RuntimeException(sprintf('Unsupported value type for XML attribute map. Expected array but got %s.', \gettype($v))); |
231 | 231 | } |
232 | 232 | |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | $node = $this->navigator->accept($value, null); |
236 | 236 | $this->revertCurrentMetadata(); |
237 | 237 | |
238 | - if (!$node instanceof \DOMCharacterData) { |
|
238 | + if ( ! $node instanceof \DOMCharacterData) { |
|
239 | 239 | throw new RuntimeException(sprintf('Unsupported value for a XML attribute map value. Expected character data, but got %s.', json_encode($v))); |
240 | 240 | } |
241 | 241 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | return; |
246 | 246 | } |
247 | 247 | |
248 | - if ($addEnclosingElement = !$this->isInLineCollection($metadata) && !$metadata->inline) { |
|
248 | + if ($addEnclosingElement = ! $this->isInLineCollection($metadata) && ! $metadata->inline) { |
|
249 | 249 | |
250 | 250 | $namespace = null !== $metadata->xmlNamespace |
251 | 251 | ? $metadata->xmlNamespace |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | |
291 | 291 | private function isSkippableEmptyObject($node, PropertyMetadata $metadata) |
292 | 292 | { |
293 | - return $node === null && !$metadata->xmlCollection && $metadata->skipWhenEmpty; |
|
293 | + return $node === null && ! $metadata->xmlCollection && $metadata->skipWhenEmpty; |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | private function isSkippableCollection(PropertyMetadata $metadata) |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | |
301 | 301 | private function isElementEmpty(\DOMElement $element) |
302 | 302 | { |
303 | - return !$element->hasChildNodes() && !$element->hasAttributes(); |
|
303 | + return ! $element->hasChildNodes() && ! $element->hasAttributes(); |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | public function endVisitingObject(ClassMetadata $metadata, object $data, array $type) |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | foreach ($metadata->xmlNamespaces as $prefix => $uri) { |
408 | 408 | $attribute = 'xmlns'; |
409 | 409 | if ($prefix !== '') { |
410 | - $attribute .= ':' . $prefix; |
|
410 | + $attribute .= ':'.$prefix; |
|
411 | 411 | } elseif ($element->namespaceURI === $uri) { |
412 | 412 | continue; |
413 | 413 | } |
@@ -423,19 +423,19 @@ discard block |
||
423 | 423 | if ($this->currentNode->isDefaultNamespace($namespace)) { |
424 | 424 | return $this->document->createElementNS($namespace, $tagName); |
425 | 425 | } |
426 | - if (!($prefix = $this->currentNode->lookupPrefix($namespace)) && !($prefix = $this->document->lookupPrefix($namespace))) { |
|
427 | - $prefix = 'ns-' . substr(sha1($namespace), 0, 8); |
|
426 | + if ( ! ($prefix = $this->currentNode->lookupPrefix($namespace)) && ! ($prefix = $this->document->lookupPrefix($namespace))) { |
|
427 | + $prefix = 'ns-'.substr(sha1($namespace), 0, 8); |
|
428 | 428 | } |
429 | - return $this->document->createElementNS($namespace, $prefix . ':' . $tagName); |
|
429 | + return $this->document->createElementNS($namespace, $prefix.':'.$tagName); |
|
430 | 430 | } |
431 | 431 | |
432 | 432 | private function setAttributeOnNode(\DOMElement $node, $name, $value, $namespace = null) |
433 | 433 | { |
434 | 434 | if (null !== $namespace) { |
435 | - if (!$prefix = $node->lookupPrefix($namespace)) { |
|
436 | - $prefix = 'ns-' . substr(sha1($namespace), 0, 8); |
|
435 | + if ( ! $prefix = $node->lookupPrefix($namespace)) { |
|
436 | + $prefix = 'ns-'.substr(sha1($namespace), 0, 8); |
|
437 | 437 | } |
438 | - $node->setAttributeNS($namespace, $prefix . ':' . $name, $value); |
|
438 | + $node->setAttributeNS($namespace, $prefix.':'.$name, $value); |
|
439 | 439 | } else { |
440 | 440 | $node->setAttribute($name, $value); |
441 | 441 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | if (false !== stripos($data, '<!doctype')) { |
62 | 62 | $internalSubset = $this->getDomDocumentTypeEntitySubset($data); |
63 | - if (!in_array($internalSubset, $this->doctypeWhitelist, true)) { |
|
63 | + if ( ! in_array($internalSubset, $this->doctypeWhitelist, true)) { |
|
64 | 64 | throw new InvalidArgumentException(sprintf( |
65 | 65 | 'The document type "%s" is not allowed. If it is safe, you may add it to the whitelist configuration.', |
66 | 66 | $internalSubset |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | private function emptyStringToSpaceCharacter($data) |
84 | 84 | { |
85 | - return $data === '' ? ' ' : (string)$data; |
|
85 | + return $data === '' ? ' ' : (string) $data; |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | public function visitNull($data, array $type): void |
@@ -92,12 +92,12 @@ discard block |
||
92 | 92 | |
93 | 93 | public function visitString($data, array $type): string |
94 | 94 | { |
95 | - return (string)$data; |
|
95 | + return (string) $data; |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | public function visitBoolean($data, array $type): bool |
99 | 99 | { |
100 | - $data = (string)$data; |
|
100 | + $data = (string) $data; |
|
101 | 101 | |
102 | 102 | if ('true' === $data || '1' === $data) { |
103 | 103 | return true; |
@@ -110,12 +110,12 @@ discard block |
||
110 | 110 | |
111 | 111 | public function visitInteger($data, array $type): int |
112 | 112 | { |
113 | - return (integer)$data; |
|
113 | + return (integer) $data; |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | public function visitDouble($data, array $type): float |
117 | 117 | { |
118 | - return (double)$data; |
|
118 | + return (double) $data; |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | public function visitArray($data, array $type): array |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | $nodes = $data->xpath($entryName); |
161 | 161 | } |
162 | 162 | |
163 | - if (!\count($nodes)) { |
|
163 | + if ( ! \count($nodes)) { |
|
164 | 164 | return []; |
165 | 165 | } |
166 | 166 | |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | $nodes = $data->children($namespace)->$entryName; |
189 | 189 | foreach ($nodes as $v) { |
190 | 190 | $attrs = $v->attributes(); |
191 | - if (!isset($attrs[$this->currentMetadata->xmlKeyAttribute])) { |
|
191 | + if ( ! isset($attrs[$this->currentMetadata->xmlKeyAttribute])) { |
|
192 | 192 | throw new RuntimeException(sprintf('The key attribute "%s" must be set for each entry of the map.', $this->currentMetadata->xmlKeyAttribute)); |
193 | 193 | } |
194 | 194 | |
@@ -208,18 +208,18 @@ discard block |
||
208 | 208 | switch (true) { |
209 | 209 | // Check XML attribute without namespace for discriminatorFieldName |
210 | 210 | case $metadata->xmlDiscriminatorAttribute && null === $metadata->xmlDiscriminatorNamespace && isset($data->attributes()->{$metadata->discriminatorFieldName}): |
211 | - return (string)$data->attributes()->{$metadata->discriminatorFieldName}; |
|
211 | + return (string) $data->attributes()->{$metadata->discriminatorFieldName}; |
|
212 | 212 | |
213 | 213 | // Check XML attribute with namespace for discriminatorFieldName |
214 | 214 | case $metadata->xmlDiscriminatorAttribute && null !== $metadata->xmlDiscriminatorNamespace && isset($data->attributes($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}): |
215 | - return (string)$data->attributes($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}; |
|
215 | + return (string) $data->attributes($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}; |
|
216 | 216 | |
217 | 217 | // Check XML element with namespace for discriminatorFieldName |
218 | - case !$metadata->xmlDiscriminatorAttribute && null !== $metadata->xmlDiscriminatorNamespace && isset($data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}): |
|
219 | - return (string)$data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}; |
|
218 | + case ! $metadata->xmlDiscriminatorAttribute && null !== $metadata->xmlDiscriminatorNamespace && isset($data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}): |
|
219 | + return (string) $data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}; |
|
220 | 220 | // Check XML element for discriminatorFieldName |
221 | 221 | case isset($data->{$metadata->discriminatorFieldName}): |
222 | - return (string)$data->{$metadata->discriminatorFieldName}; |
|
222 | + return (string) $data->{$metadata->discriminatorFieldName}; |
|
223 | 223 | |
224 | 224 | default: |
225 | 225 | throw new LogicException(sprintf( |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | { |
241 | 241 | $name = $metadata->serializedName; |
242 | 242 | |
243 | - if (!$metadata->type) { |
|
243 | + if ( ! $metadata->type) { |
|
244 | 244 | throw new RuntimeException(sprintf('You must define a type for %s::$%s.', $metadata->reflection->class, $metadata->name)); |
245 | 245 | } |
246 | 246 | |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | |
261 | 261 | if ($metadata->xmlCollection) { |
262 | 262 | $enclosingElem = $data; |
263 | - if (!$metadata->xmlCollectionInline) { |
|
263 | + if ( ! $metadata->xmlCollectionInline) { |
|
264 | 264 | $enclosingElem = $data->children($metadata->xmlNamespace)->$name; |
265 | 265 | } |
266 | 266 | |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | |
273 | 273 | if ($metadata->xmlNamespace) { |
274 | 274 | $node = $data->children($metadata->xmlNamespace)->$name; |
275 | - if (!$node->count()) { |
|
275 | + if ( ! $node->count()) { |
|
276 | 276 | throw new NotAcceptableException(); |
277 | 277 | } |
278 | 278 | } else { |
@@ -282,9 +282,9 @@ discard block |
||
282 | 282 | if (isset($namespaces[''])) { |
283 | 283 | $prefix = uniqid('ns-'); |
284 | 284 | $data->registerXPathNamespace($prefix, $namespaces['']); |
285 | - $nodes = $data->xpath('./' . $prefix . ':' . $name); |
|
285 | + $nodes = $data->xpath('./'.$prefix.':'.$name); |
|
286 | 286 | } else { |
287 | - $nodes = $data->xpath('./' . $name); |
|
287 | + $nodes = $data->xpath('./'.$name); |
|
288 | 288 | } |
289 | 289 | if (empty($nodes)) { |
290 | 290 | throw new NotAcceptableException(); |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | |
398 | 398 | $xsiAttributes = $value->attributes('http://www.w3.org/2001/XMLSchema-instance'); |
399 | 399 | if (isset($xsiAttributes['nil']) |
400 | - && ((string)$xsiAttributes['nil'] === 'true' || (string)$xsiAttributes['nil'] === '1') |
|
400 | + && ((string) $xsiAttributes['nil'] === 'true' || (string) $xsiAttributes['nil'] === '1') |
|
401 | 401 | ) { |
402 | 402 | return true; |
403 | 403 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | public function startVisiting($object): void |
56 | 56 | { |
57 | - if (!\is_object($object)) { |
|
57 | + if ( ! \is_object($object)) { |
|
58 | 58 | return; |
59 | 59 | } |
60 | 60 | $this->visitingSet->attach($object); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | |
64 | 64 | public function stopVisiting($object): void |
65 | 65 | { |
66 | - if (!\is_object($object)) { |
|
66 | + if ( ! \is_object($object)) { |
|
67 | 67 | return; |
68 | 68 | } |
69 | 69 | $this->visitingSet->detach($object); |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | |
77 | 77 | public function isVisiting($object): bool |
78 | 78 | { |
79 | - if (!\is_object($object)) { |
|
79 | + if ( ! \is_object($object)) { |
|
80 | 80 | return false; |
81 | 81 | } |
82 | 82 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | $path[] = \get_class($obj); |
91 | 91 | } |
92 | 92 | |
93 | - if (!$path) { |
|
93 | + if ( ! $path) { |
|
94 | 94 | return null; |
95 | 95 | } |
96 | 96 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | |
110 | 110 | public function getObject(): ?object |
111 | 111 | { |
112 | - return !$this->visitingStack->isEmpty() ? $this->visitingStack->top() : null; |
|
112 | + return ! $this->visitingStack->isEmpty() ? $this->visitingStack->top() : null; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | public function getVisitingStack() |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | public static function getDefaultMethodName($eventName) |
39 | 39 | { |
40 | - return 'on' . str_replace(['_', '.'], '', $eventName); |
|
40 | + return 'on'.str_replace(['_', '.'], '', $eventName); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | public function addSubscriber(EventSubscriberInterface $subscriber): void |
61 | 61 | { |
62 | 62 | foreach ($subscriber->getSubscribedEvents() as $eventData) { |
63 | - if (!isset($eventData['event'])) { |
|
63 | + if ( ! isset($eventData['event'])) { |
|
64 | 64 | throw new InvalidArgumentException(sprintf('Each event must have a "event" key.')); |
65 | 65 | } |
66 | 66 | |
@@ -75,34 +75,34 @@ discard block |
||
75 | 75 | |
76 | 76 | public function hasListeners(string $eventName, string $class, string $format): bool |
77 | 77 | { |
78 | - if (!isset($this->listeners[$eventName])) { |
|
78 | + if ( ! isset($this->listeners[$eventName])) { |
|
79 | 79 | return false; |
80 | 80 | } |
81 | 81 | |
82 | - if (!isset($this->classListeners[$eventName][$class][$format])) { |
|
82 | + if ( ! isset($this->classListeners[$eventName][$class][$format])) { |
|
83 | 83 | $this->classListeners[$eventName][$class][$format] = $this->initializeListeners($eventName, $class, $format); |
84 | 84 | } |
85 | 85 | |
86 | - return !!$this->classListeners[$eventName][$class][$format]; |
|
86 | + return ! ! $this->classListeners[$eventName][$class][$format]; |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | public function dispatch($eventName, string $class, string $format, Event $event): void |
90 | 90 | { |
91 | - if (!isset($this->listeners[$eventName])) { |
|
91 | + if ( ! isset($this->listeners[$eventName])) { |
|
92 | 92 | return; |
93 | 93 | } |
94 | 94 | |
95 | 95 | $object = $event instanceof ObjectEvent ? $event->getObject() : null; |
96 | 96 | $realClass = is_object($object) ? get_class($object) : ''; |
97 | - $objectClass = $realClass !== $class ? ($realClass . $class) : $class; |
|
97 | + $objectClass = $realClass !== $class ? ($realClass.$class) : $class; |
|
98 | 98 | |
99 | - if (!isset($this->classListeners[$eventName][$objectClass][$format])) { |
|
99 | + if ( ! isset($this->classListeners[$eventName][$objectClass][$format])) { |
|
100 | 100 | $this->classListeners[$eventName][$objectClass][$format] = $this->initializeListeners($eventName, $class, $format); |
101 | 101 | } |
102 | 102 | |
103 | 103 | foreach ($this->classListeners[$eventName][$objectClass][$format] as $listener) { |
104 | 104 | |
105 | - if ($listener[3] !== null && !($object instanceof $listener[3])) { |
|
105 | + if ($listener[3] !== null && ! ($object instanceof $listener[3])) { |
|
106 | 106 | continue; |
107 | 107 | } |
108 | 108 |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | |
133 | 133 | private function getAccessorStrategy(): AccessorStrategyInterface |
134 | 134 | { |
135 | - if (!$this->accessorStrategy) { |
|
135 | + if ( ! $this->accessorStrategy) { |
|
136 | 136 | $this->accessorStrategy = new DefaultAccessorStrategy($this->expressionEvaluator); |
137 | 137 | } |
138 | 138 | return $this->accessorStrategy; |
@@ -168,10 +168,10 @@ discard block |
||
168 | 168 | |
169 | 169 | public function setCacheDir(string $dir): self |
170 | 170 | { |
171 | - if (!is_dir($dir)) { |
|
171 | + if ( ! is_dir($dir)) { |
|
172 | 172 | $this->createDir($dir); |
173 | 173 | } |
174 | - if (!is_writable($dir)) { |
|
174 | + if ( ! is_writable($dir)) { |
|
175 | 175 | throw new InvalidArgumentException(sprintf('The cache directory "%s" is not writable.', $dir)); |
176 | 176 | } |
177 | 177 | |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | public function setMetadataDirs(array $namespacePrefixToDirMap): self |
293 | 293 | { |
294 | 294 | foreach ($namespacePrefixToDirMap as $dir) { |
295 | - if (!is_dir($dir)) { |
|
295 | + if ( ! is_dir($dir)) { |
|
296 | 296 | throw new InvalidArgumentException(sprintf('The directory "%s" does not exist.', $dir)); |
297 | 297 | } |
298 | 298 | } |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | */ |
331 | 331 | public function addMetadataDir(string $dir, string $namespacePrefix = ''): self |
332 | 332 | { |
333 | - if (!is_dir($dir)) { |
|
333 | + if ( ! is_dir($dir)) { |
|
334 | 334 | throw new InvalidArgumentException(sprintf('The directory "%s" does not exist.', $dir)); |
335 | 335 | } |
336 | 336 | |
@@ -372,11 +372,11 @@ discard block |
||
372 | 372 | */ |
373 | 373 | public function replaceMetadataDir(string $dir, $namespacePrefix = ''): self |
374 | 374 | { |
375 | - if (!is_dir($dir)) { |
|
375 | + if ( ! is_dir($dir)) { |
|
376 | 376 | throw new InvalidArgumentException(sprintf('The directory "%s" does not exist.', $dir)); |
377 | 377 | } |
378 | 378 | |
379 | - if (!isset($this->metadataDirs[$namespacePrefix])) { |
|
379 | + if ( ! isset($this->metadataDirs[$namespacePrefix])) { |
|
380 | 380 | throw new InvalidArgumentException(sprintf('There is no directory configured for namespace prefix "%s". Please use addMetadataDir() for adding new directories.', $namespacePrefix)); |
381 | 381 | } |
382 | 382 | |
@@ -439,8 +439,8 @@ discard block |
||
439 | 439 | $annotationReader = new AnnotationReader(); |
440 | 440 | |
441 | 441 | if (null !== $this->cacheDir) { |
442 | - $this->createDir($this->cacheDir . '/annotations'); |
|
443 | - $annotationsCache = new FilesystemCache($this->cacheDir . '/annotations'); |
|
442 | + $this->createDir($this->cacheDir.'/annotations'); |
|
443 | + $annotationsCache = new FilesystemCache($this->cacheDir.'/annotations'); |
|
444 | 444 | $annotationReader = new CachedReader($annotationReader, $annotationsCache, $this->debug); |
445 | 445 | } |
446 | 446 | } |
@@ -456,19 +456,19 @@ discard block |
||
456 | 456 | $metadataFactory->setIncludeInterfaces($this->includeInterfaceMetadata); |
457 | 457 | |
458 | 458 | if (null !== $this->cacheDir) { |
459 | - $this->createDir($this->cacheDir . '/metadata'); |
|
460 | - $metadataFactory->setCache(new FileCache($this->cacheDir . '/metadata')); |
|
459 | + $this->createDir($this->cacheDir.'/metadata'); |
|
460 | + $metadataFactory->setCache(new FileCache($this->cacheDir.'/metadata')); |
|
461 | 461 | } |
462 | 462 | |
463 | - if (!$this->handlersConfigured) { |
|
463 | + if ( ! $this->handlersConfigured) { |
|
464 | 464 | $this->addDefaultHandlers(); |
465 | 465 | } |
466 | 466 | |
467 | - if (!$this->listenersConfigured) { |
|
467 | + if ( ! $this->listenersConfigured) { |
|
468 | 468 | $this->addDefaultListeners(); |
469 | 469 | } |
470 | 470 | |
471 | - if (!$this->visitorsAdded) { |
|
471 | + if ( ! $this->visitorsAdded) { |
|
472 | 472 | $this->addDefaultSerializationVisitors(); |
473 | 473 | $this->addDefaultDeserializationVisitors(); |
474 | 474 | } |