Skip to content

Commit

Permalink
Merge branch '4.4' into 5.0
Browse files Browse the repository at this point in the history
* 4.4: (27 commits)
  [Serializer] minor cleanup
  fix merge
  Run PHP 8 as 7.4.99
  Remove calls to deprecated ReflectionParameter::getClass().
  [VarDumper] fix PHP 8 support
  Add php 8 to travis.
  [Cache] Accessing undefined constants raises an Error in php8
  [Cache] allow DBAL v3
  Skip Doctrine DBAL on php 8 until we have a compatible version.
  [DomCrawler] Catch expected ValueError.
  Made method signatures compatible with their corresponding traits.
  [ErrorHandler] Apply php8 fixes from Debug component.
  [DomCrawler] Catch expected ValueError.
  [Validator] Catch expected ValueError.
  [VarDumper] ReflectionFunction::isDisabled() is deprecated.
  [BrowserKit] Raw body with custom Content-Type header
  [PropertyAccess] Parse php 8 TypeErrors correctly.
  [Intl] Fix call to ReflectionProperty::getValue() for static properties.
  [HttpKernel] Prevent calling method_exists() with non-string values.
  Fix wrong roles comparison
  ...
  • Loading branch information
nicolas-grekas committed May 23, 2020
2 parents 2148817 + 471c0b3 commit d324206
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions Normalizer/AbstractNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -404,16 +404,10 @@ protected function instantiateObject(array &$data, string $class, array &$contex
protected function denormalizeParameter(\ReflectionClass $class, \ReflectionParameter $parameter, string $parameterName, $parameterData, array $context, string $format = null)
{
try {
if (\PHP_VERSION_ID < 70100 && null !== $parameterClass = $parameter->getClass()) {
$parameterClass = $parameterClass->name;
} elseif (\PHP_VERSION_ID >= 70100 && $parameter->hasType() && ($parameterType = $parameter->getType()) && !$parameterType->isBuiltin()) {
if (($parameterType = $parameter->getType()) && !$parameterType->isBuiltin()) {
$parameterClass = $parameterType->getName();
new \ReflectionClass($parameterClass); // throws a \ReflectionException if the class doesn't exist
} else {
$parameterClass = null;
}

if (null !== $parameterClass) {
if (!$this->serializer instanceof DenormalizerInterface) {
throw new LogicException(sprintf('Cannot create an instance of "%s" from serialized data because the serializer inject in "%s" is not a denormalizer.', $parameterClass, static::class));
}
Expand Down

0 comments on commit d324206

Please sign in to comment.