@@ -25,7 +25,7 @@ |
||
| 25 | 25 | All the other cases should work as expected. |
| 26 | 26 | The alternative here is to use the explicit syntax Groups(groups=['value' => '...']) |
| 27 | 27 | */ |
| 28 | - if (count($values) > 0 && ((!isset($values['value']) && !isset($values['groups'])) || count($values) > 1) && 0 === count($groups)) { |
|
| 28 | + if (count($values) > 0 && (( ! isset($values['value']) && ! isset($values['groups'])) || count($values) > 1) && 0 === count($groups)) { |
|
| 29 | 29 | $vars['groups'] = $values; |
| 30 | 30 | $vars['values'] = []; |
| 31 | 31 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | // Locate possible ObjectManager |
| 70 | 70 | $objectManager = $this->managerRegistry->getManagerForClass($metadata->name); |
| 71 | 71 | |
| 72 | - if (!$objectManager) { |
|
| 72 | + if ( ! $objectManager) { |
|
| 73 | 73 | // No ObjectManager found, proceed with normal deserialization |
| 74 | 74 | return $this->fallbackConstructor->construct($visitor, $metadata, $data, $type, $context); |
| 75 | 75 | } |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | // Managed entity, check for proxy load |
| 86 | - if (!is_array($data) && !(is_object($data) && 'SimpleXMLElement' === get_class($data))) { |
|
| 86 | + if ( ! is_array($data) && ! (is_object($data) && 'SimpleXMLElement' === get_class($data))) { |
|
| 87 | 87 | // Single identifier, load proxy |
| 88 | 88 | return $objectManager->getReference($metadata->name, $data); |
| 89 | 89 | } |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | |
| 95 | 95 | foreach ($classMetadata->getIdentifierFieldNames() as $name) { |
| 96 | 96 | // Avoid calling objectManager->find if some identification properties are excluded |
| 97 | - if (!isset($metadata->propertyMetadata[$name])) { |
|
| 97 | + if ( ! isset($metadata->propertyMetadata[$name])) { |
|
| 98 | 98 | return $this->fallbackConstructor->construct($visitor, $metadata, $data, $type, $context); |
| 99 | 99 | } |
| 100 | 100 | |
@@ -105,9 +105,9 @@ discard block |
||
| 105 | 105 | return $this->fallbackConstructor->construct($visitor, $metadata, $data, $type, $context); |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - if (is_array($data) && !array_key_exists($propertyMetadata->serializedName, $data)) { |
|
| 108 | + if (is_array($data) && ! array_key_exists($propertyMetadata->serializedName, $data)) { |
|
| 109 | 109 | return $this->fallbackConstructor->construct($visitor, $metadata, $data, $type, $context); |
| 110 | - } elseif (is_object($data) && !property_exists($data, $propertyMetadata->serializedName)) { |
|
| 110 | + } elseif (is_object($data) && ! property_exists($data, $propertyMetadata->serializedName)) { |
|
| 111 | 111 | return $this->fallbackConstructor->construct($visitor, $metadata, $data, $type, $context); |
| 112 | 112 | } |
| 113 | 113 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | $propertyMetadata = $context->getMetadataStack()->top(); |
| 122 | - if (!$propertyMetadata instanceof PropertyMetadata) { |
|
| 122 | + if ( ! $propertyMetadata instanceof PropertyMetadata) { |
|
| 123 | 123 | return $elements; |
| 124 | 124 | } |
| 125 | 125 | |
@@ -137,18 +137,18 @@ discard block |
||
| 137 | 137 | && $classMetadata->isCollectionValuedAssociation($propertyMetadata->name) |
| 138 | 138 | ) { |
| 139 | 139 | $existingCollection = $classMetadata->getFieldValue($currentObject, $propertyMetadata->name); |
| 140 | - if (!$existingCollection instanceof OrmPersistentCollection) { |
|
| 140 | + if ( ! $existingCollection instanceof OrmPersistentCollection) { |
|
| 141 | 141 | return $elements; |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | foreach ($elements as $element) { |
| 145 | - if (!$existingCollection->contains($element)) { |
|
| 145 | + if ( ! $existingCollection->contains($element)) { |
|
| 146 | 146 | $existingCollection->add($element); |
| 147 | 147 | } |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | foreach ($existingCollection as $collectionElement) { |
| 151 | - if (!$elements->contains($collectionElement)) { |
|
| 151 | + if ( ! $elements->contains($collectionElement)) { |
|
| 152 | 152 | $existingCollection->removeElement($collectionElement); |
| 153 | 153 | } |
| 154 | 154 | } |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | public function visitDouble(float $data, array $type) |
| 72 | 72 | { |
| 73 | 73 | $percision = $type['params'][0] ?? null; |
| 74 | - if (!is_int($percision)) { |
|
| 74 | + if ( ! is_int($percision)) { |
|
| 75 | 75 | return $data; |
| 76 | 76 | } |
| 77 | 77 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | $rs = isset($type['params'][1]) ? new \ArrayObject() : []; |
| 95 | 95 | |
| 96 | - $isList = isset($type['params'][0]) && !isset($type['params'][1]); |
|
| 96 | + $isList = isset($type['params'][0]) && ! isset($type['params'][1]); |
|
| 97 | 97 | |
| 98 | 98 | $elType = $this->getElementType($type); |
| 99 | 99 | foreach ($data as $k => $v) { |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | $relativeDepth = 0; |
| 29 | 29 | |
| 30 | 30 | foreach ($context->getMetadataStack() as $metadata) { |
| 31 | - if (!$metadata instanceof PropertyMetadata) { |
|
| 31 | + if ( ! $metadata instanceof PropertyMetadata) { |
|
| 32 | 32 | continue; |
| 33 | 33 | } |
| 34 | 34 | |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | { |
| 15 | 15 | $classMetadata = new ClassMetadata($name = $class->name); |
| 16 | 16 | $classMetadata->isEnum = method_exists($class, 'isEnum') ? $class->isEnum() : false; |
| 17 | - $fileResource = $class->getFilename(); |
|
| 17 | + $fileResource = $class->getFilename(); |
|
| 18 | 18 | if (false !== $fileResource) { |
| 19 | 19 | $classMetadata->fileResources[] = $fileResource; |
| 20 | 20 | } |
@@ -55,14 +55,14 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | $metadata = new ClassMetadata($name = $class->name); |
| 57 | 57 | $metadata->isEnum = method_exists($class, 'isEnum') ? $class->isEnum() : false; |
| 58 | - if (!$elems = $elem->xpath("./class[@name = '" . $name . "']")) { |
|
| 58 | + if ( ! $elems = $elem->xpath("./class[@name = '".$name."']")) { |
|
| 59 | 59 | throw new InvalidMetadataException(sprintf('Could not find class %s inside XML element.', $name)); |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | $elem = reset($elems); |
| 63 | 63 | |
| 64 | 64 | $metadata->fileResources[] = $path; |
| 65 | - $fileResource = $class->getFilename(); |
|
| 65 | + $fileResource = $class->getFilename(); |
|
| 66 | 66 | if (false !== $fileResource) { |
| 67 | 67 | $metadata->fileResources[] = $fileResource; |
| 68 | 68 | } |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | $discriminatorFieldName = (string) $elem->attributes()->{'discriminator-field-name'}; |
| 102 | 102 | $discriminatorMap = []; |
| 103 | 103 | foreach ($elem->xpath('./discriminator-class') as $entry) { |
| 104 | - if (!isset($entry->attributes()->value)) { |
|
| 104 | + if ( ! isset($entry->attributes()->value)) { |
|
| 105 | 105 | throw new InvalidMetadataException('Each discriminator-class element must have a "value" attribute.'); |
| 106 | 106 | } |
| 107 | 107 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | if ('true' === (string) $elem->attributes()->{'discriminator-disabled'}) { |
| 112 | 112 | $metadata->discriminatorDisabled = true; |
| 113 | - } elseif (!empty($discriminatorFieldName) || !empty($discriminatorMap)) { |
|
| 113 | + } elseif ( ! empty($discriminatorFieldName) || ! empty($discriminatorMap)) { |
|
| 114 | 114 | $discriminatorGroups = []; |
| 115 | 115 | foreach ($elem->xpath('./discriminator-groups/group') as $entry) { |
| 116 | 116 | $discriminatorGroups[] = (string) $entry; |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | foreach ($elem->xpath('./xml-namespace') as $xmlNamespace) { |
| 123 | - if (!isset($xmlNamespace->attributes()->uri)) { |
|
| 123 | + if ( ! isset($xmlNamespace->attributes()->uri)) { |
|
| 124 | 124 | throw new InvalidMetadataException('The prefix attribute must be set for all xml-namespace elements.'); |
| 125 | 125 | } |
| 126 | 126 | |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | $this->parseExpression((string) $method->attributes()->expression) |
| 156 | 156 | ); |
| 157 | 157 | } else { |
| 158 | - if (!isset($method->attributes()->method)) { |
|
| 158 | + if ( ! isset($method->attributes()->method)) { |
|
| 159 | 159 | throw new InvalidMetadataException('The method attribute must be set for all virtual-property elements.'); |
| 160 | 160 | } |
| 161 | 161 | |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | $propertiesNodes[] = $method; |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | - if (!$excludeAll) { |
|
| 169 | + if ( ! $excludeAll) { |
|
| 170 | 170 | foreach ($class->getProperties() as $property) { |
| 171 | 171 | if ($property->class !== $name || (isset($property->info) && $property->info['class'] !== $name)) { |
| 172 | 172 | continue; |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | $pName = $property->getName(); |
| 176 | 176 | $propertiesMetadata[] = new PropertyMetadata($name, $pName); |
| 177 | 177 | |
| 178 | - $pElems = $elem->xpath("./property[@name = '" . $pName . "']"); |
|
| 178 | + $pElems = $elem->xpath("./property[@name = '".$pName."']"); |
|
| 179 | 179 | $propertiesNodes[] = $pElems ? reset($pElems) : null; |
| 180 | 180 | } |
| 181 | 181 | |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | || isset($propertiesNodes[$propertyKey]); |
| 187 | 187 | |
| 188 | 188 | $pElem = $propertiesNodes[$propertyKey]; |
| 189 | - if (!empty($pElem)) { |
|
| 189 | + if ( ! empty($pElem)) { |
|
| 190 | 190 | if (null !== $exclude = $pElem->attributes()->exclude) { |
| 191 | 191 | $isExclude = 'true' === strtolower((string) $exclude); |
| 192 | 192 | } |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | if (null !== $excludeIf = $pElem->attributes()->{'expose-if'}) { |
| 211 | - $pMetadata->excludeIf = $this->parseExpression('!(' . (string) $excludeIf . ')'); |
|
| 211 | + $pMetadata->excludeIf = $this->parseExpression('!('.(string) $excludeIf.')'); |
|
| 212 | 212 | $isExpose = true; |
| 213 | 213 | } |
| 214 | 214 | |
@@ -336,16 +336,16 @@ discard block |
||
| 336 | 336 | $metadata->isMap = $metadata->isMap || PropertyMetadata::isCollectionMap($pMetadata->type); |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | - if (!$pMetadata->serializedName) { |
|
| 339 | + if ( ! $pMetadata->serializedName) { |
|
| 340 | 340 | $pMetadata->serializedName = $this->namingStrategy->translateName($pMetadata); |
| 341 | 341 | } |
| 342 | 342 | |
| 343 | - if (!empty($pElem) && null !== $name = $pElem->attributes()->name) { |
|
| 343 | + if ( ! empty($pElem) && null !== $name = $pElem->attributes()->name) { |
|
| 344 | 344 | $pMetadata->name = (string) $name; |
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | if ( |
| 348 | - (ExclusionPolicy::NONE === (string) $exclusionPolicy && !$isExclude) |
|
| 348 | + (ExclusionPolicy::NONE === (string) $exclusionPolicy && ! $isExclude) |
|
| 349 | 349 | || (ExclusionPolicy::ALL === (string) $exclusionPolicy && $isExpose) |
| 350 | 350 | ) { |
| 351 | 351 | $metadata->addPropertyMetadata($pMetadata); |
@@ -354,11 +354,11 @@ discard block |
||
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | foreach ($elem->xpath('./callback-method') as $method) { |
| 357 | - if (!isset($method->attributes()->type)) { |
|
| 357 | + if ( ! isset($method->attributes()->type)) { |
|
| 358 | 358 | throw new InvalidMetadataException('The type attribute must be set for all callback-method elements.'); |
| 359 | 359 | } |
| 360 | 360 | |
| 361 | - if (!isset($method->attributes()->name)) { |
|
| 361 | + if ( ! isset($method->attributes()->name)) { |
|
| 362 | 362 | throw new InvalidMetadataException('The name attribute must be set for all callback-method elements.'); |
| 363 | 363 | } |
| 364 | 364 | |
@@ -376,11 +376,11 @@ discard block |
||
| 376 | 376 | break; |
| 377 | 377 | |
| 378 | 378 | case 'handler': |
| 379 | - if (!isset($method->attributes()->format)) { |
|
| 379 | + if ( ! isset($method->attributes()->format)) { |
|
| 380 | 380 | throw new InvalidMetadataException('The format attribute must be set for "handler" callback methods.'); |
| 381 | 381 | } |
| 382 | 382 | |
| 383 | - if (!isset($method->attributes()->direction)) { |
|
| 383 | + if ( ! isset($method->attributes()->direction)) { |
|
| 384 | 384 | throw new InvalidMetadataException('The direction attribute must be set for "handler" callback methods.'); |
| 385 | 385 | } |
| 386 | 386 | |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | { |
| 79 | 79 | $classMetadata = new ClassMetadata($name = $class->name); |
| 80 | 80 | $classMetadata->isEnum = method_exists($class, 'isEnum') ? $class->isEnum() : false; |
| 81 | - $fileResource = $class->getFilename(); |
|
| 81 | + $fileResource = $class->getFilename(); |
|
| 82 | 82 | if (false !== $fileResource) { |
| 83 | 83 | $classMetadata->fileResources[] = $fileResource; |
| 84 | 84 | } |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - if (!$excludeAll) { |
|
| 161 | + if ( ! $excludeAll) { |
|
| 162 | 162 | foreach ($class->getProperties() as $property) { |
| 163 | 163 | if ($property->class !== $name || (isset($property->info) && $property->info['class'] !== $name)) { |
| 164 | 164 | continue; |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | } elseif ($annot instanceof Expose) { |
| 191 | 191 | $isExpose = true; |
| 192 | 192 | if (null !== $annot->if) { |
| 193 | - $propertyMetadata->excludeIf = $this->parseExpression('!(' . $annot->if . ')'); |
|
| 193 | + $propertyMetadata->excludeIf = $this->parseExpression('!('.$annot->if.')'); |
|
| 194 | 194 | } |
| 195 | 195 | } elseif ($annot instanceof Exclude) { |
| 196 | 196 | if (null !== $annot->if) { |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | throw new InvalidMetadataException(sprintf( |
| 238 | 238 | 'Invalid group name "%s" on "%s", did you mean to create multiple groups?', |
| 239 | 239 | implode(', ', $propertyMetadata->groups), |
| 240 | - $propertyMetadata->class . '->' . $propertyMetadata->name |
|
| 240 | + $propertyMetadata->class.'->'.$propertyMetadata->name |
|
| 241 | 241 | )); |
| 242 | 242 | } |
| 243 | 243 | } |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | } |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | - if (!$propertyMetadata->serializedName) { |
|
| 262 | + if ( ! $propertyMetadata->serializedName) { |
|
| 263 | 263 | $propertyMetadata->serializedName = $this->namingStrategy->translateName($propertyMetadata); |
| 264 | 264 | } |
| 265 | 265 | |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | if ( |
| 273 | - (ExclusionPolicy::NONE === $exclusionPolicy && !$isExclude) |
|
| 273 | + (ExclusionPolicy::NONE === $exclusionPolicy && ! $isExclude) |
|
| 274 | 274 | || (ExclusionPolicy::ALL === $exclusionPolicy && $isExpose) |
| 275 | 275 | ) { |
| 276 | 276 | $propertyMetadata->setAccessor($accessType, $accessor[0], $accessor[1]); |