Skip to content

Commit

Permalink
Merge branch '6.4' into 7.0
Browse files Browse the repository at this point in the history
* 6.4:
  [DependencyInjection] Fix computing error messages involving service locators
  [Serializer] Fix unknown types normalization type when know type
  [ErrorHandler] Fix parsing messages that contain anonymous classes on PHP >= 8.3.3
  [AssetMapper] Fix enquoted string pattern
  [Validator] Review Romanian (ro) translations
  [Console] Fix display of Table on Windows OS
  [FrameworkBundle] Fix config builder with extensions extended in `build()`
  [Translation] Fix extracting qualified t() function calls
  Fix vertical table on windows
  Fix the `command -v` exception when the command option with a dash prefix
  [WebProfilerBundle] disable turbo in web profiler toolbar to avoid link prefetching
  explicitly cast boolean SSL stream options
  return the unchanged text if preg_replace_callback() fails
  the 'use_notify' option is on the factory, not on the postgres connection class
  review translations
  • Loading branch information
nicolas-grekas committed Feb 22, 2024
2 parents 6e83031 + 88da7f8 commit c71d61c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 7 additions & 1 deletion Normalizer/AbstractNormalizer.php
Expand Up @@ -377,10 +377,16 @@ protected function instantiateObject(array &$data, string $class, array &$contex
continue;
}

$constructorParameterType = 'unknown';
$reflectionType = $constructorParameter->getType();
if ($reflectionType instanceof \ReflectionNamedType) {
$constructorParameterType = $reflectionType->getName();
}

$exception = NotNormalizableValueException::createForUnexpectedDataType(
sprintf('Failed to create object because the class misses the "%s" property.', $constructorParameter->name),
$data,
['unknown'],
[$constructorParameterType],
$attributeContext['deserialization_path'] ?? null,
true
);
Expand Down
6 changes: 3 additions & 3 deletions Tests/SerializerTest.php
Expand Up @@ -1303,7 +1303,7 @@ public function testCollectDenormalizationErrorsWithConstructor(?ClassMetadataFa
[
'currentType' => 'array',
'expectedTypes' => [
'unknown',
'string',
],
'path' => 'string',
'useMessageForUser' => true,
Expand All @@ -1312,7 +1312,7 @@ public function testCollectDenormalizationErrorsWithConstructor(?ClassMetadataFa
[
'currentType' => 'array',
'expectedTypes' => [
'unknown',
'int',
],
'path' => 'int',
'useMessageForUser' => true,
Expand Down Expand Up @@ -1621,7 +1621,7 @@ public function testPartialDenormalizationWithMissingConstructorTypes()
[
'currentType' => 'array',
'expectedTypes' => [
'unknown',
'string',
],
'path' => 'two',
'useMessageForUser' => true,
Expand Down

0 comments on commit c71d61c

Please sign in to comment.