@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | */ |
27 | 27 | public function __construct($container, array $handlers = []) |
28 | 28 | { |
29 | - if (!$container instanceof PsrContainerInterface && !$container instanceof ContainerInterface) { |
|
29 | + if ( ! $container instanceof PsrContainerInterface && ! $container instanceof ContainerInterface) { |
|
30 | 30 | 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))); |
31 | 31 | } |
32 | 32 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | return $this->initializedHandlers[$direction][$typeName][$format]; |
53 | 53 | } |
54 | 54 | |
55 | - if (!isset($this->handlers[$direction][$typeName][$format])) { |
|
55 | + if ( ! isset($this->handlers[$direction][$typeName][$format])) { |
|
56 | 56 | return null; |
57 | 57 | } |
58 | 58 |
@@ -157,22 +157,22 @@ discard block |
||
157 | 157 | $class = $this->getReflection()->getDeclaringClass(); |
158 | 158 | |
159 | 159 | if (empty($getter)) { |
160 | - if ($class->hasMethod('get' . $this->name) && $class->getMethod('get' . $this->name)->isPublic()) { |
|
161 | - $getter = 'get' . $this->name; |
|
162 | - } elseif ($class->hasMethod('is' . $this->name) && $class->getMethod('is' . $this->name)->isPublic()) { |
|
163 | - $getter = 'is' . $this->name; |
|
164 | - } elseif ($class->hasMethod('has' . $this->name) && $class->getMethod('has' . $this->name)->isPublic()) { |
|
165 | - $getter = 'has' . $this->name; |
|
160 | + if ($class->hasMethod('get'.$this->name) && $class->getMethod('get'.$this->name)->isPublic()) { |
|
161 | + $getter = 'get'.$this->name; |
|
162 | + } elseif ($class->hasMethod('is'.$this->name) && $class->getMethod('is'.$this->name)->isPublic()) { |
|
163 | + $getter = 'is'.$this->name; |
|
164 | + } elseif ($class->hasMethod('has'.$this->name) && $class->getMethod('has'.$this->name)->isPublic()) { |
|
165 | + $getter = 'has'.$this->name; |
|
166 | 166 | } else { |
167 | - throw new InvalidMetadataException(sprintf('There is neither a public %s method, nor a public %s method, nor a public %s method in class %s. Please specify which public method should be used for retrieving the value of the property %s.', 'get' . ucfirst($this->name), 'is' . ucfirst($this->name), 'has' . ucfirst($this->name), $this->class, $this->name)); |
|
167 | + throw new InvalidMetadataException(sprintf('There is neither a public %s method, nor a public %s method, nor a public %s method in class %s. Please specify which public method should be used for retrieving the value of the property %s.', 'get'.ucfirst($this->name), 'is'.ucfirst($this->name), 'has'.ucfirst($this->name), $this->class, $this->name)); |
|
168 | 168 | } |
169 | 169 | } |
170 | 170 | |
171 | - if (empty($setter) && !$this->readOnly) { |
|
172 | - if ($class->hasMethod('set' . $this->name) && $class->getMethod('set' . $this->name)->isPublic()) { |
|
173 | - $setter = 'set' . $this->name; |
|
171 | + if (empty($setter) && ! $this->readOnly) { |
|
172 | + if ($class->hasMethod('set'.$this->name) && $class->getMethod('set'.$this->name)->isPublic()) { |
|
173 | + $setter = 'set'.$this->name; |
|
174 | 174 | } else { |
175 | - throw new InvalidMetadataException(sprintf('There is no public %s method in class %s. Please specify which public method should be used for setting the value of the property %s.', 'set' . ucfirst($this->name), $this->class, $this->name)); |
|
175 | + throw new InvalidMetadataException(sprintf('There is no public %s method in class %s. Please specify which public method should be used for setting the value of the property %s.', 'set'.ucfirst($this->name), $this->class, $this->name)); |
|
176 | 176 | } |
177 | 177 | } |
178 | 178 | } |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | return is_array($type) |
192 | 192 | && 'array' === $type['name'] |
193 | 193 | && isset($type['params'][0]) |
194 | - && !isset($type['params'][1]); |
|
194 | + && ! isset($type['params'][1]); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | public static function isCollectionMap(?array $type = null): bool |
@@ -13,7 +13,7 @@ |
||
13 | 13 | public function loadMetadataForClass(\ReflectionClass $class): ?BaseClassMetadata |
14 | 14 | { |
15 | 15 | $classMetadata = new ClassMetadata($name = $class->name); |
16 | - $fileResource = $class->getFilename(); |
|
16 | + $fileResource = $class->getFilename(); |
|
17 | 17 | if (false !== $fileResource) { |
18 | 18 | $classMetadata->fileResources[] = $fileResource; |
19 | 19 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | |
115 | 115 | private function getNavigator(int $direction): GraphNavigatorInterface |
116 | 116 | { |
117 | - if (!isset($this->graphNavigators[$direction])) { |
|
117 | + if ( ! isset($this->graphNavigators[$direction])) { |
|
118 | 118 | throw new RuntimeException( |
119 | 119 | sprintf( |
120 | 120 | 'Can not find a graph navigator for the direction "%s".', |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | ? $this->serializationVisitors |
133 | 133 | : $this->deserializationVisitors; |
134 | 134 | |
135 | - if (!isset($factories[$format])) { |
|
135 | + if ( ! isset($factories[$format])) { |
|
136 | 136 | throw new UnsupportedFormatException( |
137 | 137 | sprintf( |
138 | 138 | 'The format "%s" is not supported for %s.', |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | $result = $this->visit($navigator, $visitor, $context, $data, 'json', $type); |
197 | 197 | $result = $this->convertArrayObjects($result); |
198 | 198 | |
199 | - if (!\is_array($result)) { |
|
199 | + if ( ! \is_array($result)) { |
|
200 | 200 | throw new RuntimeException(sprintf( |
201 | 201 | 'The input data of type "%s" did not convert to an array, but got a result of type "%s".', |
202 | 202 | \is_object($data) ? \get_class($data) : \gettype($data), |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $this->addExclusionStrategy(new VersionExclusionStrategy($this->attributes['version'])); |
80 | 80 | } |
81 | 81 | |
82 | - if (!empty($this->attributes['max_depth_checks'])) { |
|
82 | + if ( ! empty($this->attributes['max_depth_checks'])) { |
|
83 | 83 | $this->addExclusionStrategy(new DepthExclusionStrategy()); |
84 | 84 | } |
85 | 85 | |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | |
133 | 133 | final protected function assertMutable(): void |
134 | 134 | { |
135 | - if (!$this->initialized) { |
|
135 | + if ( ! $this->initialized) { |
|
136 | 136 | return; |
137 | 137 | } |
138 | 138 | |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | { |
209 | 209 | $metadata = $this->metadataStack->pop(); |
210 | 210 | |
211 | - if (!$metadata instanceof PropertyMetadata) { |
|
211 | + if ( ! $metadata instanceof PropertyMetadata) { |
|
212 | 212 | throw new RuntimeException('Context metadataStack not working well'); |
213 | 213 | } |
214 | 214 | } |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | { |
218 | 218 | $metadata = $this->metadataStack->pop(); |
219 | 219 | |
220 | - if (!$metadata instanceof ClassMetadata) { |
|
220 | + if ( ! $metadata instanceof ClassMetadata) { |
|
221 | 221 | throw new RuntimeException('Context metadataStack not working well'); |
222 | 222 | } |
223 | 223 | } |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | */ |
233 | 233 | public function getCurrentPath(): array |
234 | 234 | { |
235 | - if (!$this->metadataStack) { |
|
235 | + if ( ! $this->metadataStack) { |
|
236 | 236 | return []; |
237 | 237 | } |
238 | 238 |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | throw new NonStringCastableTypeException($value); |
57 | 57 | } |
58 | 58 | |
59 | - if (is_object($value) && !method_exists($value, '__toString')) { |
|
59 | + if (is_object($value) && ! method_exists($value, '__toString')) { |
|
60 | 60 | throw new NonStringCastableTypeException($value); |
61 | 61 | } |
62 | 62 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | */ |
70 | 70 | protected function assertValueCanBeCastToInt($value): void |
71 | 71 | { |
72 | - if (is_object($value) && !$value instanceof \SimpleXMLElement) { |
|
72 | + if (is_object($value) && ! $value instanceof \SimpleXMLElement) { |
|
73 | 73 | throw new NonIntCastableTypeException($value); |
74 | 74 | } |
75 | 75 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | */ |
83 | 83 | protected function assertValueCanCastToFloat($value): void |
84 | 84 | { |
85 | - if (is_object($value) && !$value instanceof \SimpleXMLElement) { |
|
85 | + if (is_object($value) && ! $value instanceof \SimpleXMLElement) { |
|
86 | 86 | throw new NonFloatCastableTypeException($value); |
87 | 87 | } |
88 | 88 | } |
@@ -171,11 +171,11 @@ discard block |
||
171 | 171 | $metadata = $this->metadataFactory->getMetadataForClass($type['name']); |
172 | 172 | \assert($metadata instanceof ClassMetadata); |
173 | 173 | |
174 | - if ($metadata->usingExpression && !$this->expressionExclusionStrategy) { |
|
174 | + if ($metadata->usingExpression && ! $this->expressionExclusionStrategy) { |
|
175 | 175 | throw new ExpressionLanguageRequiredException(sprintf('To use conditional exclude/expose in %s you must configure the expression language.', $metadata->name)); |
176 | 176 | } |
177 | 177 | |
178 | - if (!empty($metadata->discriminatorMap) && $type['name'] === $metadata->discriminatorBaseClass) { |
|
178 | + if ( ! empty($metadata->discriminatorMap) && $type['name'] === $metadata->discriminatorBaseClass) { |
|
179 | 179 | $metadata = $this->resolveMetadata($data, $metadata); |
180 | 180 | } |
181 | 181 | |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | { |
235 | 235 | $typeValue = $this->visitor->visitDiscriminatorMapProperty($data, $metadata); |
236 | 236 | |
237 | - if (!isset($metadata->discriminatorMap[$typeValue])) { |
|
237 | + if ( ! isset($metadata->discriminatorMap[$typeValue])) { |
|
238 | 238 | throw new LogicException(sprintf( |
239 | 239 | 'The type value "%s" does not exist in the discriminator map of class "%s". Available types: %s', |
240 | 240 | $typeValue, |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | { |
38 | 38 | $this->lexer->moveNext(); |
39 | 39 | |
40 | - if (!$this->lexer->token) { |
|
40 | + if ( ! $this->lexer->token) { |
|
41 | 41 | throw new SyntaxError( |
42 | 42 | 'Syntax error, unexpected end of stream' |
43 | 43 | ); |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | } |
60 | 60 | |
61 | 61 | return $this->visitSimpleType(); |
62 | - } elseif (!$this->root && Lexer::T_ARRAY_START === $this->lexer->token['type']) { |
|
62 | + } elseif ( ! $this->root && Lexer::T_ARRAY_START === $this->lexer->token['type']) { |
|
63 | 63 | return $this->visitArrayType(); |
64 | 64 | } |
65 | 65 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $this->match(Lexer::T_TYPE_START); |
88 | 88 | |
89 | 89 | $params = []; |
90 | - if (!$this->lexer->isNextToken(Lexer::T_TYPE_END)) { |
|
90 | + if ( ! $this->lexer->isNextToken(Lexer::T_TYPE_END)) { |
|
91 | 91 | while (true) { |
92 | 92 | $params[] = $this->visit(); |
93 | 93 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | */ |
116 | 116 | |
117 | 117 | $params = []; |
118 | - if (!$this->lexer->isNextToken(Lexer::T_ARRAY_END)) { |
|
118 | + if ( ! $this->lexer->isNextToken(Lexer::T_ARRAY_END)) { |
|
119 | 119 | while (true) { |
120 | 120 | $params[] = $this->visit(); |
121 | 121 | if ($this->lexer->isNextToken(Lexer::T_ARRAY_END)) { |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | |
134 | 134 | private function match(int $token): void |
135 | 135 | { |
136 | - if (!$this->lexer->lookahead) { |
|
136 | + if ( ! $this->lexer->lookahead) { |
|
137 | 137 | throw new SyntaxError( |
138 | 138 | sprintf('Syntax error, unexpected end of stream, expected %s', $this->getConstant($token)) |
139 | 139 | ); |
@@ -48,7 +48,7 @@ |
||
48 | 48 | |
49 | 49 | public function __construct(?object $translator = null, string $translationDomain = 'validators') |
50 | 50 | { |
51 | - if (null !== $translator && (!$translator instanceof TranslatorInterface && !$translator instanceof TranslatorContract)) { |
|
51 | + if (null !== $translator && ( ! $translator instanceof TranslatorInterface && ! $translator instanceof TranslatorContract)) { |
|
52 | 52 | throw new \InvalidArgumentException(sprintf( |
53 | 53 | 'The first argument passed to %s must be instance of %s or %s, %s given', |
54 | 54 | self::class, |