Mercurial > hg > isophonics-drupal-site
diff vendor/symfony/serializer/Normalizer/AbstractNormalizer.php @ 16:c2387f117808
Routine composer update
author | Chris Cannam |
---|---|
date | Tue, 10 Jul 2018 15:07:59 +0100 |
parents | 1fec387a4317 |
children | 129ea1e6d783 |
line wrap: on
line diff
--- a/vendor/symfony/serializer/Normalizer/AbstractNormalizer.php Thu Apr 26 11:26:54 2018 +0100 +++ b/vendor/symfony/serializer/Normalizer/AbstractNormalizer.php Tue Jul 10 15:07:59 2018 +0100 @@ -200,11 +200,17 @@ * @param array $context * @param bool $attributesAsString If false, return an array of {@link AttributeMetadataInterface} * + * @throws LogicException if the 'allow_extra_attributes' context variable is false and no class metadata factory is provided + * * @return string[]|AttributeMetadataInterface[]|bool */ protected function getAllowedAttributes($classOrObject, array $context, $attributesAsString = false) { if (!$this->classMetadataFactory) { + if (isset($context[static::ALLOW_EXTRA_ATTRIBUTES]) && !$context[static::ALLOW_EXTRA_ATTRIBUTES]) { + throw new LogicException(sprintf('A class metadata factory must be provided in the constructor when setting "%s" to false.', static::ALLOW_EXTRA_ATTRIBUTES)); + } + return false; } @@ -349,6 +355,12 @@ } } elseif ($allowed && !$ignored && (isset($data[$key]) || array_key_exists($key, $data))) { $parameterData = $data[$key]; + if (null === $parameterData && $constructorParameter->allowsNull()) { + $params[] = null; + // Don't run set for a parameter passed to the constructor + unset($data[$key]); + continue; + } try { if (null !== $constructorParameter->getClass()) { if (!$this->serializer instanceof DenormalizerInterface) {