@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | 'type' => $type, |
| 48 | 48 | 'format' => $format, |
| 49 | 49 | 'direction' => GraphNavigatorInterface::DIRECTION_SERIALIZATION, |
| 50 | - 'method' => 'serialize' . $type, |
|
| 50 | + 'method' => 'serialize'.$type, |
|
| 51 | 51 | ]; |
| 52 | 52 | } |
| 53 | 53 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | 'type' => 'DateTimeInterface', |
| 56 | 56 | 'direction' => GraphNavigatorInterface::DIRECTION_DESERIALIZATION, |
| 57 | 57 | 'format' => $format, |
| 58 | - 'method' => 'deserializeDateTimeFrom' . ucfirst($format), |
|
| 58 | + 'method' => 'deserializeDateTimeFrom'.ucfirst($format), |
|
| 59 | 59 | ]; |
| 60 | 60 | } |
| 61 | 61 | |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | */ |
| 224 | 224 | private function parseDateTime($data, array $type, bool $immutable = false): \DateTimeInterface |
| 225 | 225 | { |
| 226 | - $timezone = !empty($type['params'][1]) ? new \DateTimeZone($type['params'][1]) : $this->defaultTimezone; |
|
| 226 | + $timezone = ! empty($type['params'][1]) ? new \DateTimeZone($type['params'][1]) : $this->defaultTimezone; |
|
| 227 | 227 | $formats = $this->getDeserializationFormats($type); |
| 228 | 228 | |
| 229 | 229 | $formatTried = []; |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | throw new RuntimeException(sprintf( |
| 249 | 249 | 'Invalid datetime "%s", expected one of the format %s.', |
| 250 | 250 | $data, |
| 251 | - '"' . implode('", "', $formatTried) . '"' |
|
| 251 | + '"'.implode('", "', $formatTried).'"' |
|
| 252 | 252 | )); |
| 253 | 253 | } |
| 254 | 254 | |
@@ -289,15 +289,15 @@ discard block |
||
| 289 | 289 | $format = 'P'; |
| 290 | 290 | |
| 291 | 291 | if (0 < $dateInterval->y) { |
| 292 | - $format .= $dateInterval->y . 'Y'; |
|
| 292 | + $format .= $dateInterval->y.'Y'; |
|
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | if (0 < $dateInterval->m) { |
| 296 | - $format .= $dateInterval->m . 'M'; |
|
| 296 | + $format .= $dateInterval->m.'M'; |
|
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | if (0 < $dateInterval->d) { |
| 300 | - $format .= $dateInterval->d . 'D'; |
|
| 300 | + $format .= $dateInterval->d.'D'; |
|
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | if (0 < $dateInterval->h || 0 < $dateInterval->i || 0 < $dateInterval->s) { |
@@ -305,15 +305,15 @@ discard block |
||
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | if (0 < $dateInterval->h) { |
| 308 | - $format .= $dateInterval->h . 'H'; |
|
| 308 | + $format .= $dateInterval->h.'H'; |
|
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | if (0 < $dateInterval->i) { |
| 312 | - $format .= $dateInterval->i . 'M'; |
|
| 312 | + $format .= $dateInterval->i.'M'; |
|
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | if (0 < $dateInterval->s) { |
| 316 | - $format .= $dateInterval->s . 'S'; |
|
| 316 | + $format .= $dateInterval->s.'S'; |
|
| 317 | 317 | } |
| 318 | 318 | |
| 319 | 319 | if ('P' === $format) { |
@@ -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 | ); |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | foreach ($data as $key => $value) { |
| 40 | - if (!property_exists(self::class, $key)) { |
|
| 40 | + if ( ! property_exists(self::class, $key)) { |
|
| 41 | 41 | throw new InvalidArgumentException(sprintf('Unknown property "%s" on annotation "%s".', $key, self::class)); |
| 42 | 42 | } |
| 43 | 43 | |
@@ -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, |
@@ -165,12 +165,12 @@ discard block |
||
| 165 | 165 | */ |
| 166 | 166 | public function setAccessorOrder(string $order, array $customOrder = []): void |
| 167 | 167 | { |
| 168 | - if (!in_array($order, [self::ACCESSOR_ORDER_UNDEFINED, self::ACCESSOR_ORDER_ALPHABETICAL, self::ACCESSOR_ORDER_CUSTOM], true)) { |
|
| 168 | + if ( ! in_array($order, [self::ACCESSOR_ORDER_UNDEFINED, self::ACCESSOR_ORDER_ALPHABETICAL, self::ACCESSOR_ORDER_CUSTOM], true)) { |
|
| 169 | 169 | throw new InvalidMetadataException(sprintf('The accessor order "%s" is invalid.', $order)); |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | foreach ($customOrder as $name) { |
| 173 | - if (!\is_string($name)) { |
|
| 173 | + if ( ! \is_string($name)) { |
|
| 174 | 174 | throw new InvalidMetadataException(sprintf('$customOrder is expected to be a list of strings, but got element of value %s.', json_encode($name))); |
| 175 | 175 | } |
| 176 | 176 | } |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | |
| 207 | 207 | public function merge(MergeableInterface $object): void |
| 208 | 208 | { |
| 209 | - if (!$object instanceof ClassMetadata) { |
|
| 209 | + if ( ! $object instanceof ClassMetadata) { |
|
| 210 | 210 | throw new InvalidMetadataException('$object must be an instance of ClassMetadata.'); |
| 211 | 211 | } |
| 212 | 212 | |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | $this->discriminatorBaseClass, |
| 236 | 236 | $this->discriminatorBaseClass |
| 237 | 237 | )); |
| 238 | - } elseif (!$this->discriminatorFieldName && $object->discriminatorFieldName) { |
|
| 238 | + } elseif ( ! $this->discriminatorFieldName && $object->discriminatorFieldName) { |
|
| 239 | 239 | $this->discriminatorFieldName = $object->discriminatorFieldName; |
| 240 | 240 | $this->discriminatorMap = $object->discriminatorMap; |
| 241 | 241 | } |
@@ -258,12 +258,12 @@ discard block |
||
| 258 | 258 | |
| 259 | 259 | public function registerNamespace(string $uri, ?string $prefix = null): void |
| 260 | 260 | { |
| 261 | - if (!\is_string($uri)) { |
|
| 261 | + if ( ! \is_string($uri)) { |
|
| 262 | 262 | throw new InvalidMetadataException(sprintf('$uri is expected to be a strings, but got value %s.', json_encode($uri))); |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | if (null !== $prefix) { |
| 266 | - if (!\is_string($prefix)) { |
|
| 266 | + if ( ! \is_string($prefix)) { |
|
| 267 | 267 | throw new InvalidMetadataException(sprintf('$prefix is expected to be a strings, but got value %s.', json_encode($prefix))); |
| 268 | 268 | } |
| 269 | 269 | } else { |
@@ -383,8 +383,8 @@ discard block |
||
| 383 | 383 | { |
| 384 | 384 | if ( |
| 385 | 385 | $this->discriminatorMap |
| 386 | - && !$this->getReflection()->isAbstract() |
|
| 387 | - && !$this->getReflection()->isInterface() |
|
| 386 | + && ! $this->getReflection()->isAbstract() |
|
| 387 | + && ! $this->getReflection()->isInterface() |
|
| 388 | 388 | ) { |
| 389 | 389 | if (false === $typeValue = array_search($this->name, $this->discriminatorMap, true)) { |
| 390 | 390 | throw new InvalidMetadataException(sprintf( |
@@ -398,7 +398,7 @@ discard block |
||
| 398 | 398 | |
| 399 | 399 | if ( |
| 400 | 400 | isset($this->propertyMetadata[$this->discriminatorFieldName]) |
| 401 | - && !$this->propertyMetadata[$this->discriminatorFieldName] instanceof StaticPropertyMetadata |
|
| 401 | + && ! $this->propertyMetadata[$this->discriminatorFieldName] instanceof StaticPropertyMetadata |
|
| 402 | 402 | ) { |
| 403 | 403 | throw new InvalidMetadataException(sprintf( |
| 404 | 404 | 'The discriminator field name "%s" of the base-class "%s" conflicts with a regular property of the sub-class "%s".', |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | public function getAllClassNames(): array |
| 72 | 72 | { |
| 73 | - if (!$this->locator instanceof AdvancedFileLocatorInterface) { |
|
| 73 | + if ( ! $this->locator instanceof AdvancedFileLocatorInterface) { |
|
| 74 | 74 | throw new RuntimeException( |
| 75 | 75 | sprintf( |
| 76 | 76 | 'Locator "%s" must be an instance of "AdvancedFileLocatorInterface".', |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | { |
| 94 | 94 | $config = Yaml::parse(file_get_contents($file)); |
| 95 | 95 | |
| 96 | - if (!isset($config[$name = $class->name])) { |
|
| 96 | + if ( ! isset($config[$name = $class->name])) { |
|
| 97 | 97 | throw new InvalidMetadataException( |
| 98 | 98 | sprintf('Expected metadata for class %s to be defined in %s.', $class->name, $file) |
| 99 | 99 | ); |
@@ -130,9 +130,9 @@ discard block |
||
| 130 | 130 | ); |
| 131 | 131 | unset($propertySettings['exp']); |
| 132 | 132 | } else { |
| 133 | - if (!$class->hasMethod($methodName)) { |
|
| 133 | + if ( ! $class->hasMethod($methodName)) { |
|
| 134 | 134 | throw new InvalidMetadataException( |
| 135 | - 'The method ' . $methodName . ' not found in class ' . $class->name |
|
| 135 | + 'The method '.$methodName.' not found in class '.$class->name |
|
| 136 | 136 | ); |
| 137 | 137 | } |
| 138 | 138 | |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | - if (!$excludeAll) { |
|
| 147 | + if ( ! $excludeAll) { |
|
| 148 | 148 | foreach ($class->getProperties() as $property) { |
| 149 | 149 | if ($property->class !== $name || (isset($property->info) && $property->info['class'] !== $name)) { |
| 150 | 150 | continue; |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | |
| 153 | 153 | $pName = $property->getName(); |
| 154 | 154 | $propertiesMetadata[] = new PropertyMetadata($name, $pName); |
| 155 | - $propertiesData[] = !empty($config['properties']) && true === array_key_exists($pName, $config['properties']) |
|
| 155 | + $propertiesData[] = ! empty($config['properties']) && true === array_key_exists($pName, $config['properties']) |
|
| 156 | 156 | ? (array) $config['properties'][$pName] |
| 157 | 157 | : null; |
| 158 | 158 | } |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | || isset($propertiesData[$propertyKey]); |
| 165 | 165 | |
| 166 | 166 | $pConfig = $propertiesData[$propertyKey]; |
| 167 | - if (!empty($pConfig)) { |
|
| 167 | + if ( ! empty($pConfig)) { |
|
| 168 | 168 | if (isset($pConfig['exclude'])) { |
| 169 | 169 | $isExclude = (bool) $pConfig['exclude']; |
| 170 | 170 | } |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | if (isset($pConfig['expose_if'])) { |
| 197 | - $pMetadata->excludeIf = $this->parseExpression('!(' . $pConfig['expose_if'] . ')'); |
|
| 197 | + $pMetadata->excludeIf = $this->parseExpression('!('.$pConfig['expose_if'].')'); |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | if (isset($pConfig['serialized_name'])) { |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | } |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | - if (!$pMetadata->serializedName) { |
|
| 305 | + if ( ! $pMetadata->serializedName) { |
|
| 306 | 306 | $pMetadata->serializedName = $this->namingStrategy->translateName($pMetadata); |
| 307 | 307 | } |
| 308 | 308 | |
@@ -311,12 +311,12 @@ discard block |
||
| 311 | 311 | $metadata->isMap = $metadata->isMap || PropertyMetadata::isCollectionMap($pMetadata->type); |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | - if (!empty($pConfig) && !empty($pConfig['name'])) { |
|
| 314 | + if ( ! empty($pConfig) && ! empty($pConfig['name'])) { |
|
| 315 | 315 | $pMetadata->name = (string) $pConfig['name']; |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | if ( |
| 319 | - (ExclusionPolicy::NONE === $exclusionPolicy && !$isExclude) |
|
| 319 | + (ExclusionPolicy::NONE === $exclusionPolicy && ! $isExclude) |
|
| 320 | 320 | || (ExclusionPolicy::ALL === $exclusionPolicy && $isExpose) |
| 321 | 321 | ) { |
| 322 | 322 | $metadata->addPropertyMetadata($pMetadata); |
@@ -361,7 +361,7 @@ discard block |
||
| 361 | 361 | |
| 362 | 362 | private function addClassProperties(ClassMetadata $metadata, array $config): void |
| 363 | 363 | { |
| 364 | - if (isset($config['custom_accessor_order']) && !isset($config['accessor_order'])) { |
|
| 364 | + if (isset($config['custom_accessor_order']) && ! isset($config['accessor_order'])) { |
|
| 365 | 365 | $config['accessor_order'] = 'custom'; |
| 366 | 366 | } |
| 367 | 367 | |
@@ -391,11 +391,11 @@ discard block |
||
| 391 | 391 | if (isset($config['discriminator']['disabled']) && true === $config['discriminator']['disabled']) { |
| 392 | 392 | $metadata->discriminatorDisabled = true; |
| 393 | 393 | } else { |
| 394 | - if (!isset($config['discriminator']['field_name'])) { |
|
| 394 | + if ( ! isset($config['discriminator']['field_name'])) { |
|
| 395 | 395 | throw new InvalidMetadataException('The "field_name" attribute must be set for discriminators.'); |
| 396 | 396 | } |
| 397 | 397 | |
| 398 | - if (!isset($config['discriminator']['map']) || !is_array($config['discriminator']['map'])) { |
|
| 398 | + if ( ! isset($config['discriminator']['map']) || ! is_array($config['discriminator']['map'])) { |
|
| 399 | 399 | throw new InvalidMetadataException( |
| 400 | 400 | 'The "map" attribute must be set, and be an array for discriminators.' |
| 401 | 401 | ); |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | { |
| 433 | 433 | if (is_string($config)) { |
| 434 | 434 | $config = [$config]; |
| 435 | - } elseif (!is_array($config)) { |
|
| 435 | + } elseif ( ! is_array($config)) { |
|
| 436 | 436 | throw new InvalidMetadataException( |
| 437 | 437 | sprintf( |
| 438 | 438 | 'callback methods expects a string, or an array of strings that represent method names, but got %s.', |
@@ -443,7 +443,7 @@ discard block |
||
| 443 | 443 | |
| 444 | 444 | $methods = []; |
| 445 | 445 | foreach ($config as $name) { |
| 446 | - if (!$class->hasMethod($name)) { |
|
| 446 | + if ( ! $class->hasMethod($name)) { |
|
| 447 | 447 | throw new InvalidMetadataException( |
| 448 | 448 | sprintf('The method %s does not exist in class %s.', $name, $class->name) |
| 449 | 449 | ); |
@@ -17,8 +17,8 @@ discard block |
||
| 17 | 17 | protected function setDiscriminator(DoctrineClassMetadata $doctrineMetadata, ClassMetadata $classMetadata): void |
| 18 | 18 | { |
| 19 | 19 | if ( |
| 20 | - empty($classMetadata->discriminatorMap) && !$classMetadata->discriminatorDisabled |
|
| 21 | - && !empty($doctrineMetadata->discriminatorMap) && $doctrineMetadata->isRootEntity() |
|
| 20 | + empty($classMetadata->discriminatorMap) && ! $classMetadata->discriminatorDisabled |
|
| 21 | + && ! empty($doctrineMetadata->discriminatorMap) && $doctrineMetadata->isRootEntity() |
|
| 22 | 22 | ) { |
| 23 | 23 | $classMetadata->setDiscriminator( |
| 24 | 24 | $doctrineMetadata->discriminatorColumn['name'], |
@@ -46,11 +46,11 @@ discard block |
||
| 46 | 46 | // For inheritance schemes, we cannot add any type as we would only add the super-type of the hierarchy. |
| 47 | 47 | // On serialization, this would lead to only the supertype being serialized, and properties of subtypes |
| 48 | 48 | // being ignored. |
| 49 | - if ($targetMetadata instanceof DoctrineClassMetadata && !$targetMetadata->isInheritanceTypeNone()) { |
|
| 49 | + if ($targetMetadata instanceof DoctrineClassMetadata && ! $targetMetadata->isInheritanceTypeNone()) { |
|
| 50 | 50 | return; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - if (!$doctrineMetadata->isSingleValuedAssociation($propertyName)) { |
|
| 53 | + if ( ! $doctrineMetadata->isSingleValuedAssociation($propertyName)) { |
|
| 54 | 54 | $targetEntity = sprintf('ArrayCollection<%s>', $targetEntity); |
| 55 | 55 | } |
| 56 | 56 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | && ($fieldType = $this->normalizeFieldType($typeOfFiled)) |
| 30 | 30 | ) { |
| 31 | 31 | $field = $doctrineMetadata->getFieldMapping($propertyName); |
| 32 | - if (!empty($field['multivalue'])) { |
|
| 32 | + if ( ! empty($field['multivalue'])) { |
|
| 33 | 33 | $fieldType = 'array'; |
| 34 | 34 | } |
| 35 | 35 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | return; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - if (!$doctrineMetadata->isSingleValuedAssociation($propertyName)) { |
|
| 48 | + if ( ! $doctrineMetadata->isSingleValuedAssociation($propertyName)) { |
|
| 49 | 49 | $targetEntity = sprintf('ArrayCollection<%s>', $targetEntity); |
| 50 | 50 | } |
| 51 | 51 | |