Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Serializer] Fix CurrentType for missing property#54913

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
nicolas-grekas merged 1 commit intosymfony:5.4fromElisDN:fix_missing_property_
May 16, 2024
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -418,7 +418,7 @@ protected function instantiateObject(array &$data, string $class, array &$contex

$exception = NotNormalizableValueException::createForUnexpectedDataType(
sprintf('Failed to create object because the class misses the "%s" property.', $constructorParameter->name),
$data,
null,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Shouldn't this be$parameterData instead?

Copy link
ContributorAuthor

@ElisDNElisDNMay 15, 2024
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

There is$parameterData = $data[$key] statement in cases above. But in this case (with missing parameter) the$data[$key] value does not exist and$parameterData will be empty too.

xabbuh reacted with thumbs up emoji
[$constructorParameterType],
$context['deserialization_path'],
true
Expand Down
10 changes: 5 additions & 5 deletionssrc/Symfony/Component/Serializer/Tests/SerializerTest.php
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1045,7 +1045,7 @@ public function testCollectDenormalizationErrors(?ClassMetadataFactory $classMet
'message' => 'The type of the "string" attribute for class "Symfony\Component\Serializer\Tests\Fixtures\Php74Full" must be one of "string" ("null" given).',
],
[
'currentType' => 'array',
'currentType' => 'null',
'expectedTypes' => [
'unknown',
],
Expand DownExpand Up@@ -1306,7 +1306,7 @@ public function testCollectDenormalizationErrorsWithConstructor(?ClassMetadataFa
'message' => 'The type of the "bool" attribute for class "Symfony\\Component\\Serializer\\Tests\\Fixtures\\Php80WithPromotedTypedConstructor" must be one of "bool" ("string" given).',
],
[
'currentType' => 'array',
'currentType' => 'null',
'expectedTypes' => [
'string',
],
Expand All@@ -1315,7 +1315,7 @@ public function testCollectDenormalizationErrorsWithConstructor(?ClassMetadataFa
'message' => 'Failed to create object because the class misses the "string" property.',
],
[
'currentType' => 'array',
'currentType' => 'null',
'expectedTypes' => [
'int',
],
Expand DownExpand Up@@ -1420,7 +1420,7 @@ public function testCollectDenormalizationErrorsWithEnumConstructor()

$expected = [
[
'currentType' => 'array',
'currentType' => 'null',
'useMessageForUser' => true,
'message' => 'Failed to create object because the class misses the "get" property.',
],
Expand DownExpand Up@@ -1546,7 +1546,7 @@ public function testPartialDenormalizationWithMissingConstructorTypes()

$expected = [
[
'currentType' => 'array',
'currentType' => 'null',
'expectedTypes' => [
'string',
],
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp