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

Appearance settings

Commit 19f91b0

Browse filesBrowse files
javaDeveloperKidnicolas-grekas
javaDeveloperKid
authored andcommitted
[Serializer] Add AbstractNormalizerContextBuilder::defaultConstructorArguments()
1 parent 6b3407d commit 19f91b0
Copy full SHA for 19f91b0

File tree

2 files changed

+12
-4
lines changed
Filter options

2 files changed

+12
-4
lines changed

‎src/Symfony/Component/Serializer/Context/Normalizer/AbstractNormalizerContextBuilder.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Serializer/Context/Normalizer/AbstractNormalizerContextBuilder.php
+11-3Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,17 +104,25 @@ public function withAllowExtraAttributes(?bool $allowExtraAttributes): static
104104
}
105105

106106
/**
107-
* Configures an hashmap of classes containing hashmaps of constructor argument => default value.
107+
* Configures a hashmap of classes containing hashmaps of constructor argument => default value.
108108
*
109109
* The names need to match the parameter names in the constructor arguments.
110110
*
111111
* Eg: [Foo::class => ['foo' => true, 'bar' => 0]]
112112
*
113-
* @param array<class-string, array<string, mixed>>|null $defaultContructorArguments
113+
* @param array<class-string, array<string, mixed>>|null $defaultConstructorArguments
114+
*/
115+
public function withDefaultConstructorArguments(?array $defaultConstructorArguments): static
116+
{
117+
return $this->with(AbstractNormalizer::DEFAULT_CONSTRUCTOR_ARGUMENTS, $defaultConstructorArguments);
118+
}
119+
120+
/**
121+
* Deprecated in Symfony 7.1, use withDefaultConstructorArguments() instead.
114122
*/
115123
public function withDefaultContructorArguments(?array $defaultContructorArguments): static
116124
{
117-
return $this->with(AbstractNormalizer::DEFAULT_CONSTRUCTOR_ARGUMENTS, $defaultContructorArguments);
125+
return self::withDefaultConstructorArguments($defaultContructorArguments);
118126
}
119127

120128
/**

‎src/Symfony/Component/Serializer/Tests/Context/Normalizer/AbstractNormalizerContextBuilderTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Serializer/Tests/Context/Normalizer/AbstractNormalizerContextBuilderTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function testWithers(array $values)
4141
->withGroups($values[AbstractNormalizer::GROUPS])
4242
->withAttributes($values[AbstractNormalizer::ATTRIBUTES])
4343
->withAllowExtraAttributes($values[AbstractNormalizer::ALLOW_EXTRA_ATTRIBUTES])
44-
->withDefaultContructorArguments($values[AbstractNormalizer::DEFAULT_CONSTRUCTOR_ARGUMENTS])
44+
->withDefaultConstructorArguments($values[AbstractNormalizer::DEFAULT_CONSTRUCTOR_ARGUMENTS])
4545
->withCallbacks($values[AbstractNormalizer::CALLBACKS])
4646
->withCircularReferenceHandler($values[AbstractNormalizer::CIRCULAR_REFERENCE_HANDLER])
4747
->withIgnoredAttributes($values[AbstractNormalizer::IGNORED_ATTRIBUTES])

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.