Skip to content

Commit c71d61c

Browse files
Merge branch '6.4' into 7.0
* 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
2 parents 6e83031 + 88da7f8 commit c71d61c

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

Normalizer/AbstractNormalizer.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,10 +377,16 @@ protected function instantiateObject(array &$data, string $class, array &$contex
377377
continue;
378378
}
379379

380+
$constructorParameterType = 'unknown';
381+
$reflectionType = $constructorParameter->getType();
382+
if ($reflectionType instanceof \ReflectionNamedType) {
383+
$constructorParameterType = $reflectionType->getName();
384+
}
385+
380386
$exception = NotNormalizableValueException::createForUnexpectedDataType(
381387
sprintf('Failed to create object because the class misses the "%s" property.', $constructorParameter->name),
382388
$data,
383-
['unknown'],
389+
[$constructorParameterType],
384390
$attributeContext['deserialization_path'] ?? null,
385391
true
386392
);

Tests/SerializerTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1303,7 +1303,7 @@ public function testCollectDenormalizationErrorsWithConstructor(?ClassMetadataFa
13031303
[
13041304
'currentType' => 'array',
13051305
'expectedTypes' => [
1306-
'unknown',
1306+
'string',
13071307
],
13081308
'path' => 'string',
13091309
'useMessageForUser' => true,
@@ -1312,7 +1312,7 @@ public function testCollectDenormalizationErrorsWithConstructor(?ClassMetadataFa
13121312
[
13131313
'currentType' => 'array',
13141314
'expectedTypes' => [
1315-
'unknown',
1315+
'int',
13161316
],
13171317
'path' => 'int',
13181318
'useMessageForUser' => true,
@@ -1621,7 +1621,7 @@ public function testPartialDenormalizationWithMissingConstructorTypes()
16211621
[
16221622
'currentType' => 'array',
16231623
'expectedTypes' => [
1624-
'unknown',
1624+
'string',
16251625
],
16261626
'path' => 'two',
16271627
'useMessageForUser' => true,

0 commit comments

Comments
 (0)