@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | { |
56 | 56 | $groups = $this->getGroupsFor($navigatorContext); |
57 | 57 | |
58 | - if (!$property->groups) { |
|
59 | - return !in_array(self::DEFAULT_GROUP, $groups); |
|
58 | + if ( ! $property->groups) { |
|
59 | + return ! in_array(self::DEFAULT_GROUP, $groups); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | return $this->shouldSkipUsingGroups($property, $groups); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | |
80 | 80 | $groups = $this->groups; |
81 | 81 | foreach ($paths as $index => $path) { |
82 | - if (!array_key_exists($path, $groups)) { |
|
82 | + if ( ! array_key_exists($path, $groups)) { |
|
83 | 83 | if ($index > 0) { |
84 | 84 | $groups = [self::DEFAULT_GROUP]; |
85 | 85 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | break; |
88 | 88 | } |
89 | 89 | |
90 | - if (!is_array($groups[$path])) { |
|
90 | + if ( ! is_array($groups[$path])) { |
|
91 | 91 | throw new RuntimeException(sprintf('The group value for the property path "%s" should be an array, "%s" given', $index, gettype($groups[$path]))); |
92 | 92 | } |
93 | 93 |
@@ -130,33 +130,33 @@ |
||
130 | 130 | |
131 | 131 | switch ($type['name']) { |
132 | 132 | case 'NULL': |
133 | - if (!$this->shouldSerializeNull) { |
|
133 | + if ( ! $this->shouldSerializeNull) { |
|
134 | 134 | throw new NotAcceptableException(); |
135 | 135 | } |
136 | 136 | return $this->visitor->visitNull($data, $type); |
137 | 137 | |
138 | 138 | case 'string': |
139 | - return $this->visitor->visitString((string)$data, $type); |
|
139 | + return $this->visitor->visitString((string) $data, $type); |
|
140 | 140 | |
141 | 141 | case 'int': |
142 | 142 | case 'integer': |
143 | - return $this->visitor->visitInteger((int)$data, $type); |
|
143 | + return $this->visitor->visitInteger((int) $data, $type); |
|
144 | 144 | |
145 | 145 | case 'bool': |
146 | 146 | case 'boolean': |
147 | - return $this->visitor->visitBoolean((bool)$data, $type); |
|
147 | + return $this->visitor->visitBoolean((bool) $data, $type); |
|
148 | 148 | |
149 | 149 | case 'double': |
150 | 150 | case 'float': |
151 | - return $this->visitor->visitDouble((float)$data, $type); |
|
151 | + return $this->visitor->visitDouble((float) $data, $type); |
|
152 | 152 | |
153 | 153 | case 'array': |
154 | - return $this->visitor->visitArray((array)$data, $type); |
|
154 | + return $this->visitor->visitArray((array) $data, $type); |
|
155 | 155 | |
156 | 156 | case 'resource': |
157 | 157 | $msg = 'Resources are not supported in serialized data.'; |
158 | 158 | if (null !== $path = $this->context->getPath()) { |
159 | - $msg .= ' Path: ' . $path; |
|
159 | + $msg .= ' Path: '.$path; |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | throw new RuntimeException($msg); |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | |
138 | 138 | private function getNavigator(int $direction): GraphNavigatorInterface |
139 | 139 | { |
140 | - if (!isset($this->graphNavigators[$direction])) { |
|
140 | + if ( ! isset($this->graphNavigators[$direction])) { |
|
141 | 141 | throw new RuntimeException( |
142 | 142 | sprintf( |
143 | 143 | 'Can not find a graph navigator for the direction "%s".', |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | ? $this->serializationVisitors |
156 | 156 | : $this->deserializationVisitors; |
157 | 157 | |
158 | - if (!isset($factories[$format])) { |
|
158 | + if ( ! isset($factories[$format])) { |
|
159 | 159 | throw new UnsupportedFormatException( |
160 | 160 | sprintf( |
161 | 161 | 'The format "%s" is not supported for %s.', $format, |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | $result = $this->visit($navigator, $visitor, $context, $data, 'json', $type); |
212 | 212 | $result = $this->convertArrayObjects($result); |
213 | 213 | |
214 | - if (!\is_array($result)) { |
|
214 | + if ( ! \is_array($result)) { |
|
215 | 215 | throw new RuntimeException(sprintf( |
216 | 216 | 'The input data of type "%s" did not convert to an array, but got a result of type "%s".', |
217 | 217 | \is_object($data) ? \get_class($data) : \gettype($data), |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | private function convertArrayObjects($data) |
263 | 263 | { |
264 | 264 | if ($data instanceof \ArrayObject || $data instanceof \stdClass) { |
265 | - $data = (array)$data; |
|
265 | + $data = (array) $data; |
|
266 | 266 | } |
267 | 267 | if (\is_array($data)) { |
268 | 268 | foreach ($data as $k => $v) { |
@@ -40,7 +40,7 @@ |
||
40 | 40 | |
41 | 41 | public function enableExternalEntities(bool $enable = true): self |
42 | 42 | { |
43 | - $this->disableExternalEntities = !$enable; |
|
43 | + $this->disableExternalEntities = ! $enable; |
|
44 | 44 | return $this; |
45 | 45 | } |
46 | 46 |
@@ -67,7 +67,7 @@ |
||
67 | 67 | |
68 | 68 | public function setFormatOutput(bool $formatOutput): self |
69 | 69 | { |
70 | - $this->formatOutput = (boolean)$formatOutput; |
|
70 | + $this->formatOutput = (boolean) $formatOutput; |
|
71 | 71 | return $this; |
72 | 72 | } |
73 | 73 | } |
@@ -42,7 +42,7 @@ |
||
42 | 42 | |
43 | 43 | public function setOptions(int $options): self |
44 | 44 | { |
45 | - $this->options = (integer)$options; |
|
45 | + $this->options = (integer) $options; |
|
46 | 46 | return $this; |
47 | 47 | } |
48 | 48 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $this->addExclusionStrategy(new VersionExclusionStrategy($this->attributes['version'])); |
90 | 90 | } |
91 | 91 | |
92 | - if (!empty($this->attributes['max_depth_checks'])) { |
|
92 | + if ( ! empty($this->attributes['max_depth_checks'])) { |
|
93 | 93 | $this->addExclusionStrategy(new DepthExclusionStrategy()); |
94 | 94 | } |
95 | 95 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | |
137 | 137 | private function assertMutable(): void |
138 | 138 | { |
139 | - if (!$this->initialized) { |
|
139 | + if ( ! $this->initialized) { |
|
140 | 140 | return; |
141 | 141 | } |
142 | 142 | |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | throw new LogicException('The groups must not be empty.'); |
169 | 169 | } |
170 | 170 | |
171 | - $this->attributes['groups'] = (array)$groups; |
|
171 | + $this->attributes['groups'] = (array) $groups; |
|
172 | 172 | |
173 | 173 | return $this; |
174 | 174 | } |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | { |
226 | 226 | $metadata = $this->metadataStack->pop(); |
227 | 227 | |
228 | - if (!$metadata instanceof PropertyMetadata) { |
|
228 | + if ( ! $metadata instanceof PropertyMetadata) { |
|
229 | 229 | throw new RuntimeException('Context metadataStack not working well'); |
230 | 230 | } |
231 | 231 | } |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | { |
235 | 235 | $metadata = $this->metadataStack->pop(); |
236 | 236 | |
237 | - if (!$metadata instanceof ClassMetadata) { |
|
237 | + if ( ! $metadata instanceof ClassMetadata) { |
|
238 | 238 | throw new RuntimeException('Context metadataStack not working well'); |
239 | 239 | } |
240 | 240 | } |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | */ |
250 | 250 | public function getCurrentPath(): array |
251 | 251 | { |
252 | - if (!$this->metadataStack) { |
|
252 | + if ( ! $this->metadataStack) { |
|
253 | 253 | return []; |
254 | 254 | } |
255 | 255 |
@@ -23,7 +23,7 @@ |
||
23 | 23 | public function createDriver(array $metadataDirs, Reader $reader): DriverInterface |
24 | 24 | { |
25 | 25 | $driver = \call_user_func($this->callback, $metadataDirs, $reader); |
26 | - if (!$driver instanceof DriverInterface) { |
|
26 | + if ( ! $driver instanceof DriverInterface) { |
|
27 | 27 | throw new LogicException('The callback must return an instance of DriverInterface.'); |
28 | 28 | } |
29 | 29 |
@@ -31,7 +31,7 @@ |
||
31 | 31 | |
32 | 32 | public function createDriver(array $metadataDirs, Reader $annotationReader): DriverInterface |
33 | 33 | { |
34 | - if (!empty($metadataDirs)) { |
|
34 | + if ( ! empty($metadataDirs)) { |
|
35 | 35 | $fileLocator = new FileLocator($metadataDirs); |
36 | 36 | |
37 | 37 | return new DriverChain([ |