@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | { |
| 43 | 43 | $config = Yaml::parse(file_get_contents($file)); |
| 44 | 44 | |
| 45 | - if (!isset($config[$name = $class->name])) { |
|
| 45 | + if ( ! isset($config[$name = $class->name])) { |
|
| 46 | 46 | throw new InvalidMetadataException(sprintf('Expected metadata for class %s to be defined in %s.', $class->name, $file)); |
| 47 | 47 | } |
| 48 | 48 | |
@@ -63,20 +63,20 @@ discard block |
||
| 63 | 63 | $virtualPropertyMetadata = new ExpressionPropertyMetadata($name, $methodName, $propertySettings['exp']); |
| 64 | 64 | unset($propertySettings['exp']); |
| 65 | 65 | } else { |
| 66 | - if (!$class->hasMethod($methodName)) { |
|
| 67 | - throw new InvalidMetadataException('The method ' . $methodName . ' not found in class ' . $class->name); |
|
| 66 | + if ( ! $class->hasMethod($methodName)) { |
|
| 67 | + throw new InvalidMetadataException('The method '.$methodName.' not found in class '.$class->name); |
|
| 68 | 68 | } |
| 69 | 69 | $virtualPropertyMetadata = new VirtualPropertyMetadata($name, $methodName); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - $pName = !empty($propertySettings['name']) ? $propertySettings['name'] : $virtualPropertyMetadata->name; |
|
| 72 | + $pName = ! empty($propertySettings['name']) ? $propertySettings['name'] : $virtualPropertyMetadata->name; |
|
| 73 | 73 | |
| 74 | 74 | $propertiesMetadata[$pName] = $virtualPropertyMetadata; |
| 75 | 75 | $config['properties'][$pName] = $propertySettings; |
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - if (!$excludeAll) { |
|
| 79 | + if ( ! $excludeAll) { |
|
| 80 | 80 | foreach ($class->getProperties() as $property) { |
| 81 | 81 | if ($property->class !== $name || (isset($property->info) && $property->info['class'] !== $name)) { |
| 82 | 82 | continue; |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (isset($pConfig['expose_if'])) { |
| 127 | - $pMetadata->excludeIf = '!(' . $pConfig['expose_if'] . ')'; |
|
| 127 | + $pMetadata->excludeIf = '!('.$pConfig['expose_if'].')'; |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if (isset($pConfig['serialized_name'])) { |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | } |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | - if (!$pMetadata->serializedName) { |
|
| 235 | + if ( ! $pMetadata->serializedName) { |
|
| 236 | 236 | $pMetadata->serializedName = $this->namingStrategy->translateName($pMetadata); |
| 237 | 237 | } |
| 238 | 238 | |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | } |
| 250 | 250 | } |
| 251 | 251 | |
| 252 | - if ((ExclusionPolicy::NONE === $exclusionPolicy && !$isExclude) |
|
| 252 | + if ((ExclusionPolicy::NONE === $exclusionPolicy && ! $isExclude) |
|
| 253 | 253 | || (ExclusionPolicy::ALL === $exclusionPolicy && $isExpose) |
| 254 | 254 | ) { |
| 255 | 255 | $metadata->addPropertyMetadata($pMetadata); |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | |
| 282 | 282 | private function addClassProperties(ClassMetadata $metadata, array $config): void |
| 283 | 283 | { |
| 284 | - if (isset($config['custom_accessor_order']) && !isset($config['accessor_order'])) { |
|
| 284 | + if (isset($config['custom_accessor_order']) && ! isset($config['accessor_order'])) { |
|
| 285 | 285 | $config['accessor_order'] = 'custom'; |
| 286 | 286 | } |
| 287 | 287 | |
@@ -311,11 +311,11 @@ discard block |
||
| 311 | 311 | if (isset($config['discriminator']['disabled']) && true === $config['discriminator']['disabled']) { |
| 312 | 312 | $metadata->discriminatorDisabled = true; |
| 313 | 313 | } else { |
| 314 | - if (!isset($config['discriminator']['field_name'])) { |
|
| 314 | + if ( ! isset($config['discriminator']['field_name'])) { |
|
| 315 | 315 | throw new InvalidMetadataException('The "field_name" attribute must be set for discriminators.'); |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | - if (!isset($config['discriminator']['map']) || !is_array($config['discriminator']['map'])) { |
|
| 318 | + if ( ! isset($config['discriminator']['map']) || ! is_array($config['discriminator']['map'])) { |
|
| 319 | 319 | throw new InvalidMetadataException('The "map" attribute must be set, and be an array for discriminators.'); |
| 320 | 320 | } |
| 321 | 321 | $groups = $config['discriminator']['groups'] ?? []; |
@@ -340,13 +340,13 @@ discard block |
||
| 340 | 340 | { |
| 341 | 341 | if (is_string($config)) { |
| 342 | 342 | $config = [$config]; |
| 343 | - } elseif (!is_array($config)) { |
|
| 343 | + } elseif ( ! is_array($config)) { |
|
| 344 | 344 | throw new InvalidMetadataException(sprintf('callback methods expects a string, or an array of strings that represent method names, but got %s.', json_encode($config['pre_serialize']))); |
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | $methods = []; |
| 348 | 348 | foreach ($config as $name) { |
| 349 | - if (!$class->hasMethod($name)) { |
|
| 349 | + if ( ! $class->hasMethod($name)) { |
|
| 350 | 350 | throw new InvalidMetadataException(sprintf('The method %s does not exist in class %s.', $name, $class->name)); |
| 351 | 351 | } |
| 352 | 352 | |
@@ -54,7 +54,7 @@ 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); |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | $discriminatorFieldName = (string) $elem->attributes()->{'discriminator-field-name'}; |
| 89 | 89 | $discriminatorMap = []; |
| 90 | 90 | foreach ($elem->xpath('./discriminator-class') as $entry) { |
| 91 | - if (!isset($entry->attributes()->value)) { |
|
| 91 | + if ( ! isset($entry->attributes()->value)) { |
|
| 92 | 92 | throw new InvalidMetadataException('Each discriminator-class element must have a "value" attribute.'); |
| 93 | 93 | } |
| 94 | 94 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | |
| 98 | 98 | if ('true' === (string) $elem->attributes()->{'discriminator-disabled'}) { |
| 99 | 99 | $metadata->discriminatorDisabled = true; |
| 100 | - } elseif (!empty($discriminatorFieldName) || !empty($discriminatorMap)) { |
|
| 100 | + } elseif ( ! empty($discriminatorFieldName) || ! empty($discriminatorMap)) { |
|
| 101 | 101 | $discriminatorGroups = []; |
| 102 | 102 | foreach ($elem->xpath('./discriminator-groups/group') as $entry) { |
| 103 | 103 | $discriminatorGroups[] = (string) $entry; |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | foreach ($elem->xpath('./xml-namespace') as $xmlNamespace) { |
| 109 | - if (!isset($xmlNamespace->attributes()->uri)) { |
|
| 109 | + if ( ! isset($xmlNamespace->attributes()->uri)) { |
|
| 110 | 110 | throw new InvalidMetadataException('The prefix attribute must be set for all xml-namespace elements.'); |
| 111 | 111 | } |
| 112 | 112 | |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | if (isset($method->attributes()->expression)) { |
| 136 | 136 | $virtualPropertyMetadata = new ExpressionPropertyMetadata($name, (string) $method->attributes()->name, (string) $method->attributes()->expression); |
| 137 | 137 | } else { |
| 138 | - if (!isset($method->attributes()->method)) { |
|
| 138 | + if ( ! isset($method->attributes()->method)) { |
|
| 139 | 139 | throw new InvalidMetadataException('The method attribute must be set for all virtual-property elements.'); |
| 140 | 140 | } |
| 141 | 141 | $virtualPropertyMetadata = new VirtualPropertyMetadata($name, (string) $method->attributes()->method); |
@@ -145,14 +145,14 @@ discard block |
||
| 145 | 145 | $propertiesNodes[] = $method; |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - if (!$excludeAll) { |
|
| 148 | + if ( ! $excludeAll) { |
|
| 149 | 149 | foreach ($class->getProperties() as $property) { |
| 150 | 150 | if ($property->class !== $name || (isset($property->info) && $property->info['class'] !== $name)) { |
| 151 | 151 | continue; |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | $propertiesMetadata[] = new PropertyMetadata($name, $pName = $property->getName()); |
| 155 | - $pElems = $elem->xpath("./property[@name = '" . $pName . "']"); |
|
| 155 | + $pElems = $elem->xpath("./property[@name = '".$pName."']"); |
|
| 156 | 156 | |
| 157 | 157 | $propertiesNodes[] = $pElems ? reset($pElems) : null; |
| 158 | 158 | } |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | || $pMetadata instanceof ExpressionPropertyMetadata; |
| 164 | 164 | |
| 165 | 165 | $pElem = $propertiesNodes[$propertyKey]; |
| 166 | - if (!empty($pElem)) { |
|
| 166 | + if ( ! empty($pElem)) { |
|
| 167 | 167 | if (null !== $exclude = $pElem->attributes()->exclude) { |
| 168 | 168 | $isExclude = 'true' === strtolower((string) $exclude); |
| 169 | 169 | } |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | if (null !== $excludeIf = $pElem->attributes()->{'expose-if'}) { |
| 188 | - $pMetadata->excludeIf = '!(' . (string) $excludeIf . ')'; |
|
| 188 | + $pMetadata->excludeIf = '!('.(string) $excludeIf.')'; |
|
| 189 | 189 | $isExpose = true; |
| 190 | 190 | } |
| 191 | 191 | |
@@ -313,15 +313,15 @@ discard block |
||
| 313 | 313 | $metadata->isMap = $metadata->isMap || PropertyMetadata::isCollectionMap($pMetadata->type); |
| 314 | 314 | } |
| 315 | 315 | |
| 316 | - if (!$pMetadata->serializedName) { |
|
| 316 | + if ( ! $pMetadata->serializedName) { |
|
| 317 | 317 | $pMetadata->serializedName = $this->namingStrategy->translateName($pMetadata); |
| 318 | 318 | } |
| 319 | 319 | |
| 320 | - if (!empty($pElem) && null !== $name = $pElem->attributes()->name) { |
|
| 320 | + if ( ! empty($pElem) && null !== $name = $pElem->attributes()->name) { |
|
| 321 | 321 | $pMetadata->name = (string) $name; |
| 322 | 322 | } |
| 323 | 323 | |
| 324 | - if ((ExclusionPolicy::NONE === (string) $exclusionPolicy && !$isExclude) |
|
| 324 | + if ((ExclusionPolicy::NONE === (string) $exclusionPolicy && ! $isExclude) |
|
| 325 | 325 | || (ExclusionPolicy::ALL === (string) $exclusionPolicy && $isExpose) |
| 326 | 326 | ) { |
| 327 | 327 | $metadata->addPropertyMetadata($pMetadata); |
@@ -330,10 +330,10 @@ discard block |
||
| 330 | 330 | } |
| 331 | 331 | |
| 332 | 332 | foreach ($elem->xpath('./callback-method') as $method) { |
| 333 | - if (!isset($method->attributes()->type)) { |
|
| 333 | + if ( ! isset($method->attributes()->type)) { |
|
| 334 | 334 | throw new InvalidMetadataException('The type attribute must be set for all callback-method elements.'); |
| 335 | 335 | } |
| 336 | - if (!isset($method->attributes()->name)) { |
|
| 336 | + if ( ! isset($method->attributes()->name)) { |
|
| 337 | 337 | throw new InvalidMetadataException('The name attribute must be set for all callback-method elements.'); |
| 338 | 338 | } |
| 339 | 339 | |
@@ -351,10 +351,10 @@ discard block |
||
| 351 | 351 | break; |
| 352 | 352 | |
| 353 | 353 | case 'handler': |
| 354 | - if (!isset($method->attributes()->format)) { |
|
| 354 | + if ( ! isset($method->attributes()->format)) { |
|
| 355 | 355 | throw new InvalidMetadataException('The format attribute must be set for "handler" callback methods.'); |
| 356 | 356 | } |
| 357 | - if (!isset($method->attributes()->direction)) { |
|
| 357 | + if ( ! isset($method->attributes()->direction)) { |
|
| 358 | 358 | throw new InvalidMetadataException('The direction attribute must be set for "handler" callback methods.'); |
| 359 | 359 | } |
| 360 | 360 | |
@@ -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'], |
@@ -41,11 +41,11 @@ discard block |
||
| 41 | 41 | // For inheritance schemes, we cannot add any type as we would only add the super-type of the hierarchy. |
| 42 | 42 | // On serialization, this would lead to only the supertype being serialized, and properties of subtypes |
| 43 | 43 | // being ignored. |
| 44 | - if ($targetMetadata instanceof DoctrineClassMetadata && !$targetMetadata->isInheritanceTypeNone()) { |
|
| 44 | + if ($targetMetadata instanceof DoctrineClassMetadata && ! $targetMetadata->isInheritanceTypeNone()) { |
|
| 45 | 45 | return; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - if (!$doctrineMetadata->isSingleValuedAssociation($propertyName)) { |
|
| 48 | + if ( ! $doctrineMetadata->isSingleValuedAssociation($propertyName)) { |
|
| 49 | 49 | $targetEntity = "ArrayCollection<{$targetEntity}>"; |
| 50 | 50 | } |
| 51 | 51 | |
@@ -85,7 +85,7 @@ |
||
| 85 | 85 | $this->readOnly, |
| 86 | 86 | $this->class, |
| 87 | 87 | $this->name |
| 88 | - ) = $unserialized; |
|
| 88 | + ) = $unserialized; |
|
| 89 | 89 | |
| 90 | 90 | if (isset($unserialized['excludeIf'])) { |
| 91 | 91 | $this->excludeIf = $unserialized['excludeIf']; |
@@ -84,7 +84,7 @@ |
||
| 84 | 84 | $this->readOnly, |
| 85 | 85 | $this->class, |
| 86 | 86 | $this->name |
| 87 | - ) = $unserialized; |
|
| 87 | + ) = $unserialized; |
|
| 88 | 88 | |
| 89 | 89 | if (isset($unserialized['excludeIf'])) { |
| 90 | 90 | $this->excludeIf = $unserialized['excludeIf']; |