@@ -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 | |
@@ -159,12 +159,12 @@ discard block |
||
| 159 | 159 | */ |
| 160 | 160 | public function setAccessorOrder(string $order, array $customOrder = []): void |
| 161 | 161 | { |
| 162 | - if (!in_array($order, [self::ACCESSOR_ORDER_UNDEFINED, self::ACCESSOR_ORDER_ALPHABETICAL, self::ACCESSOR_ORDER_CUSTOM], true)) { |
|
| 162 | + if ( ! in_array($order, [self::ACCESSOR_ORDER_UNDEFINED, self::ACCESSOR_ORDER_ALPHABETICAL, self::ACCESSOR_ORDER_CUSTOM], true)) { |
|
| 163 | 163 | throw new InvalidMetadataException(sprintf('The accessor order "%s" is invalid.', $order)); |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | foreach ($customOrder as $name) { |
| 167 | - if (!\is_string($name)) { |
|
| 167 | + if ( ! \is_string($name)) { |
|
| 168 | 168 | throw new InvalidMetadataException(sprintf('$customOrder is expected to be a list of strings, but got element of value %s.', json_encode($name))); |
| 169 | 169 | } |
| 170 | 170 | } |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | |
| 201 | 201 | public function merge(MergeableInterface $object): void |
| 202 | 202 | { |
| 203 | - if (!$object instanceof ClassMetadata) { |
|
| 203 | + if ( ! $object instanceof ClassMetadata) { |
|
| 204 | 204 | throw new InvalidMetadataException('$object must be an instance of ClassMetadata.'); |
| 205 | 205 | } |
| 206 | 206 | parent::merge($object); |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | $this->discriminatorBaseClass, |
| 225 | 225 | $this->discriminatorBaseClass |
| 226 | 226 | )); |
| 227 | - } elseif (!$this->discriminatorFieldName && $object->discriminatorFieldName) { |
|
| 227 | + } elseif ( ! $this->discriminatorFieldName && $object->discriminatorFieldName) { |
|
| 228 | 228 | $this->discriminatorFieldName = $object->discriminatorFieldName; |
| 229 | 229 | $this->discriminatorMap = $object->discriminatorMap; |
| 230 | 230 | } |
@@ -246,12 +246,12 @@ discard block |
||
| 246 | 246 | |
| 247 | 247 | public function registerNamespace(string $uri, ?string $prefix = null): void |
| 248 | 248 | { |
| 249 | - if (!\is_string($uri)) { |
|
| 249 | + if ( ! \is_string($uri)) { |
|
| 250 | 250 | throw new InvalidMetadataException(sprintf('$uri is expected to be a strings, but got value %s.', json_encode($uri))); |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | if (null !== $prefix) { |
| 254 | - if (!\is_string($prefix)) { |
|
| 254 | + if ( ! \is_string($prefix)) { |
|
| 255 | 255 | throw new InvalidMetadataException(sprintf('$prefix is expected to be a strings, but got value %s.', json_encode($prefix))); |
| 256 | 256 | } |
| 257 | 257 | } else { |
@@ -367,8 +367,8 @@ discard block |
||
| 367 | 367 | private function handleDiscriminatorProperty(): void |
| 368 | 368 | { |
| 369 | 369 | if ($this->discriminatorMap |
| 370 | - && !$this->getReflection()->isAbstract() |
|
| 371 | - && !$this->getReflection()->isInterface() |
|
| 370 | + && ! $this->getReflection()->isAbstract() |
|
| 371 | + && ! $this->getReflection()->isInterface() |
|
| 372 | 372 | ) { |
| 373 | 373 | if (false === $typeValue = array_search($this->name, $this->discriminatorMap, true)) { |
| 374 | 374 | throw new InvalidMetadataException(sprintf( |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | $this->discriminatorValue = $typeValue; |
| 382 | 382 | |
| 383 | 383 | if (isset($this->propertyMetadata[$this->discriminatorFieldName]) |
| 384 | - && !$this->propertyMetadata[$this->discriminatorFieldName] instanceof StaticPropertyMetadata |
|
| 384 | + && ! $this->propertyMetadata[$this->discriminatorFieldName] instanceof StaticPropertyMetadata |
|
| 385 | 385 | ) { |
| 386 | 386 | throw new InvalidMetadataException(sprintf( |
| 387 | 387 | 'The discriminator field name "%s" of the base-class "%s" conflicts with a regular property of the sub-class "%s".', |
@@ -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 |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | public function loadMetadataForClass(\ReflectionClass $class): ?BaseClassMetadata |
| 78 | 78 | { |
| 79 | 79 | $classMetadata = new ClassMetadata($name = $class->name); |
| 80 | - $fileResource = $class->getFilename(); |
|
| 80 | + $fileResource = $class->getFilename(); |
|
| 81 | 81 | if (false !== $fileResource) { |
| 82 | 82 | $classMetadata->fileResources[] = $fileResource; |
| 83 | 83 | } |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | } |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - if (!$excludeAll) { |
|
| 156 | + if ( ! $excludeAll) { |
|
| 157 | 157 | foreach ($class->getProperties() as $property) { |
| 158 | 158 | if ($property->class !== $name || (isset($property->info) && $property->info['class'] !== $name)) { |
| 159 | 159 | continue; |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | } elseif ($annot instanceof Expose) { |
| 185 | 185 | $isExpose = true; |
| 186 | 186 | if (null !== $annot->if) { |
| 187 | - $propertyMetadata->excludeIf = $this->parseExpression('!(' . $annot->if . ')'); |
|
| 187 | + $propertyMetadata->excludeIf = $this->parseExpression('!('.$annot->if.')'); |
|
| 188 | 188 | } |
| 189 | 189 | } elseif ($annot instanceof Exclude) { |
| 190 | 190 | if (null !== $annot->if) { |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | throw new InvalidMetadataException(sprintf( |
| 234 | 234 | 'Invalid group name "%s" on "%s", did you mean to create multiple groups?', |
| 235 | 235 | implode(', ', $propertyMetadata->groups), |
| 236 | - $propertyMetadata->class . '->' . $propertyMetadata->name |
|
| 236 | + $propertyMetadata->class.'->'.$propertyMetadata->name |
|
| 237 | 237 | )); |
| 238 | 238 | } |
| 239 | 239 | } |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | } |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | - if (!$propertyMetadata->serializedName) { |
|
| 258 | + if ( ! $propertyMetadata->serializedName) { |
|
| 259 | 259 | $propertyMetadata->serializedName = $this->namingStrategy->translateName($propertyMetadata); |
| 260 | 260 | } |
| 261 | 261 | |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | } |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | - if ((ExclusionPolicy::NONE === $exclusionPolicy && !$isExclude) |
|
| 268 | + if ((ExclusionPolicy::NONE === $exclusionPolicy && ! $isExclude) |
|
| 269 | 269 | || (ExclusionPolicy::ALL === $exclusionPolicy && $isExpose) |
| 270 | 270 | ) { |
| 271 | 271 | $propertyMetadata->setAccessor($accessType, $accessor[0], $accessor[1]); |
@@ -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 | } |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | $classMetadata = $this->delegate->loadMetadataForClass($class); |
| 84 | 84 | |
| 85 | 85 | // Abort if the given class is not a mapped entity |
| 86 | - if (!$doctrineMetadata = $this->tryLoadingDoctrineMetadata($class->name)) { |
|
| 86 | + if ( ! $doctrineMetadata = $this->tryLoadingDoctrineMetadata($class->name)) { |
|
| 87 | 87 | return $classMetadata; |
| 88 | 88 | } |
| 89 | 89 | |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | |
| 132 | 132 | protected function tryLoadingDoctrineMetadata(string $className): ?DoctrineClassMetadata |
| 133 | 133 | { |
| 134 | - if (!$manager = $this->registry->getManagerForClass($className)) { |
|
| 134 | + if ( ! $manager = $this->registry->getManagerForClass($className)) { |
|
| 135 | 135 | return null; |
| 136 | 136 | } |
| 137 | 137 | |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | |
| 145 | 145 | protected function normalizeFieldType(string $type): ?string |
| 146 | 146 | { |
| 147 | - if (!isset($this->fieldMapping[$type])) { |
|
| 147 | + if ( ! isset($this->fieldMapping[$type])) { |
|
| 148 | 148 | return null; |
| 149 | 149 | } |
| 150 | 150 | |
@@ -16,8 +16,8 @@ discard block |
||
| 16 | 16 | { |
| 17 | 17 | protected function setDiscriminator(DoctrineClassMetadata $doctrineMetadata, ClassMetadata $classMetadata): void |
| 18 | 18 | { |
| 19 | - if (empty($classMetadata->discriminatorMap) && !$classMetadata->discriminatorDisabled |
|
| 20 | - && !empty($doctrineMetadata->discriminatorMap) && $doctrineMetadata->isRootEntity() |
|
| 19 | + if (empty($classMetadata->discriminatorMap) && ! $classMetadata->discriminatorDisabled |
|
| 20 | + && ! empty($doctrineMetadata->discriminatorMap) && $doctrineMetadata->isRootEntity() |
|
| 21 | 21 | ) { |
| 22 | 22 | $classMetadata->setDiscriminator( |
| 23 | 23 | $doctrineMetadata->discriminatorColumn['name'], |
@@ -43,11 +43,11 @@ discard block |
||
| 43 | 43 | // For inheritance schemes, we cannot add any type as we would only add the super-type of the hierarchy. |
| 44 | 44 | // On serialization, this would lead to only the supertype being serialized, and properties of subtypes |
| 45 | 45 | // being ignored. |
| 46 | - if ($targetMetadata instanceof DoctrineClassMetadata && !$targetMetadata->isInheritanceTypeNone()) { |
|
| 46 | + if ($targetMetadata instanceof DoctrineClassMetadata && ! $targetMetadata->isInheritanceTypeNone()) { |
|
| 47 | 47 | return; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - if (!$doctrineMetadata->isSingleValuedAssociation($propertyName)) { |
|
| 50 | + if ( ! $doctrineMetadata->isSingleValuedAssociation($propertyName)) { |
|
| 51 | 51 | $targetEntity = sprintf('ArrayCollection<%s>', $targetEntity); |
| 52 | 52 | } |
| 53 | 53 | |
@@ -54,13 +54,13 @@ discard block |
||
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | $metadata = new ClassMetadata($name = $class->name); |
| 57 | - if (!$elems = $elem->xpath("./class[@name = '" . $name . "']")) { |
|
| 57 | + if ( ! $elems = $elem->xpath("./class[@name = '".$name."']")) { |
|
| 58 | 58 | throw new InvalidMetadataException(sprintf('Could not find class %s inside XML element.', $name)); |
| 59 | 59 | } |
| 60 | 60 | $elem = reset($elems); |
| 61 | 61 | |
| 62 | 62 | $metadata->fileResources[] = $path; |
| 63 | - $fileResource = $class->getFilename(); |
|
| 63 | + $fileResource = $class->getFilename(); |
|
| 64 | 64 | if (false !== $fileResource) { |
| 65 | 65 | $metadata->fileResources[] = $fileResource; |
| 66 | 66 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | $discriminatorFieldName = (string) $elem->attributes()->{'discriminator-field-name'}; |
| 93 | 93 | $discriminatorMap = []; |
| 94 | 94 | foreach ($elem->xpath('./discriminator-class') as $entry) { |
| 95 | - if (!isset($entry->attributes()->value)) { |
|
| 95 | + if ( ! isset($entry->attributes()->value)) { |
|
| 96 | 96 | throw new InvalidMetadataException('Each discriminator-class element must have a "value" attribute.'); |
| 97 | 97 | } |
| 98 | 98 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | if ('true' === (string) $elem->attributes()->{'discriminator-disabled'}) { |
| 103 | 103 | $metadata->discriminatorDisabled = true; |
| 104 | - } elseif (!empty($discriminatorFieldName) || !empty($discriminatorMap)) { |
|
| 104 | + } elseif ( ! empty($discriminatorFieldName) || ! empty($discriminatorMap)) { |
|
| 105 | 105 | $discriminatorGroups = []; |
| 106 | 106 | foreach ($elem->xpath('./discriminator-groups/group') as $entry) { |
| 107 | 107 | $discriminatorGroups[] = (string) $entry; |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | foreach ($elem->xpath('./xml-namespace') as $xmlNamespace) { |
| 113 | - if (!isset($xmlNamespace->attributes()->uri)) { |
|
| 113 | + if ( ! isset($xmlNamespace->attributes()->uri)) { |
|
| 114 | 114 | throw new InvalidMetadataException('The prefix attribute must be set for all xml-namespace elements.'); |
| 115 | 115 | } |
| 116 | 116 | |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | $this->parseExpression((string) $method->attributes()->expression) |
| 144 | 144 | ); |
| 145 | 145 | } else { |
| 146 | - if (!isset($method->attributes()->method)) { |
|
| 146 | + if ( ! isset($method->attributes()->method)) { |
|
| 147 | 147 | throw new InvalidMetadataException('The method attribute must be set for all virtual-property elements.'); |
| 148 | 148 | } |
| 149 | 149 | $virtualPropertyMetadata = new VirtualPropertyMetadata($name, (string) $method->attributes()->method); |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | $propertiesNodes[] = $method; |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - if (!$excludeAll) { |
|
| 156 | + if ( ! $excludeAll) { |
|
| 157 | 157 | foreach ($class->getProperties() as $property) { |
| 158 | 158 | if ($property->class !== $name || (isset($property->info) && $property->info['class'] !== $name)) { |
| 159 | 159 | continue; |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | $pName = $property->getName(); |
| 162 | 162 | $propertiesMetadata[] = new PropertyMetadata($name, $pName); |
| 163 | 163 | |
| 164 | - $pElems = $elem->xpath("./property[@name = '" . $pName . "']"); |
|
| 164 | + $pElems = $elem->xpath("./property[@name = '".$pName."']"); |
|
| 165 | 165 | $propertiesNodes[] = $pElems ? reset($pElems) : null; |
| 166 | 166 | } |
| 167 | 167 | |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | || isset($propertiesNodes[$propertyKey]); |
| 173 | 173 | |
| 174 | 174 | $pElem = $propertiesNodes[$propertyKey]; |
| 175 | - if (!empty($pElem)) { |
|
| 175 | + if ( ! empty($pElem)) { |
|
| 176 | 176 | if (null !== $exclude = $pElem->attributes()->exclude) { |
| 177 | 177 | $isExclude = 'true' === strtolower((string) $exclude); |
| 178 | 178 | } |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | if (null !== $excludeIf = $pElem->attributes()->{'expose-if'}) { |
| 197 | - $pMetadata->excludeIf = $this->parseExpression('!(' . (string) $excludeIf . ')'); |
|
| 197 | + $pMetadata->excludeIf = $this->parseExpression('!('.(string) $excludeIf.')'); |
|
| 198 | 198 | $isExpose = true; |
| 199 | 199 | } |
| 200 | 200 | |
@@ -322,15 +322,15 @@ discard block |
||
| 322 | 322 | $metadata->isMap = $metadata->isMap || PropertyMetadata::isCollectionMap($pMetadata->type); |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | - if (!$pMetadata->serializedName) { |
|
| 325 | + if ( ! $pMetadata->serializedName) { |
|
| 326 | 326 | $pMetadata->serializedName = $this->namingStrategy->translateName($pMetadata); |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | - if (!empty($pElem) && null !== $name = $pElem->attributes()->name) { |
|
| 329 | + if ( ! empty($pElem) && null !== $name = $pElem->attributes()->name) { |
|
| 330 | 330 | $pMetadata->name = (string) $name; |
| 331 | 331 | } |
| 332 | 332 | |
| 333 | - if ((ExclusionPolicy::NONE === (string) $exclusionPolicy && !$isExclude) |
|
| 333 | + if ((ExclusionPolicy::NONE === (string) $exclusionPolicy && ! $isExclude) |
|
| 334 | 334 | || (ExclusionPolicy::ALL === (string) $exclusionPolicy && $isExpose) |
| 335 | 335 | ) { |
| 336 | 336 | $metadata->addPropertyMetadata($pMetadata); |
@@ -339,10 +339,10 @@ discard block |
||
| 339 | 339 | } |
| 340 | 340 | |
| 341 | 341 | foreach ($elem->xpath('./callback-method') as $method) { |
| 342 | - if (!isset($method->attributes()->type)) { |
|
| 342 | + if ( ! isset($method->attributes()->type)) { |
|
| 343 | 343 | throw new InvalidMetadataException('The type attribute must be set for all callback-method elements.'); |
| 344 | 344 | } |
| 345 | - if (!isset($method->attributes()->name)) { |
|
| 345 | + if ( ! isset($method->attributes()->name)) { |
|
| 346 | 346 | throw new InvalidMetadataException('The name attribute must be set for all callback-method elements.'); |
| 347 | 347 | } |
| 348 | 348 | |
@@ -360,10 +360,10 @@ discard block |
||
| 360 | 360 | break; |
| 361 | 361 | |
| 362 | 362 | case 'handler': |
| 363 | - if (!isset($method->attributes()->format)) { |
|
| 363 | + if ( ! isset($method->attributes()->format)) { |
|
| 364 | 364 | throw new InvalidMetadataException('The format attribute must be set for "handler" callback methods.'); |
| 365 | 365 | } |
| 366 | - if (!isset($method->attributes()->direction)) { |
|
| 366 | + if ( ! isset($method->attributes()->direction)) { |
|
| 367 | 367 | throw new InvalidMetadataException('The direction attribute must be set for "handler" callback methods.'); |
| 368 | 368 | } |
| 369 | 369 | |
@@ -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 | ); |
@@ -125,9 +125,9 @@ discard block |
||
| 125 | 125 | ); |
| 126 | 126 | unset($propertySettings['exp']); |
| 127 | 127 | } else { |
| 128 | - if (!$class->hasMethod($methodName)) { |
|
| 128 | + if ( ! $class->hasMethod($methodName)) { |
|
| 129 | 129 | throw new InvalidMetadataException( |
| 130 | - 'The method ' . $methodName . ' not found in class ' . $class->name |
|
| 130 | + 'The method '.$methodName.' not found in class '.$class->name |
|
| 131 | 131 | ); |
| 132 | 132 | } |
| 133 | 133 | $virtualPropertyMetadata = new VirtualPropertyMetadata($name, $methodName); |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - if (!$excludeAll) { |
|
| 141 | + if ( ! $excludeAll) { |
|
| 142 | 142 | foreach ($class->getProperties() as $property) { |
| 143 | 143 | if ($property->class !== $name || (isset($property->info) && $property->info['class'] !== $name)) { |
| 144 | 144 | continue; |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | |
| 147 | 147 | $pName = $property->getName(); |
| 148 | 148 | $propertiesMetadata[] = new PropertyMetadata($name, $pName); |
| 149 | - $propertiesData[] = !empty($config['properties']) && true === array_key_exists($pName, $config['properties']) |
|
| 149 | + $propertiesData[] = ! empty($config['properties']) && true === array_key_exists($pName, $config['properties']) |
|
| 150 | 150 | ? (array) $config['properties'][$pName] |
| 151 | 151 | : null; |
| 152 | 152 | } |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | || isset($propertiesData[$propertyKey]); |
| 159 | 159 | |
| 160 | 160 | $pConfig = $propertiesData[$propertyKey]; |
| 161 | - if (!empty($pConfig)) { |
|
| 161 | + if ( ! empty($pConfig)) { |
|
| 162 | 162 | if (isset($pConfig['exclude'])) { |
| 163 | 163 | $isExclude = (bool) $pConfig['exclude']; |
| 164 | 164 | } |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | if (isset($pConfig['expose_if'])) { |
| 191 | - $pMetadata->excludeIf = $this->parseExpression('!(' . $pConfig['expose_if'] . ')'); |
|
| 191 | + $pMetadata->excludeIf = $this->parseExpression('!('.$pConfig['expose_if'].')'); |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | if (isset($pConfig['serialized_name'])) { |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | } |
| 297 | 297 | } |
| 298 | 298 | |
| 299 | - if (!$pMetadata->serializedName) { |
|
| 299 | + if ( ! $pMetadata->serializedName) { |
|
| 300 | 300 | $pMetadata->serializedName = $this->namingStrategy->translateName($pMetadata); |
| 301 | 301 | } |
| 302 | 302 | |
@@ -305,11 +305,11 @@ discard block |
||
| 305 | 305 | $metadata->isMap = $metadata->isMap || PropertyMetadata::isCollectionMap($pMetadata->type); |
| 306 | 306 | } |
| 307 | 307 | |
| 308 | - if (!empty($pConfig) && !empty($pConfig['name'])) { |
|
| 308 | + if ( ! empty($pConfig) && ! empty($pConfig['name'])) { |
|
| 309 | 309 | $pMetadata->name = (string) $pConfig['name']; |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | - if ((ExclusionPolicy::NONE === $exclusionPolicy && !$isExclude) |
|
| 312 | + if ((ExclusionPolicy::NONE === $exclusionPolicy && ! $isExclude) |
|
| 313 | 313 | || (ExclusionPolicy::ALL === $exclusionPolicy && $isExpose) |
| 314 | 314 | ) { |
| 315 | 315 | $metadata->addPropertyMetadata($pMetadata); |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | |
| 353 | 353 | private function addClassProperties(ClassMetadata $metadata, array $config): void |
| 354 | 354 | { |
| 355 | - if (isset($config['custom_accessor_order']) && !isset($config['accessor_order'])) { |
|
| 355 | + if (isset($config['custom_accessor_order']) && ! isset($config['accessor_order'])) { |
|
| 356 | 356 | $config['accessor_order'] = 'custom'; |
| 357 | 357 | } |
| 358 | 358 | |
@@ -382,11 +382,11 @@ discard block |
||
| 382 | 382 | if (isset($config['discriminator']['disabled']) && true === $config['discriminator']['disabled']) { |
| 383 | 383 | $metadata->discriminatorDisabled = true; |
| 384 | 384 | } else { |
| 385 | - if (!isset($config['discriminator']['field_name'])) { |
|
| 385 | + if ( ! isset($config['discriminator']['field_name'])) { |
|
| 386 | 386 | throw new InvalidMetadataException('The "field_name" attribute must be set for discriminators.'); |
| 387 | 387 | } |
| 388 | 388 | |
| 389 | - if (!isset($config['discriminator']['map']) || !is_array($config['discriminator']['map'])) { |
|
| 389 | + if ( ! isset($config['discriminator']['map']) || ! is_array($config['discriminator']['map'])) { |
|
| 390 | 390 | throw new InvalidMetadataException( |
| 391 | 391 | 'The "map" attribute must be set, and be an array for discriminators.' |
| 392 | 392 | ); |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | { |
| 421 | 421 | if (is_string($config)) { |
| 422 | 422 | $config = [$config]; |
| 423 | - } elseif (!is_array($config)) { |
|
| 423 | + } elseif ( ! is_array($config)) { |
|
| 424 | 424 | throw new InvalidMetadataException( |
| 425 | 425 | sprintf( |
| 426 | 426 | 'callback methods expects a string, or an array of strings that represent method names, but got %s.', |
@@ -431,7 +431,7 @@ discard block |
||
| 431 | 431 | |
| 432 | 432 | $methods = []; |
| 433 | 433 | foreach ($config as $name) { |
| 434 | - if (!$class->hasMethod($name)) { |
|
| 434 | + if ( ! $class->hasMethod($name)) { |
|
| 435 | 435 | throw new InvalidMetadataException( |
| 436 | 436 | sprintf('The method %s does not exist in class %s.', $name, $class->name) |
| 437 | 437 | ); |