@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | $configured = false; |
| 82 | 82 | |
| 83 | 83 | $classMetadata = new ClassMetadata($name = $class->name); |
| 84 | - $fileResource = $class->getFilename(); |
|
| 84 | + $fileResource = $class->getFilename(); |
|
| 85 | 85 | |
| 86 | 86 | if (false !== $fileResource) { |
| 87 | 87 | $classMetadata->fileResources[] = $fileResource; |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | } |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | - if (!$excludeAll) { |
|
| 170 | + if ( ! $excludeAll) { |
|
| 171 | 171 | foreach ($class->getProperties() as $property) { |
| 172 | 172 | if ($property->class !== $name || (isset($property->info) && $property->info['class'] !== $name)) { |
| 173 | 173 | continue; |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | } elseif ($annot instanceof Expose) { |
| 202 | 202 | $isExpose = true; |
| 203 | 203 | if (null !== $annot->if) { |
| 204 | - $propertyMetadata->excludeIf = $this->parseExpression('!(' . $annot->if . ')'); |
|
| 204 | + $propertyMetadata->excludeIf = $this->parseExpression('!('.$annot->if.')'); |
|
| 205 | 205 | } |
| 206 | 206 | } elseif ($annot instanceof Exclude) { |
| 207 | 207 | if (null !== $annot->if) { |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | throw new InvalidMetadataException(sprintf( |
| 249 | 249 | 'Invalid group name "%s" on "%s", did you mean to create multiple groups?', |
| 250 | 250 | implode(', ', $propertyMetadata->groups), |
| 251 | - $propertyMetadata->class . '->' . $propertyMetadata->name, |
|
| 251 | + $propertyMetadata->class.'->'.$propertyMetadata->name, |
|
| 252 | 252 | )); |
| 253 | 253 | } |
| 254 | 254 | } |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | } |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | - if (!$propertyMetadata->serializedName) { |
|
| 273 | + if ( ! $propertyMetadata->serializedName) { |
|
| 274 | 274 | $propertyMetadata->serializedName = $this->namingStrategy->translateName($propertyMetadata); |
| 275 | 275 | } |
| 276 | 276 | |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | if ( |
| 284 | - (ExclusionPolicy::NONE === $exclusionPolicy && !$isExclude) |
|
| 284 | + (ExclusionPolicy::NONE === $exclusionPolicy && ! $isExclude) |
|
| 285 | 285 | || (ExclusionPolicy::ALL === $exclusionPolicy && $isExpose) |
| 286 | 286 | ) { |
| 287 | 287 | $propertyMetadata->setAccessor($accessType, $accessor[0], $accessor[1]); |
@@ -132,7 +132,7 @@ |
||
| 132 | 132 | |
| 133 | 133 | $accessor = $this->writeAccessors[$metadata->class] ?? null; |
| 134 | 134 | if (null === $accessor) { |
| 135 | - $accessor = \Closure::bind(static function ($o, $name, $value): void { |
|
| 135 | + $accessor = \Closure::bind(static function($o, $name, $value): void { |
|
| 136 | 136 | $o->$name = $value; |
| 137 | 137 | }, null, $metadata->class); |
| 138 | 138 | $this->writeAccessors[$metadata->class] = $accessor; |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | public function createDriver(array $metadataDirs, ?Reader $annotationReader = null): DriverInterface |
| 60 | 60 | { |
| 61 | - if (PHP_VERSION_ID < 80000 && empty($metadataDirs) && !interface_exists(Reader::class)) { |
|
| 61 | + if (PHP_VERSION_ID < 80000 && empty($metadataDirs) && ! interface_exists(Reader::class)) { |
|
| 62 | 62 | throw new RuntimeException(sprintf('To use "%s", either a list of metadata directories must be provided, the "doctrine/annotations" package installed, or use PHP 8.0 or later.', self::class)); |
| 63 | 63 | } |
| 64 | 64 | |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | $metadataDrivers[] = new AnnotationOrAttributeDriver($this->propertyNamingStrategy, $this->typeParser, $this->expressionEvaluator, $annotationReader); |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - if (!empty($metadataDirs)) { |
|
| 79 | + if ( ! empty($metadataDirs)) { |
|
| 80 | 80 | $fileLocator = new FileLocator($metadataDirs); |
| 81 | 81 | |
| 82 | 82 | array_unshift($metadataDrivers, new XmlDriver($fileLocator, $this->propertyNamingStrategy, $this->typeParser, $this->expressionEvaluator)); |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | public function createDriver(array $metadataDirs, ?Reader $reader = null): DriverInterface |
| 28 | 28 | { |
| 29 | 29 | $driver = \call_user_func($this->callback, $metadataDirs, $reader); |
| 30 | - if (!$driver instanceof DriverInterface) { |
|
| 30 | + if ( ! $driver instanceof DriverInterface) { |
|
| 31 | 31 | throw new LogicException('The callback must return an instance of DriverInterface.'); |
| 32 | 32 | } |
| 33 | 33 | |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | $this->addExclusionStrategy(new VersionExclusionStrategy($this->attributes['version'])); |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - if (!empty($this->attributes['max_depth_checks'])) { |
|
| 81 | + if ( ! empty($this->attributes['max_depth_checks'])) { |
|
| 82 | 82 | $this->addExclusionStrategy(new DepthExclusionStrategy()); |
| 83 | 83 | } |
| 84 | 84 | |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | |
| 134 | 134 | final protected function assertMutable(): void |
| 135 | 135 | { |
| 136 | - if (!$this->initialized) { |
|
| 136 | + if ( ! $this->initialized) { |
|
| 137 | 137 | return; |
| 138 | 138 | } |
| 139 | 139 | |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | { |
| 223 | 223 | $metadata = $this->metadataStack->pop(); |
| 224 | 224 | |
| 225 | - if (!$metadata instanceof PropertyMetadata) { |
|
| 225 | + if ( ! $metadata instanceof PropertyMetadata) { |
|
| 226 | 226 | throw new RuntimeException('Context metadataStack not working well'); |
| 227 | 227 | } |
| 228 | 228 | } |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | { |
| 232 | 232 | $metadata = $this->metadataStack->pop(); |
| 233 | 233 | |
| 234 | - if (!$metadata instanceof ClassMetadata) { |
|
| 234 | + if ( ! $metadata instanceof ClassMetadata) { |
|
| 235 | 235 | throw new RuntimeException('Context metadataStack not working well'); |
| 236 | 236 | } |
| 237 | 237 | } |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | |
| 244 | 244 | public function getCurrentPath(): array |
| 245 | 245 | { |
| 246 | - if (!$this->metadataStack) { |
|
| 246 | + if ( ! $this->metadataStack) { |
|
| 247 | 247 | return []; |
| 248 | 248 | } |
| 249 | 249 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | */ |
| 60 | 60 | private function reorderTypes(array $types): array |
| 61 | 61 | { |
| 62 | - uasort($types, static function ($a, $b) { |
|
| 62 | + uasort($types, static function($a, $b) { |
|
| 63 | 63 | $order = ['null' => 0, 'true' => 1, 'false' => 2, 'bool' => 3, 'int' => 4, 'float' => 5, 'array' => 6, 'string' => 7]; |
| 64 | 64 | |
| 65 | 65 | return ($order[$a['name']] ?? 8) <=> ($order[$b['name']] ?? 8); |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | */ |
| 160 | 160 | private function shouldTypeHint(?ReflectionType $reflectionType): bool |
| 161 | 161 | { |
| 162 | - if (!$reflectionType instanceof ReflectionNamedType) { |
|
| 162 | + if ( ! $reflectionType instanceof ReflectionNamedType) { |
|
| 163 | 163 | return false; |
| 164 | 164 | } |
| 165 | 165 | |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | */ |
| 177 | 177 | private function shouldTypeHintUnion(?ReflectionType $reflectionType) |
| 178 | 178 | { |
| 179 | - if (!$reflectionType instanceof \ReflectionUnionType) { |
|
| 179 | + if ( ! $reflectionType instanceof \ReflectionUnionType) { |
|
| 180 | 180 | return false; |
| 181 | 181 | } |
| 182 | 182 | |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | |
| 145 | 145 | case 'bool': |
| 146 | 146 | case 'boolean': |
| 147 | - return !is_array($data) && (string) (bool) $data === (string) $data; |
|
| 147 | + return ! is_array($data) && (string) (bool) $data === (string) $data; |
|
| 148 | 148 | |
| 149 | 149 | case 'true': |
| 150 | 150 | return true === $data; |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | return false === $data; |
| 154 | 154 | |
| 155 | 155 | case 'string': |
| 156 | - return !is_array($data) && !is_object($data); |
|
| 156 | + return ! is_array($data) && ! is_object($data); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | return false; |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | 'direction' => GraphNavigatorInterface::DIRECTION_SERIALIZATION, |
| 33 | 33 | 'type' => $type, |
| 34 | 34 | 'format' => $format, |
| 35 | - 'method' => $method . 'To' . $format, |
|
| 35 | + 'method' => $method.'To'.$format, |
|
| 36 | 36 | ]; |
| 37 | 37 | } |
| 38 | 38 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | public function serializeListToXml(XmlSerializationVisitor $visitor, ConstraintViolationList $list): void |
| 44 | 44 | { |
| 45 | 45 | $currentNode = $visitor->getCurrentNode(); |
| 46 | - if (!$currentNode) { |
|
| 46 | + if ( ! $currentNode) { |
|
| 47 | 47 | $visitor->createRoot(); |
| 48 | 48 | } |
| 49 | 49 | |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | $violationNode = $visitor->getDocument()->createElement('violation'); |
| 68 | 68 | |
| 69 | 69 | $parent = $visitor->getCurrentNode(); |
| 70 | - if (!$parent) { |
|
| 70 | + if ( ! $parent) { |
|
| 71 | 71 | $visitor->setCurrentAndRootNode($violationNode); |
| 72 | 72 | } else { |
| 73 | 73 | $parent->appendChild($violationNode); |
@@ -176,22 +176,22 @@ discard block |
||
| 176 | 176 | $class = $this->getReflection()->getDeclaringClass(); |
| 177 | 177 | |
| 178 | 178 | if (empty($getter)) { |
| 179 | - if ($class->hasMethod('get' . $this->name) && $class->getMethod('get' . $this->name)->isPublic()) { |
|
| 180 | - $getter = 'get' . $this->name; |
|
| 181 | - } elseif ($class->hasMethod('is' . $this->name) && $class->getMethod('is' . $this->name)->isPublic()) { |
|
| 182 | - $getter = 'is' . $this->name; |
|
| 183 | - } elseif ($class->hasMethod('has' . $this->name) && $class->getMethod('has' . $this->name)->isPublic()) { |
|
| 184 | - $getter = 'has' . $this->name; |
|
| 179 | + if ($class->hasMethod('get'.$this->name) && $class->getMethod('get'.$this->name)->isPublic()) { |
|
| 180 | + $getter = 'get'.$this->name; |
|
| 181 | + } elseif ($class->hasMethod('is'.$this->name) && $class->getMethod('is'.$this->name)->isPublic()) { |
|
| 182 | + $getter = 'is'.$this->name; |
|
| 183 | + } elseif ($class->hasMethod('has'.$this->name) && $class->getMethod('has'.$this->name)->isPublic()) { |
|
| 184 | + $getter = 'has'.$this->name; |
|
| 185 | 185 | } else { |
| 186 | - 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)); |
|
| 186 | + 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)); |
|
| 187 | 187 | } |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | - if (empty($setter) && !$this->readOnly) { |
|
| 191 | - if ($class->hasMethod('set' . $this->name) && $class->getMethod('set' . $this->name)->isPublic()) { |
|
| 192 | - $setter = 'set' . $this->name; |
|
| 190 | + if (empty($setter) && ! $this->readOnly) { |
|
| 191 | + if ($class->hasMethod('set'.$this->name) && $class->getMethod('set'.$this->name)->isPublic()) { |
|
| 192 | + $setter = 'set'.$this->name; |
|
| 193 | 193 | } else { |
| 194 | - 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)); |
|
| 194 | + 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)); |
|
| 195 | 195 | } |
| 196 | 196 | } |
| 197 | 197 | } |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | return is_array($type) |
| 217 | 217 | && 'array' === $type['name'] |
| 218 | 218 | && isset($type['params'][0]) |
| 219 | - && !isset($type['params'][1]); |
|
| 219 | + && ! isset($type['params'][1]); |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | /** |