@@ -104,9 +104,9 @@ discard block |
||
| 104 | 104 | $classMetadata->setDiscriminator($annot->field, $annot->map, $annot->groups); |
| 105 | 105 | } |
| 106 | 106 | } elseif ($annot instanceof XmlDiscriminator) { |
| 107 | - $classMetadata->xmlDiscriminatorAttribute = (bool)$annot->attribute; |
|
| 108 | - $classMetadata->xmlDiscriminatorCData = (bool)$annot->cdata; |
|
| 109 | - $classMetadata->xmlDiscriminatorNamespace = $annot->namespace ? (string)$annot->namespace : null; |
|
| 107 | + $classMetadata->xmlDiscriminatorAttribute = (bool) $annot->attribute; |
|
| 108 | + $classMetadata->xmlDiscriminatorCData = (bool) $annot->cdata; |
|
| 109 | + $classMetadata->xmlDiscriminatorNamespace = $annot->namespace ? (string) $annot->namespace : null; |
|
| 110 | 110 | } elseif ($annot instanceof VirtualProperty) { |
| 111 | 111 | $virtualPropertyMetadata = new ExpressionPropertyMetadata($name, $annot->name, $annot->exp); |
| 112 | 112 | $propertiesMetadata[] = $virtualPropertyMetadata; |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | } |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - if (!$excludeAll) { |
|
| 146 | + if ( ! $excludeAll) { |
|
| 147 | 147 | foreach ($class->getProperties() as $property) { |
| 148 | 148 | if ($property->class !== $name || (isset($property->info) && $property->info['class'] !== $name)) { |
| 149 | 149 | continue; |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | } elseif ($annot instanceof Expose) { |
| 175 | 175 | $isExpose = true; |
| 176 | 176 | if (null !== $annot->if) { |
| 177 | - $propertyMetadata->excludeIf = "!(" . $annot->if . ")"; |
|
| 177 | + $propertyMetadata->excludeIf = "!(".$annot->if.")"; |
|
| 178 | 178 | } |
| 179 | 179 | } elseif ($annot instanceof Exclude) { |
| 180 | 180 | if (null !== $annot->if) { |
@@ -218,12 +218,12 @@ discard block |
||
| 218 | 218 | $accessor = array($annot->getter, $annot->setter); |
| 219 | 219 | } elseif ($annot instanceof Groups) { |
| 220 | 220 | $propertyMetadata->groups = $annot->groups; |
| 221 | - foreach ((array)$propertyMetadata->groups as $groupName) { |
|
| 221 | + foreach ((array) $propertyMetadata->groups as $groupName) { |
|
| 222 | 222 | if (false !== strpos($groupName, ',')) { |
| 223 | 223 | throw new InvalidArgumentException(sprintf( |
| 224 | 224 | 'Invalid group name "%s" on "%s", did you mean to create multiple groups?', |
| 225 | 225 | implode(', ', $propertyMetadata->groups), |
| 226 | - $propertyMetadata->class . '->' . $propertyMetadata->name |
|
| 226 | + $propertyMetadata->class.'->'.$propertyMetadata->name |
|
| 227 | 227 | )); |
| 228 | 228 | } |
| 229 | 229 | } |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | |
| 240 | - if ((ExclusionPolicy::NONE === $exclusionPolicy && !$isExclude) |
|
| 240 | + if ((ExclusionPolicy::NONE === $exclusionPolicy && ! $isExclude) |
|
| 241 | 241 | || (ExclusionPolicy::ALL === $exclusionPolicy && $isExpose) |
| 242 | 242 | ) { |
| 243 | 243 | $propertyMetadata->setAccessor($accessType, $accessor[0], $accessor[1]); |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | { |
| 29 | 29 | $metadata = require $file; |
| 30 | 30 | |
| 31 | - if (!$metadata instanceof ClassMetadata) { |
|
| 31 | + if ( ! $metadata instanceof ClassMetadata) { |
|
| 32 | 32 | throw new RuntimeException(sprintf('The file %s was expected to return an instance of ClassMetadata, but returned %s.', $file, json_encode($metadata))); |
| 33 | 33 | } |
| 34 | 34 | if ($metadata->name !== $class->name) { |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | $metadata = new ClassMetadata($name = $class->name); |
| 47 | - if (!$elems = $elem->xpath("./class[@name = '" . $name . "']")) { |
|
| 47 | + if ( ! $elems = $elem->xpath("./class[@name = '".$name."']")) { |
|
| 48 | 48 | throw new RuntimeException(sprintf('Could not find class %s inside XML element.', $name)); |
| 49 | 49 | } |
| 50 | 50 | $elem = reset($elems); |
@@ -53,88 +53,88 @@ discard block |
||
| 53 | 53 | $metadata->fileResources[] = $class->getFileName(); |
| 54 | 54 | $exclusionPolicy = strtoupper($elem->attributes()->{'exclusion-policy'}) ?: 'NONE'; |
| 55 | 55 | $excludeAll = null !== ($exclude = $elem->attributes()->exclude) ? 'true' === strtolower($exclude) : false; |
| 56 | - $classAccessType = (string)($elem->attributes()->{'access-type'} ?: PropertyMetadata::ACCESS_TYPE_PROPERTY); |
|
| 56 | + $classAccessType = (string) ($elem->attributes()->{'access-type'} ?: PropertyMetadata::ACCESS_TYPE_PROPERTY); |
|
| 57 | 57 | |
| 58 | 58 | $propertiesMetadata = array(); |
| 59 | 59 | $propertiesNodes = array(); |
| 60 | 60 | |
| 61 | 61 | if (null !== $accessorOrder = $elem->attributes()->{'accessor-order'}) { |
| 62 | - $metadata->setAccessorOrder((string)$accessorOrder, preg_split('/\s*,\s*/', (string)$elem->attributes()->{'custom-accessor-order'})); |
|
| 62 | + $metadata->setAccessorOrder((string) $accessorOrder, preg_split('/\s*,\s*/', (string) $elem->attributes()->{'custom-accessor-order'})); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | if (null !== $xmlRootName = $elem->attributes()->{'xml-root-name'}) { |
| 66 | - $metadata->xmlRootName = (string)$xmlRootName; |
|
| 66 | + $metadata->xmlRootName = (string) $xmlRootName; |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | if (null !== $xmlRootNamespace = $elem->attributes()->{'xml-root-namespace'}) { |
| 70 | - $metadata->xmlRootNamespace = (string)$xmlRootNamespace; |
|
| 70 | + $metadata->xmlRootNamespace = (string) $xmlRootNamespace; |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | $readOnlyClass = 'true' === strtolower($elem->attributes()->{'read-only'}); |
| 74 | 74 | |
| 75 | - $discriminatorFieldName = (string)$elem->attributes()->{'discriminator-field-name'}; |
|
| 75 | + $discriminatorFieldName = (string) $elem->attributes()->{'discriminator-field-name'}; |
|
| 76 | 76 | $discriminatorMap = array(); |
| 77 | 77 | foreach ($elem->xpath('./discriminator-class') as $entry) { |
| 78 | - if (!isset($entry->attributes()->value)) { |
|
| 78 | + if ( ! isset($entry->attributes()->value)) { |
|
| 79 | 79 | throw new RuntimeException('Each discriminator-class element must have a "value" attribute.'); |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - $discriminatorMap[(string)$entry->attributes()->value] = (string)$entry; |
|
| 82 | + $discriminatorMap[(string) $entry->attributes()->value] = (string) $entry; |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - if ('true' === (string)$elem->attributes()->{'discriminator-disabled'}) { |
|
| 85 | + if ('true' === (string) $elem->attributes()->{'discriminator-disabled'}) { |
|
| 86 | 86 | $metadata->discriminatorDisabled = true; |
| 87 | - } elseif (!empty($discriminatorFieldName) || !empty($discriminatorMap)) { |
|
| 87 | + } elseif ( ! empty($discriminatorFieldName) || ! empty($discriminatorMap)) { |
|
| 88 | 88 | |
| 89 | 89 | $discriminatorGroups = array(); |
| 90 | 90 | foreach ($elem->xpath('./discriminator-groups/group') as $entry) { |
| 91 | - $discriminatorGroups[] = (string)$entry; |
|
| 91 | + $discriminatorGroups[] = (string) $entry; |
|
| 92 | 92 | } |
| 93 | 93 | $metadata->setDiscriminator($discriminatorFieldName, $discriminatorMap, $discriminatorGroups); |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | foreach ($elem->xpath('./xml-namespace') as $xmlNamespace) { |
| 97 | - if (!isset($xmlNamespace->attributes()->uri)) { |
|
| 97 | + if ( ! isset($xmlNamespace->attributes()->uri)) { |
|
| 98 | 98 | throw new RuntimeException('The prefix attribute must be set for all xml-namespace elements.'); |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | if (isset($xmlNamespace->attributes()->prefix)) { |
| 102 | - $prefix = (string)$xmlNamespace->attributes()->prefix; |
|
| 102 | + $prefix = (string) $xmlNamespace->attributes()->prefix; |
|
| 103 | 103 | } else { |
| 104 | 104 | $prefix = null; |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - $metadata->registerNamespace((string)$xmlNamespace->attributes()->uri, $prefix); |
|
| 107 | + $metadata->registerNamespace((string) $xmlNamespace->attributes()->uri, $prefix); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | foreach ($elem->xpath('./xml-discriminator') as $xmlDiscriminator) { |
| 111 | 111 | if (isset($xmlDiscriminator->attributes()->attribute)) { |
| 112 | - $metadata->xmlDiscriminatorAttribute = (string)$xmlDiscriminator->attributes()->attribute === 'true'; |
|
| 112 | + $metadata->xmlDiscriminatorAttribute = (string) $xmlDiscriminator->attributes()->attribute === 'true'; |
|
| 113 | 113 | } |
| 114 | 114 | if (isset($xmlDiscriminator->attributes()->cdata)) { |
| 115 | - $metadata->xmlDiscriminatorCData = (string)$xmlDiscriminator->attributes()->cdata === 'true'; |
|
| 115 | + $metadata->xmlDiscriminatorCData = (string) $xmlDiscriminator->attributes()->cdata === 'true'; |
|
| 116 | 116 | } |
| 117 | 117 | if (isset($xmlDiscriminator->attributes()->namespace)) { |
| 118 | - $metadata->xmlDiscriminatorNamespace = (string)$xmlDiscriminator->attributes()->namespace; |
|
| 118 | + $metadata->xmlDiscriminatorNamespace = (string) $xmlDiscriminator->attributes()->namespace; |
|
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | foreach ($elem->xpath('./virtual-property') as $method) { |
| 123 | 123 | |
| 124 | 124 | if (isset($method->attributes()->expression)) { |
| 125 | - $virtualPropertyMetadata = new ExpressionPropertyMetadata($name, (string)$method->attributes()->name, (string)$method->attributes()->expression); |
|
| 125 | + $virtualPropertyMetadata = new ExpressionPropertyMetadata($name, (string) $method->attributes()->name, (string) $method->attributes()->expression); |
|
| 126 | 126 | } else { |
| 127 | - if (!isset($method->attributes()->method)) { |
|
| 127 | + if ( ! isset($method->attributes()->method)) { |
|
| 128 | 128 | throw new RuntimeException('The method attribute must be set for all virtual-property elements.'); |
| 129 | 129 | } |
| 130 | - $virtualPropertyMetadata = new VirtualPropertyMetadata($name, (string)$method->attributes()->method); |
|
| 130 | + $virtualPropertyMetadata = new VirtualPropertyMetadata($name, (string) $method->attributes()->method); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | $propertiesMetadata[] = $virtualPropertyMetadata; |
| 134 | 134 | $propertiesNodes[] = $method; |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | - if (!$excludeAll) { |
|
| 137 | + if ( ! $excludeAll) { |
|
| 138 | 138 | |
| 139 | 139 | foreach ($class->getProperties() as $property) { |
| 140 | 140 | if ($property->class !== $name || (isset($property->info) && $property->info['class'] !== $name)) { |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | $propertiesMetadata[] = new PropertyMetadata($name, $pName = $property->getName()); |
| 145 | - $pElems = $elem->xpath("./property[@name = '" . $pName . "']"); |
|
| 145 | + $pElems = $elem->xpath("./property[@name = '".$pName."']"); |
|
| 146 | 146 | |
| 147 | 147 | $propertiesNodes[] = $pElems ? reset($pElems) : null; |
| 148 | 148 | } |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | || $pMetadata instanceof ExpressionPropertyMetadata; |
| 155 | 155 | |
| 156 | 156 | $pElem = $propertiesNodes[$propertyKey]; |
| 157 | - if (!empty($pElem)) { |
|
| 157 | + if ( ! empty($pElem)) { |
|
| 158 | 158 | |
| 159 | 159 | if (null !== $exclude = $pElem->attributes()->exclude) { |
| 160 | 160 | $isExclude = 'true' === strtolower($exclude); |
@@ -173,30 +173,30 @@ discard block |
||
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | if (null !== $excludeIf = $pElem->attributes()->{'expose-if'}) { |
| 176 | - $pMetadata->excludeIf = "!(" . $excludeIf . ")"; |
|
| 176 | + $pMetadata->excludeIf = "!(".$excludeIf.")"; |
|
| 177 | 177 | $isExpose = true; |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | if (null !== $version = $pElem->attributes()->{'since-version'}) { |
| 181 | - $pMetadata->sinceVersion = (string)$version; |
|
| 181 | + $pMetadata->sinceVersion = (string) $version; |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | if (null !== $version = $pElem->attributes()->{'until-version'}) { |
| 185 | - $pMetadata->untilVersion = (string)$version; |
|
| 185 | + $pMetadata->untilVersion = (string) $version; |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | if (null !== $serializedName = $pElem->attributes()->{'serialized-name'}) { |
| 189 | - $pMetadata->serializedName = (string)$serializedName; |
|
| 189 | + $pMetadata->serializedName = (string) $serializedName; |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | if (null !== $type = $pElem->attributes()->type) { |
| 193 | - $pMetadata->setType((string)$type); |
|
| 193 | + $pMetadata->setType((string) $type); |
|
| 194 | 194 | } elseif (isset($pElem->type)) { |
| 195 | - $pMetadata->setType((string)$pElem->type); |
|
| 195 | + $pMetadata->setType((string) $pElem->type); |
|
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | if (null !== $groups = $pElem->attributes()->groups) { |
| 199 | - $pMetadata->groups = preg_split('/\s*,\s*/', (string)$groups); |
|
| 199 | + $pMetadata->groups = preg_split('/\s*,\s*/', (string) $groups); |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | if (isset($pElem->{'xml-list'})) { |
@@ -205,21 +205,21 @@ discard block |
||
| 205 | 205 | |
| 206 | 206 | $colConfig = $pElem->{'xml-list'}; |
| 207 | 207 | if (isset($colConfig->attributes()->inline)) { |
| 208 | - $pMetadata->xmlCollectionInline = 'true' === (string)$colConfig->attributes()->inline; |
|
| 208 | + $pMetadata->xmlCollectionInline = 'true' === (string) $colConfig->attributes()->inline; |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | if (isset($colConfig->attributes()->{'entry-name'})) { |
| 212 | - $pMetadata->xmlEntryName = (string)$colConfig->attributes()->{'entry-name'}; |
|
| 212 | + $pMetadata->xmlEntryName = (string) $colConfig->attributes()->{'entry-name'}; |
|
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | if (isset($colConfig->attributes()->{'skip-when-empty'})) { |
| 216 | - $pMetadata->xmlCollectionSkipWhenEmpty = 'true' === (string)$colConfig->attributes()->{'skip-when-empty'}; |
|
| 216 | + $pMetadata->xmlCollectionSkipWhenEmpty = 'true' === (string) $colConfig->attributes()->{'skip-when-empty'}; |
|
| 217 | 217 | } else { |
| 218 | 218 | $pMetadata->xmlCollectionSkipWhenEmpty = true; |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | if (isset($colConfig->attributes()->namespace)) { |
| 222 | - $pMetadata->xmlEntryNamespace = (string)$colConfig->attributes()->namespace; |
|
| 222 | + $pMetadata->xmlEntryNamespace = (string) $colConfig->attributes()->namespace; |
|
| 223 | 223 | } |
| 224 | 224 | } |
| 225 | 225 | |
@@ -228,51 +228,51 @@ discard block |
||
| 228 | 228 | |
| 229 | 229 | $colConfig = $pElem->{'xml-map'}; |
| 230 | 230 | if (isset($colConfig->attributes()->inline)) { |
| 231 | - $pMetadata->xmlCollectionInline = 'true' === (string)$colConfig->attributes()->inline; |
|
| 231 | + $pMetadata->xmlCollectionInline = 'true' === (string) $colConfig->attributes()->inline; |
|
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | if (isset($colConfig->attributes()->{'entry-name'})) { |
| 235 | - $pMetadata->xmlEntryName = (string)$colConfig->attributes()->{'entry-name'}; |
|
| 235 | + $pMetadata->xmlEntryName = (string) $colConfig->attributes()->{'entry-name'}; |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | if (isset($colConfig->attributes()->namespace)) { |
| 239 | - $pMetadata->xmlEntryNamespace = (string)$colConfig->attributes()->namespace; |
|
| 239 | + $pMetadata->xmlEntryNamespace = (string) $colConfig->attributes()->namespace; |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | if (isset($colConfig->attributes()->{'key-attribute-name'})) { |
| 243 | - $pMetadata->xmlKeyAttribute = (string)$colConfig->attributes()->{'key-attribute-name'}; |
|
| 243 | + $pMetadata->xmlKeyAttribute = (string) $colConfig->attributes()->{'key-attribute-name'}; |
|
| 244 | 244 | } |
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | if (isset($pElem->{'xml-element'})) { |
| 248 | 248 | $colConfig = $pElem->{'xml-element'}; |
| 249 | 249 | if (isset($colConfig->attributes()->cdata)) { |
| 250 | - $pMetadata->xmlElementCData = 'true' === (string)$colConfig->attributes()->cdata; |
|
| 250 | + $pMetadata->xmlElementCData = 'true' === (string) $colConfig->attributes()->cdata; |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | if (isset($colConfig->attributes()->namespace)) { |
| 254 | - $pMetadata->xmlNamespace = (string)$colConfig->attributes()->namespace; |
|
| 254 | + $pMetadata->xmlNamespace = (string) $colConfig->attributes()->namespace; |
|
| 255 | 255 | } |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | if (isset($pElem->attributes()->{'xml-attribute'})) { |
| 259 | - $pMetadata->xmlAttribute = 'true' === (string)$pElem->attributes()->{'xml-attribute'}; |
|
| 259 | + $pMetadata->xmlAttribute = 'true' === (string) $pElem->attributes()->{'xml-attribute'}; |
|
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | if (isset($pElem->attributes()->{'xml-attribute-map'})) { |
| 263 | - $pMetadata->xmlAttributeMap = 'true' === (string)$pElem->attributes()->{'xml-attribute-map'}; |
|
| 263 | + $pMetadata->xmlAttributeMap = 'true' === (string) $pElem->attributes()->{'xml-attribute-map'}; |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | if (isset($pElem->attributes()->{'xml-value'})) { |
| 267 | - $pMetadata->xmlValue = 'true' === (string)$pElem->attributes()->{'xml-value'}; |
|
| 267 | + $pMetadata->xmlValue = 'true' === (string) $pElem->attributes()->{'xml-value'}; |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | if (isset($pElem->attributes()->{'xml-key-value-pairs'})) { |
| 271 | - $pMetadata->xmlKeyValuePairs = 'true' === (string)$pElem->attributes()->{'xml-key-value-pairs'}; |
|
| 271 | + $pMetadata->xmlKeyValuePairs = 'true' === (string) $pElem->attributes()->{'xml-key-value-pairs'}; |
|
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | if (isset($pElem->attributes()->{'max-depth'})) { |
| 275 | - $pMetadata->maxDepth = (int)$pElem->attributes()->{'max-depth'}; |
|
| 275 | + $pMetadata->maxDepth = (int) $pElem->attributes()->{'max-depth'}; |
|
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | //we need read-only before setter and getter set, because that method depends on flag being set |
@@ -285,9 +285,9 @@ discard block |
||
| 285 | 285 | $getter = $pElem->attributes()->{'accessor-getter'}; |
| 286 | 286 | $setter = $pElem->attributes()->{'accessor-setter'}; |
| 287 | 287 | $pMetadata->setAccessor( |
| 288 | - (string)($pElem->attributes()->{'access-type'} ?: $classAccessType), |
|
| 289 | - $getter ? (string)$getter : null, |
|
| 290 | - $setter ? (string)$setter : null |
|
| 288 | + (string) ($pElem->attributes()->{'access-type'} ?: $classAccessType), |
|
| 289 | + $getter ? (string) $getter : null, |
|
| 290 | + $setter ? (string) $setter : null |
|
| 291 | 291 | ); |
| 292 | 292 | |
| 293 | 293 | if (null !== $inline = $pElem->attributes()->inline) { |
@@ -296,8 +296,8 @@ discard block |
||
| 296 | 296 | |
| 297 | 297 | } |
| 298 | 298 | |
| 299 | - if ((ExclusionPolicy::NONE === (string)$exclusionPolicy && !$isExclude) |
|
| 300 | - || (ExclusionPolicy::ALL === (string)$exclusionPolicy && $isExpose) |
|
| 299 | + if ((ExclusionPolicy::NONE === (string) $exclusionPolicy && ! $isExclude) |
|
| 300 | + || (ExclusionPolicy::ALL === (string) $exclusionPolicy && $isExpose) |
|
| 301 | 301 | ) { |
| 302 | 302 | |
| 303 | 303 | $metadata->addPropertyMetadata($pMetadata); |
@@ -306,37 +306,37 @@ discard block |
||
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | foreach ($elem->xpath('./callback-method') as $method) { |
| 309 | - if (!isset($method->attributes()->type)) { |
|
| 309 | + if ( ! isset($method->attributes()->type)) { |
|
| 310 | 310 | throw new RuntimeException('The type attribute must be set for all callback-method elements.'); |
| 311 | 311 | } |
| 312 | - if (!isset($method->attributes()->name)) { |
|
| 312 | + if ( ! isset($method->attributes()->name)) { |
|
| 313 | 313 | throw new RuntimeException('The name attribute must be set for all callback-method elements.'); |
| 314 | 314 | } |
| 315 | 315 | |
| 316 | - switch ((string)$method->attributes()->type) { |
|
| 316 | + switch ((string) $method->attributes()->type) { |
|
| 317 | 317 | case 'pre-serialize': |
| 318 | - $metadata->addPreSerializeMethod(new MethodMetadata($name, (string)$method->attributes()->name)); |
|
| 318 | + $metadata->addPreSerializeMethod(new MethodMetadata($name, (string) $method->attributes()->name)); |
|
| 319 | 319 | break; |
| 320 | 320 | |
| 321 | 321 | case 'post-serialize': |
| 322 | - $metadata->addPostSerializeMethod(new MethodMetadata($name, (string)$method->attributes()->name)); |
|
| 322 | + $metadata->addPostSerializeMethod(new MethodMetadata($name, (string) $method->attributes()->name)); |
|
| 323 | 323 | break; |
| 324 | 324 | |
| 325 | 325 | case 'post-deserialize': |
| 326 | - $metadata->addPostDeserializeMethod(new MethodMetadata($name, (string)$method->attributes()->name)); |
|
| 326 | + $metadata->addPostDeserializeMethod(new MethodMetadata($name, (string) $method->attributes()->name)); |
|
| 327 | 327 | break; |
| 328 | 328 | |
| 329 | 329 | case 'handler': |
| 330 | - if (!isset($method->attributes()->format)) { |
|
| 330 | + if ( ! isset($method->attributes()->format)) { |
|
| 331 | 331 | throw new RuntimeException('The format attribute must be set for "handler" callback methods.'); |
| 332 | 332 | } |
| 333 | - if (!isset($method->attributes()->direction)) { |
|
| 333 | + if ( ! isset($method->attributes()->direction)) { |
|
| 334 | 334 | throw new RuntimeException('The direction attribute must be set for "handler" callback methods.'); |
| 335 | 335 | } |
| 336 | 336 | |
| 337 | - $direction = GraphNavigator::parseDirection((string)$method->attributes()->direction); |
|
| 338 | - $format = (string)$method->attributes()->format; |
|
| 339 | - $metadata->addHandlerCallback($direction, $format, (string)$method->attributes()->name); |
|
| 337 | + $direction = GraphNavigator::parseDirection((string) $method->attributes()->direction); |
|
| 338 | + $format = (string) $method->attributes()->format; |
|
| 339 | + $metadata->addHandlerCallback($direction, $format, (string) $method->attributes()->name); |
|
| 340 | 340 | |
| 341 | 341 | break; |
| 342 | 342 | |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | $this->root = $data; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - return (string)$data; |
|
| 60 | + return (string) $data; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | public function visitBoolean($data, array $type, Context $context) |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | $this->root = $data; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - return (boolean)$data; |
|
| 69 | + return (boolean) $data; |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | public function visitInteger($data, array $type, Context $context) |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | $this->root = $data; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - return (int)$data; |
|
| 78 | + return (int) $data; |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | public function visitDouble($data, array $type, Context $context) |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | $this->root = $data; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - return (float)$data; |
|
| 87 | + return (float) $data; |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | /** |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | $rs = $isHash ? new \ArrayObject() : array(); |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - $isList = isset($type['params'][0]) && !isset($type['params'][1]); |
|
| 109 | + $isList = isset($type['params'][0]) && ! isset($type['params'][1]); |
|
| 110 | 110 | |
| 111 | 111 | foreach ($data as $k => $v) { |
| 112 | 112 | $v = $this->navigator->accept($v, $this->getElementType($type), $context); |
@@ -251,6 +251,6 @@ discard block |
||
| 251 | 251 | |
| 252 | 252 | public function setOptions($options) |
| 253 | 253 | { |
| 254 | - $this->options = (integer)$options; |
|
| 254 | + $this->options = (integer) $options; |
|
| 255 | 255 | } |
| 256 | 256 | } |
@@ -41,8 +41,8 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | public function __construct($skipVirtualTypeInit = false, $initializeExcluded = true) |
| 43 | 43 | { |
| 44 | - $this->skipVirtualTypeInit = (bool)$skipVirtualTypeInit; |
|
| 45 | - $this->initializeExcluded = (bool)$initializeExcluded; |
|
| 44 | + $this->skipVirtualTypeInit = (bool) $skipVirtualTypeInit; |
|
| 45 | + $this->initializeExcluded = (bool) $initializeExcluded; |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | public function onPreSerialize(PreSerializeEvent $event) |
@@ -53,13 +53,13 @@ discard block |
||
| 53 | 53 | // If the set type name is not an actual class, but a faked type for which a custom handler exists, we do not |
| 54 | 54 | // modify it with this subscriber. Also, we forgo autoloading here as an instance of this type is already created, |
| 55 | 55 | // so it must be loaded if its a real class. |
| 56 | - $virtualType = !class_exists($type['name'], false); |
|
| 56 | + $virtualType = ! class_exists($type['name'], false); |
|
| 57 | 57 | |
| 58 | 58 | if ($object instanceof PersistentCollection |
| 59 | 59 | || $object instanceof MongoDBPersistentCollection |
| 60 | 60 | || $object instanceof PHPCRPersistentCollection |
| 61 | 61 | ) { |
| 62 | - if (!$virtualType) { |
|
| 62 | + if ( ! $virtualType) { |
|
| 63 | 63 | $event->setType('ArrayCollection'); |
| 64 | 64 | } |
| 65 | 65 | |
@@ -67,13 +67,13 @@ discard block |
||
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | if (($this->skipVirtualTypeInit && $virtualType) || |
| 70 | - (!$object instanceof Proxy && !$object instanceof ORMProxy) |
|
| 70 | + ( ! $object instanceof Proxy && ! $object instanceof ORMProxy) |
|
| 71 | 71 | ) { |
| 72 | 72 | return; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | // do not initialize the proxy if is going to be excluded by-class by some exclusion strategy |
| 76 | - if ($this->initializeExcluded === false && !$virtualType) { |
|
| 76 | + if ($this->initializeExcluded === false && ! $virtualType) { |
|
| 77 | 77 | $context = $event->getContext(); |
| 78 | 78 | $exclusionStrategy = $context->getExclusionStrategy(); |
| 79 | 79 | if ($exclusionStrategy !== null && $exclusionStrategy->shouldSkipClass($context->getMetadataFactory()->getMetadataForClass(get_parent_class($object)), $context)) { |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | $object->__load(); |
| 85 | 85 | |
| 86 | - if (!$virtualType) { |
|
| 86 | + if ( ! $virtualType) { |
|
| 87 | 87 | $event->setType(get_parent_class($object)); |
| 88 | 88 | } |
| 89 | 89 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | { |
| 93 | 93 | $type = $event->getType(); |
| 94 | 94 | // is a virtual type? then there is no need to change the event name |
| 95 | - if (!class_exists($type['name'], false)) { |
|
| 95 | + if ( ! class_exists($type['name'], false)) { |
|
| 96 | 96 | return; |
| 97 | 97 | } |
| 98 | 98 | |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | |
| 50 | 50 | $validator = $this->validator; |
| 51 | 51 | $context->attributes->get('validation_groups')->map( |
| 52 | - function (array $groups) use ($event, $validator) { |
|
| 52 | + function(array $groups) use ($event, $validator) { |
|
| 53 | 53 | $list = $validator->validate($event->getObject(), $groups); |
| 54 | 54 | |
| 55 | 55 | if ($list->count() > 0) { |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | public static function getDefaultMethodName($eventName) |
| 37 | 37 | { |
| 38 | - return 'on' . str_replace(array('_', '.'), '', $eventName); |
|
| 38 | + return 'on'.str_replace(array('_', '.'), '', $eventName); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | /** |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | public function addSubscriber(EventSubscriberInterface $subscriber) |
| 59 | 59 | { |
| 60 | 60 | foreach ($subscriber->getSubscribedEvents() as $eventData) { |
| 61 | - if (!isset($eventData['event'])) { |
|
| 61 | + if ( ! isset($eventData['event'])) { |
|
| 62 | 62 | throw new InvalidArgumentException(sprintf('Each event must have a "event" key.')); |
| 63 | 63 | } |
| 64 | 64 | |
@@ -72,26 +72,26 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | public function hasListeners($eventName, $class, $format) |
| 74 | 74 | { |
| 75 | - if (!isset($this->listeners[$eventName])) { |
|
| 75 | + if ( ! isset($this->listeners[$eventName])) { |
|
| 76 | 76 | return false; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | $loweredClass = strtolower($class); |
| 80 | - if (!isset($this->classListeners[$eventName][$loweredClass][$format])) { |
|
| 80 | + if ( ! isset($this->classListeners[$eventName][$loweredClass][$format])) { |
|
| 81 | 81 | $this->classListeners[$eventName][$loweredClass][$format] = $this->initializeListeners($eventName, $loweredClass, $format); |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - return !!$this->classListeners[$eventName][$loweredClass][$format]; |
|
| 84 | + return ! ! $this->classListeners[$eventName][$loweredClass][$format]; |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | public function dispatch($eventName, $class, $format, Event $event) |
| 88 | 88 | { |
| 89 | - if (!isset($this->listeners[$eventName])) { |
|
| 89 | + if ( ! isset($this->listeners[$eventName])) { |
|
| 90 | 90 | return; |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | $loweredClass = strtolower($class); |
| 94 | - if (!isset($this->classListeners[$eventName][$loweredClass][$format])) { |
|
| 94 | + if ( ! isset($this->classListeners[$eventName][$loweredClass][$format])) { |
|
| 95 | 95 | $this->classListeners[$eventName][$loweredClass][$format] = $this->initializeListeners($eventName, $loweredClass, $format); |
| 96 | 96 | } |
| 97 | 97 | |
@@ -124,24 +124,24 @@ discard block |
||
| 124 | 124 | |
| 125 | 125 | if (null === $this->document) { |
| 126 | 126 | $this->document = $this->createDocument(null, null, true); |
| 127 | - $this->currentNode->appendChild($doCData ? $this->document->createCDATASection($data) : $this->document->createTextNode((string)$data)); |
|
| 127 | + $this->currentNode->appendChild($doCData ? $this->document->createCDATASection($data) : $this->document->createTextNode((string) $data)); |
|
| 128 | 128 | |
| 129 | 129 | return; |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - return $doCData ? $this->document->createCDATASection($data) : $this->document->createTextNode((string)$data); |
|
| 132 | + return $doCData ? $this->document->createCDATASection($data) : $this->document->createTextNode((string) $data); |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | public function visitSimpleString($data, array $type, Context $context) |
| 136 | 136 | { |
| 137 | 137 | if (null === $this->document) { |
| 138 | 138 | $this->document = $this->createDocument(null, null, true); |
| 139 | - $this->currentNode->appendChild($this->document->createTextNode((string)$data)); |
|
| 139 | + $this->currentNode->appendChild($this->document->createTextNode((string) $data)); |
|
| 140 | 140 | |
| 141 | 141 | return; |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - return $this->document->createTextNode((string)$data); |
|
| 144 | + return $this->document->createTextNode((string) $data); |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | public function visitBoolean($data, array $type, Context $context) |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | $this->setCurrentNode($entryNode); |
| 190 | 190 | |
| 191 | 191 | if (null !== $keyAttributeName) { |
| 192 | - $entryNode->setAttribute($keyAttributeName, (string)$k); |
|
| 192 | + $entryNode->setAttribute($keyAttributeName, (string) $k); |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | if (null !== $node = $this->navigator->accept($v, $this->getElementType($type), $context)) { |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | $node = $this->navigator->accept($v, $metadata->type, $context); |
| 242 | 242 | $this->revertCurrentMetadata(); |
| 243 | 243 | |
| 244 | - if (!$node instanceof \DOMCharacterData) { |
|
| 244 | + if ( ! $node instanceof \DOMCharacterData) { |
|
| 245 | 245 | throw new RuntimeException(sprintf('Unsupported value for XML attribute for %s. Expected character data, but got %s.', $metadata->name, json_encode($v))); |
| 246 | 246 | } |
| 247 | 247 | $attributeName = $this->namingStrategy->translateName($metadata); |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | if (($metadata->xmlValue && $this->currentNode->childNodes->length > 0) |
| 254 | - || (!$metadata->xmlValue && $this->hasValue) |
|
| 254 | + || ( ! $metadata->xmlValue && $this->hasValue) |
|
| 255 | 255 | ) { |
| 256 | 256 | throw new RuntimeException(sprintf('If you make use of @XmlValue, all other properties in the class must have the @XmlAttribute annotation. Invalid usage detected in class %s.', $metadata->class)); |
| 257 | 257 | } |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | $node = $this->navigator->accept($v, $metadata->type, $context); |
| 264 | 264 | $this->revertCurrentMetadata(); |
| 265 | 265 | |
| 266 | - if (!$node instanceof \DOMCharacterData) { |
|
| 266 | + if ( ! $node instanceof \DOMCharacterData) { |
|
| 267 | 267 | throw new RuntimeException(sprintf('Unsupported value for property %s::$%s. Expected character data, but got %s.', $metadata->reflection->class, $metadata->reflection->name, is_object($node) ? get_class($node) : gettype($node))); |
| 268 | 268 | } |
| 269 | 269 | |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | if ($metadata->xmlAttributeMap) { |
| 276 | - if (!is_array($v)) { |
|
| 276 | + if ( ! is_array($v)) { |
|
| 277 | 277 | throw new RuntimeException(sprintf('Unsupported value type for XML attribute map. Expected array but got %s.', gettype($v))); |
| 278 | 278 | } |
| 279 | 279 | |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | $node = $this->navigator->accept($value, null, $context); |
| 283 | 283 | $this->revertCurrentMetadata(); |
| 284 | 284 | |
| 285 | - if (!$node instanceof \DOMCharacterData) { |
|
| 285 | + if ( ! $node instanceof \DOMCharacterData) { |
|
| 286 | 286 | throw new RuntimeException(sprintf('Unsupported value for a XML attribute map value. Expected character data, but got %s.', json_encode($v))); |
| 287 | 287 | } |
| 288 | 288 | |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | return; |
| 293 | 293 | } |
| 294 | 294 | |
| 295 | - if ($addEnclosingElement = !$this->isInLineCollection($metadata) && !$metadata->inline) { |
|
| 295 | + if ($addEnclosingElement = ! $this->isInLineCollection($metadata) && ! $metadata->inline) { |
|
| 296 | 296 | $elementName = $this->namingStrategy->translateName($metadata); |
| 297 | 297 | |
| 298 | 298 | $namespace = null !== $metadata->xmlNamespace |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | |
| 336 | 336 | private function isSkippableEmptyObject($node, PropertyMetadata $metadata) |
| 337 | 337 | { |
| 338 | - return $node === null && !$metadata->xmlCollection && $metadata->skipWhenEmpty; |
|
| 338 | + return $node === null && ! $metadata->xmlCollection && $metadata->skipWhenEmpty; |
|
| 339 | 339 | } |
| 340 | 340 | |
| 341 | 341 | private function isSkippableCollection(PropertyMetadata $metadata) |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | |
| 346 | 346 | private function isElementEmpty(\DOMElement $element) |
| 347 | 347 | { |
| 348 | - return !$element->hasChildNodes() && !$element->hasAttributes(); |
|
| 348 | + return ! $element->hasChildNodes() && ! $element->hasAttributes(); |
|
| 349 | 349 | } |
| 350 | 350 | |
| 351 | 351 | public function endVisitingObject(ClassMetadata $metadata, $data, array $type, Context $context) |
@@ -424,12 +424,12 @@ discard block |
||
| 424 | 424 | { |
| 425 | 425 | if (null === $this->document) { |
| 426 | 426 | $this->document = $this->createDocument(null, null, true); |
| 427 | - $this->currentNode->appendChild($textNode = $this->document->createTextNode((string)$data)); |
|
| 427 | + $this->currentNode->appendChild($textNode = $this->document->createTextNode((string) $data)); |
|
| 428 | 428 | |
| 429 | 429 | return $textNode; |
| 430 | 430 | } |
| 431 | 431 | |
| 432 | - return $this->document->createTextNode((string)$data); |
|
| 432 | + return $this->document->createTextNode((string) $data); |
|
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | /** |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | |
| 447 | 447 | private function attachNullNamespace() |
| 448 | 448 | { |
| 449 | - if (!$this->nullWasVisited) { |
|
| 449 | + if ( ! $this->nullWasVisited) { |
|
| 450 | 450 | $this->document->documentElement->setAttributeNS( |
| 451 | 451 | 'http://www.w3.org/2000/xmlns/', |
| 452 | 452 | 'xmlns:xsi', |
@@ -467,7 +467,7 @@ discard block |
||
| 467 | 467 | foreach ($metadata->xmlNamespaces as $prefix => $uri) { |
| 468 | 468 | $attribute = 'xmlns'; |
| 469 | 469 | if ($prefix !== '') { |
| 470 | - $attribute .= ':' . $prefix; |
|
| 470 | + $attribute .= ':'.$prefix; |
|
| 471 | 471 | } elseif ($element->namespaceURI === $uri) { |
| 472 | 472 | continue; |
| 473 | 473 | } |
@@ -483,19 +483,19 @@ discard block |
||
| 483 | 483 | if ($this->currentNode->isDefaultNamespace($namespace)) { |
| 484 | 484 | return $this->document->createElementNS($namespace, $tagName); |
| 485 | 485 | } |
| 486 | - if (!($prefix = $this->currentNode->lookupPrefix($namespace)) && !($prefix = $this->document->lookupPrefix($namespace))) { |
|
| 487 | - $prefix = 'ns-' . substr(sha1($namespace), 0, 8); |
|
| 486 | + if ( ! ($prefix = $this->currentNode->lookupPrefix($namespace)) && ! ($prefix = $this->document->lookupPrefix($namespace))) { |
|
| 487 | + $prefix = 'ns-'.substr(sha1($namespace), 0, 8); |
|
| 488 | 488 | } |
| 489 | - return $this->document->createElementNS($namespace, $prefix . ':' . $tagName); |
|
| 489 | + return $this->document->createElementNS($namespace, $prefix.':'.$tagName); |
|
| 490 | 490 | } |
| 491 | 491 | |
| 492 | 492 | private function setAttributeOnNode(\DOMElement $node, $name, $value, $namespace = null) |
| 493 | 493 | { |
| 494 | 494 | if (null !== $namespace) { |
| 495 | - if (!$prefix = $node->lookupPrefix($namespace)) { |
|
| 496 | - $prefix = 'ns-' . substr(sha1($namespace), 0, 8); |
|
| 495 | + if ( ! $prefix = $node->lookupPrefix($namespace)) { |
|
| 496 | + $prefix = 'ns-'.substr(sha1($namespace), 0, 8); |
|
| 497 | 497 | } |
| 498 | - $node->setAttributeNS($namespace, $prefix . ':' . $name, $value); |
|
| 498 | + $node->setAttributeNS($namespace, $prefix.':'.$name, $value); |
|
| 499 | 499 | } else { |
| 500 | 500 | $node->setAttribute($name, $value); |
| 501 | 501 | } |
@@ -519,6 +519,6 @@ discard block |
||
| 519 | 519 | */ |
| 520 | 520 | public function setFormatOutput($formatOutput) |
| 521 | 521 | { |
| 522 | - $this->formatOutput = (boolean)$formatOutput; |
|
| 522 | + $this->formatOutput = (boolean) $formatOutput; |
|
| 523 | 523 | } |
| 524 | 524 | } |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | case 'resource': |
| 151 | 151 | $msg = 'Resources are not supported in serialized data.'; |
| 152 | 152 | if ($context instanceof SerializationContext && null !== $path = $context->getPath()) { |
| 153 | - $msg .= ' Path: ' . $path; |
|
| 153 | + $msg .= ' Path: '.$path; |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | throw new RuntimeException($msg); |
@@ -206,11 +206,11 @@ discard block |
||
| 206 | 206 | /** @var $metadata ClassMetadata */ |
| 207 | 207 | $metadata = $this->metadataFactory->getMetadataForClass($type['name']); |
| 208 | 208 | |
| 209 | - if ($metadata->usingExpression && !$this->expressionExclusionStrategy) { |
|
| 209 | + if ($metadata->usingExpression && ! $this->expressionExclusionStrategy) { |
|
| 210 | 210 | throw new ExpressionLanguageRequiredException("To use conditional exclude/expose in {$metadata->name} you must configure the expression language."); |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | - if ($context instanceof DeserializationContext && !empty($metadata->discriminatorMap) && $type['name'] === $metadata->discriminatorBaseClass) { |
|
| 213 | + if ($context instanceof DeserializationContext && ! empty($metadata->discriminatorMap) && $type['name'] === $metadata->discriminatorBaseClass) { |
|
| 214 | 214 | $metadata = $this->resolveMetadata($data, $metadata); |
| 215 | 215 | } |
| 216 | 216 | |
@@ -280,22 +280,22 @@ discard block |
||
| 280 | 280 | { |
| 281 | 281 | switch (true) { |
| 282 | 282 | case is_array($data) && isset($data[$metadata->discriminatorFieldName]): |
| 283 | - $typeValue = (string)$data[$metadata->discriminatorFieldName]; |
|
| 283 | + $typeValue = (string) $data[$metadata->discriminatorFieldName]; |
|
| 284 | 284 | break; |
| 285 | 285 | |
| 286 | 286 | // Check XML attribute for discriminatorFieldName |
| 287 | 287 | case is_object($data) && $metadata->xmlDiscriminatorAttribute && isset($data[$metadata->discriminatorFieldName]): |
| 288 | - $typeValue = (string)$data[$metadata->discriminatorFieldName]; |
|
| 288 | + $typeValue = (string) $data[$metadata->discriminatorFieldName]; |
|
| 289 | 289 | break; |
| 290 | 290 | |
| 291 | 291 | // Check XML element with namespace for discriminatorFieldName |
| 292 | - case is_object($data) && !$metadata->xmlDiscriminatorAttribute && null !== $metadata->xmlDiscriminatorNamespace && isset($data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}): |
|
| 293 | - $typeValue = (string)$data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}; |
|
| 292 | + case is_object($data) && ! $metadata->xmlDiscriminatorAttribute && null !== $metadata->xmlDiscriminatorNamespace && isset($data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}): |
|
| 293 | + $typeValue = (string) $data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}; |
|
| 294 | 294 | break; |
| 295 | 295 | |
| 296 | 296 | // Check XML element for discriminatorFieldName |
| 297 | 297 | case is_object($data) && isset($data->{$metadata->discriminatorFieldName}): |
| 298 | - $typeValue = (string)$data->{$metadata->discriminatorFieldName}; |
|
| 298 | + $typeValue = (string) $data->{$metadata->discriminatorFieldName}; |
|
| 299 | 299 | break; |
| 300 | 300 | |
| 301 | 301 | default: |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | )); |
| 307 | 307 | } |
| 308 | 308 | |
| 309 | - if (!isset($metadata->discriminatorMap[$typeValue])) { |
|
| 309 | + if ( ! isset($metadata->discriminatorMap[$typeValue])) { |
|
| 310 | 310 | throw new \LogicException(sprintf( |
| 311 | 311 | 'The type value "%s" does not exist in the discriminator map of class "%s". Available types: %s', |
| 312 | 312 | $typeValue, |