@@ -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; |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | |
69 | 69 | if (false !== stripos($data, '<!doctype')) { |
70 | 70 | $internalSubset = $this->getDomDocumentTypeEntitySubset($data); |
71 | - if (!in_array($internalSubset, $this->doctypeWhitelist, true)) { |
|
71 | + if ( ! in_array($internalSubset, $this->doctypeWhitelist, true)) { |
|
72 | 72 | throw new InvalidArgumentException(sprintf( |
73 | 73 | 'The document type "%s" is not allowed. If it is safe, you may add it to the whitelist configuration.', |
74 | 74 | $internalSubset |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | |
91 | 91 | private function emptyStringToSpaceCharacter($data) |
92 | 92 | { |
93 | - return $data === '' ? ' ' : (string)$data; |
|
93 | + return $data === '' ? ' ' : (string) $data; |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | public function visitNull($data, array $type, Context $context) |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | |
101 | 101 | public function visitString($data, array $type, Context $context) |
102 | 102 | { |
103 | - $data = (string)$data; |
|
103 | + $data = (string) $data; |
|
104 | 104 | |
105 | 105 | if (null === $this->result) { |
106 | 106 | $this->result = $data; |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | |
112 | 112 | public function visitBoolean($data, array $type, Context $context) |
113 | 113 | { |
114 | - $data = (string)$data; |
|
114 | + $data = (string) $data; |
|
115 | 115 | |
116 | 116 | if ('true' === $data || '1' === $data) { |
117 | 117 | $data = true; |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | |
131 | 131 | public function visitInteger($data, array $type, Context $context) |
132 | 132 | { |
133 | - $data = (integer)$data; |
|
133 | + $data = (integer) $data; |
|
134 | 134 | |
135 | 135 | if (null === $this->result) { |
136 | 136 | $this->result = $data; |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | |
142 | 142 | public function visitDouble($data, array $type, Context $context) |
143 | 143 | { |
144 | - $data = (double)$data; |
|
144 | + $data = (double) $data; |
|
145 | 145 | |
146 | 146 | if (null === $this->result) { |
147 | 147 | $this->result = $data; |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | $nodes = $data->xpath($entryName); |
193 | 193 | } |
194 | 194 | |
195 | - if (!\count($nodes)) { |
|
195 | + if ( ! \count($nodes)) { |
|
196 | 196 | if (null === $this->result) { |
197 | 197 | return $this->result = array(); |
198 | 198 | } |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | $nodes = $data->children($namespace)->$entryName; |
232 | 232 | foreach ($nodes as $v) { |
233 | 233 | $attrs = $v->attributes(); |
234 | - if (!isset($attrs[$this->currentMetadata->xmlKeyAttribute])) { |
|
234 | + if ( ! isset($attrs[$this->currentMetadata->xmlKeyAttribute])) { |
|
235 | 235 | throw new RuntimeException(sprintf('The key attribute "%s" must be set for each entry of the map.', $this->currentMetadata->xmlKeyAttribute)); |
236 | 236 | } |
237 | 237 | |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | $name = $this->namingStrategy->translateName($metadata); |
264 | 264 | } |
265 | 265 | |
266 | - if (!$metadata->type) { |
|
266 | + if ( ! $metadata->type) { |
|
267 | 267 | throw new RuntimeException(sprintf('You must define a type for %s::$%s.', $metadata->reflection->class, $metadata->name)); |
268 | 268 | } |
269 | 269 | |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | |
288 | 288 | if ($metadata->xmlCollection) { |
289 | 289 | $enclosingElem = $data; |
290 | - if (!$metadata->xmlCollectionInline) { |
|
290 | + if ( ! $metadata->xmlCollectionInline) { |
|
291 | 291 | $enclosingElem = $data->children($metadata->xmlNamespace)->$name; |
292 | 292 | } |
293 | 293 | |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | |
302 | 302 | if ($metadata->xmlNamespace) { |
303 | 303 | $node = $data->children($metadata->xmlNamespace)->$name; |
304 | - if (!$node->count()) { |
|
304 | + if ( ! $node->count()) { |
|
305 | 305 | return; |
306 | 306 | } |
307 | 307 | } else { |
@@ -311,9 +311,9 @@ discard block |
||
311 | 311 | if (isset($namespaces[''])) { |
312 | 312 | $prefix = uniqid('ns-'); |
313 | 313 | $data->registerXPathNamespace($prefix, $namespaces['']); |
314 | - $nodes = $data->xpath('./' . $prefix . ':' . $name); |
|
314 | + $nodes = $data->xpath('./'.$prefix.':'.$name); |
|
315 | 315 | } else { |
316 | - $nodes = $data->xpath('./' . $name); |
|
316 | + $nodes = $data->xpath('./'.$name); |
|
317 | 317 | } |
318 | 318 | if (empty($nodes)) { |
319 | 319 | return; |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $isHash = isset($type['params'][1]); |
86 | 86 | |
87 | 87 | $count = $this->writer->changeCount; |
88 | - $isList = (isset($type['params'][0]) && !isset($type['params'][1])) |
|
88 | + $isList = (isset($type['params'][0]) && ! isset($type['params'][1])) |
|
89 | 89 | || array_keys($data) === range(0, \count($data) - 1); |
90 | 90 | |
91 | 91 | foreach ($data as $k => $v) { |
@@ -93,10 +93,10 @@ discard block |
||
93 | 93 | continue; |
94 | 94 | } |
95 | 95 | |
96 | - if ($isList && !$isHash) { |
|
96 | + if ($isList && ! $isHash) { |
|
97 | 97 | $this->writer->writeln('-'); |
98 | 98 | } else { |
99 | - $this->writer->writeln(Inline::dump($k) . ':'); |
|
99 | + $this->writer->writeln(Inline::dump($k).':'); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | $this->writer->indent(); |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | if (null !== $v = $this->navigator->accept($v, $this->getElementType($type), $context)) { |
105 | 105 | $this->writer |
106 | 106 | ->rtrim(false) |
107 | - ->writeln(' ' . $v); |
|
107 | + ->writeln(' '.$v); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | $this->writer->outdent(); |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | |
135 | 135 | public function visitDouble($data, array $type, Context $context) |
136 | 136 | { |
137 | - $v = (string)$data; |
|
137 | + $v = (string) $data; |
|
138 | 138 | |
139 | 139 | if ('' === $this->writer->content) { |
140 | 140 | $this->writer->writeln($v); |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | |
146 | 146 | public function visitInteger($data, array $type, Context $context) |
147 | 147 | { |
148 | - $v = (string)$data; |
|
148 | + $v = (string) $data; |
|
149 | 149 | |
150 | 150 | if ('' === $this->writer->content) { |
151 | 151 | $this->writer->writeln($v); |
@@ -172,9 +172,9 @@ discard block |
||
172 | 172 | $name = $this->namingStrategy->translateName($metadata); |
173 | 173 | } |
174 | 174 | |
175 | - if (!$metadata->inline) { |
|
175 | + if ( ! $metadata->inline) { |
|
176 | 176 | $this->writer |
177 | - ->writeln(Inline::dump($name) . ':') |
|
177 | + ->writeln(Inline::dump($name).':') |
|
178 | 178 | ->indent(); |
179 | 179 | } |
180 | 180 | |
@@ -185,12 +185,12 @@ discard block |
||
185 | 185 | if (null !== $v = $this->navigator->accept($v, $metadata->type, $context)) { |
186 | 186 | $this->writer |
187 | 187 | ->rtrim(false) |
188 | - ->writeln(' ' . $v); |
|
189 | - } elseif ($count === $this->writer->changeCount && !$metadata->inline) { |
|
188 | + ->writeln(' '.$v); |
|
189 | + } elseif ($count === $this->writer->changeCount && ! $metadata->inline) { |
|
190 | 190 | $this->writer->revert(); |
191 | 191 | } |
192 | 192 | |
193 | - if (!$metadata->inline) { |
|
193 | + if ( ! $metadata->inline) { |
|
194 | 194 | $this->writer->outdent(); |
195 | 195 | } |
196 | 196 | $this->revertCurrentMetadata(); |
@@ -125,24 +125,24 @@ discard block |
||
125 | 125 | |
126 | 126 | if (null === $this->document) { |
127 | 127 | $this->document = $this->createDocument(null, null, true); |
128 | - $this->currentNode->appendChild($doCData ? $this->document->createCDATASection($data) : $this->document->createTextNode((string)$data)); |
|
128 | + $this->currentNode->appendChild($doCData ? $this->document->createCDATASection($data) : $this->document->createTextNode((string) $data)); |
|
129 | 129 | |
130 | 130 | return; |
131 | 131 | } |
132 | 132 | |
133 | - return $doCData ? $this->document->createCDATASection($data) : $this->document->createTextNode((string)$data); |
|
133 | + return $doCData ? $this->document->createCDATASection($data) : $this->document->createTextNode((string) $data); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | public function visitSimpleString($data, array $type, Context $context) |
137 | 137 | { |
138 | 138 | if (null === $this->document) { |
139 | 139 | $this->document = $this->createDocument(null, null, true); |
140 | - $this->currentNode->appendChild($this->document->createTextNode((string)$data)); |
|
140 | + $this->currentNode->appendChild($this->document->createTextNode((string) $data)); |
|
141 | 141 | |
142 | 142 | return; |
143 | 143 | } |
144 | 144 | |
145 | - return $this->document->createTextNode((string)$data); |
|
145 | + return $this->document->createTextNode((string) $data); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | public function visitBoolean($data, array $type, Context $context) |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | $this->setCurrentNode($entryNode); |
191 | 191 | |
192 | 192 | if (null !== $keyAttributeName) { |
193 | - $entryNode->setAttribute($keyAttributeName, (string)$k); |
|
193 | + $entryNode->setAttribute($keyAttributeName, (string) $k); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | if (null !== $node = $this->navigator->accept($v, $this->getElementType($type), $context)) { |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | $node = $this->navigator->accept($v, $metadata->type, $context); |
243 | 243 | $this->revertCurrentMetadata(); |
244 | 244 | |
245 | - if (!$node instanceof \DOMCharacterData) { |
|
245 | + if ( ! $node instanceof \DOMCharacterData) { |
|
246 | 246 | throw new RuntimeException(sprintf('Unsupported value for XML attribute for %s. Expected character data, but got %s.', $metadata->name, json_encode($v))); |
247 | 247 | } |
248 | 248 | if ($this->namingStrategy instanceof AdvancedNamingStrategyInterface) { |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | } |
257 | 257 | |
258 | 258 | if (($metadata->xmlValue && $this->currentNode->childNodes->length > 0) |
259 | - || (!$metadata->xmlValue && $this->hasValue) |
|
259 | + || ( ! $metadata->xmlValue && $this->hasValue) |
|
260 | 260 | ) { |
261 | 261 | 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)); |
262 | 262 | } |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | $node = $this->navigator->accept($v, $metadata->type, $context); |
269 | 269 | $this->revertCurrentMetadata(); |
270 | 270 | |
271 | - if (!$node instanceof \DOMCharacterData) { |
|
271 | + if ( ! $node instanceof \DOMCharacterData) { |
|
272 | 272 | 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))); |
273 | 273 | } |
274 | 274 | |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | } |
279 | 279 | |
280 | 280 | if ($metadata->xmlAttributeMap) { |
281 | - if (!\is_array($v)) { |
|
281 | + if ( ! \is_array($v)) { |
|
282 | 282 | throw new RuntimeException(sprintf('Unsupported value type for XML attribute map. Expected array but got %s.', \gettype($v))); |
283 | 283 | } |
284 | 284 | |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | $node = $this->navigator->accept($value, null, $context); |
288 | 288 | $this->revertCurrentMetadata(); |
289 | 289 | |
290 | - if (!$node instanceof \DOMCharacterData) { |
|
290 | + if ( ! $node instanceof \DOMCharacterData) { |
|
291 | 291 | throw new RuntimeException(sprintf('Unsupported value for a XML attribute map value. Expected character data, but got %s.', json_encode($v))); |
292 | 292 | } |
293 | 293 | |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | return; |
298 | 298 | } |
299 | 299 | |
300 | - if ($addEnclosingElement = !$this->isInLineCollection($metadata) && !$metadata->inline) { |
|
300 | + if ($addEnclosingElement = ! $this->isInLineCollection($metadata) && ! $metadata->inline) { |
|
301 | 301 | if ($this->namingStrategy instanceof AdvancedNamingStrategyInterface) { |
302 | 302 | $elementName = $this->namingStrategy->getPropertyName($metadata, $context); |
303 | 303 | } else { |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | |
345 | 345 | private function isSkippableEmptyObject($node, PropertyMetadata $metadata) |
346 | 346 | { |
347 | - return $node === null && !$metadata->xmlCollection && $metadata->skipWhenEmpty; |
|
347 | + return $node === null && ! $metadata->xmlCollection && $metadata->skipWhenEmpty; |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | private function isSkippableCollection(PropertyMetadata $metadata) |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | |
355 | 355 | private function isElementEmpty(\DOMElement $element) |
356 | 356 | { |
357 | - return !$element->hasChildNodes() && !$element->hasAttributes(); |
|
357 | + return ! $element->hasChildNodes() && ! $element->hasAttributes(); |
|
358 | 358 | } |
359 | 359 | |
360 | 360 | public function endVisitingObject(ClassMetadata $metadata, $data, array $type, Context $context) |
@@ -433,12 +433,12 @@ discard block |
||
433 | 433 | { |
434 | 434 | if (null === $this->document) { |
435 | 435 | $this->document = $this->createDocument(null, null, true); |
436 | - $this->currentNode->appendChild($textNode = $this->document->createTextNode((string)$data)); |
|
436 | + $this->currentNode->appendChild($textNode = $this->document->createTextNode((string) $data)); |
|
437 | 437 | |
438 | 438 | return $textNode; |
439 | 439 | } |
440 | 440 | |
441 | - return $this->document->createTextNode((string)$data); |
|
441 | + return $this->document->createTextNode((string) $data); |
|
442 | 442 | } |
443 | 443 | |
444 | 444 | /** |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | |
456 | 456 | private function attachNullNamespace() |
457 | 457 | { |
458 | - if (!$this->nullWasVisited) { |
|
458 | + if ( ! $this->nullWasVisited) { |
|
459 | 459 | $this->document->documentElement->setAttributeNS( |
460 | 460 | 'http://www.w3.org/2000/xmlns/', |
461 | 461 | 'xmlns:xsi', |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | foreach ($metadata->xmlNamespaces as $prefix => $uri) { |
477 | 477 | $attribute = 'xmlns'; |
478 | 478 | if ($prefix !== '') { |
479 | - $attribute .= ':' . $prefix; |
|
479 | + $attribute .= ':'.$prefix; |
|
480 | 480 | } elseif ($element->namespaceURI === $uri) { |
481 | 481 | continue; |
482 | 482 | } |
@@ -492,19 +492,19 @@ discard block |
||
492 | 492 | if ($this->currentNode->isDefaultNamespace($namespace)) { |
493 | 493 | return $this->document->createElementNS($namespace, $tagName); |
494 | 494 | } |
495 | - if (!($prefix = $this->currentNode->lookupPrefix($namespace)) && !($prefix = $this->document->lookupPrefix($namespace))) { |
|
496 | - $prefix = 'ns-' . substr(sha1($namespace), 0, 8); |
|
495 | + if ( ! ($prefix = $this->currentNode->lookupPrefix($namespace)) && ! ($prefix = $this->document->lookupPrefix($namespace))) { |
|
496 | + $prefix = 'ns-'.substr(sha1($namespace), 0, 8); |
|
497 | 497 | } |
498 | - return $this->document->createElementNS($namespace, $prefix . ':' . $tagName); |
|
498 | + return $this->document->createElementNS($namespace, $prefix.':'.$tagName); |
|
499 | 499 | } |
500 | 500 | |
501 | 501 | private function setAttributeOnNode(\DOMElement $node, $name, $value, $namespace = null) |
502 | 502 | { |
503 | 503 | if (null !== $namespace) { |
504 | - if (!$prefix = $node->lookupPrefix($namespace)) { |
|
505 | - $prefix = 'ns-' . substr(sha1($namespace), 0, 8); |
|
504 | + if ( ! $prefix = $node->lookupPrefix($namespace)) { |
|
505 | + $prefix = 'ns-'.substr(sha1($namespace), 0, 8); |
|
506 | 506 | } |
507 | - $node->setAttributeNS($namespace, $prefix . ':' . $name, $value); |
|
507 | + $node->setAttributeNS($namespace, $prefix.':'.$name, $value); |
|
508 | 508 | } else { |
509 | 509 | $node->setAttribute($name, $value); |
510 | 510 | } |
@@ -528,6 +528,6 @@ discard block |
||
528 | 528 | */ |
529 | 529 | public function setFormatOutput($formatOutput) |
530 | 530 | { |
531 | - $this->formatOutput = (boolean)$formatOutput; |
|
531 | + $this->formatOutput = (boolean) $formatOutput; |
|
532 | 532 | } |
533 | 533 | } |
@@ -28,7 +28,7 @@ |
||
28 | 28 | ) |
29 | 29 | { |
30 | 30 | $driver = \call_user_func($this->callback, $metadataDirs, $reader, $propertyUpdater); |
31 | - if (!$driver instanceof DriverInterface) { |
|
31 | + if ( ! $driver instanceof DriverInterface) { |
|
32 | 32 | throw new \LogicException('The callback must return an instance of DriverInterface.'); |
33 | 33 | } |
34 | 34 |