diff --git a/Context/Normalizer/AbstractNormalizerContextBuilder.php b/Context/Normalizer/AbstractNormalizerContextBuilder.php index ecb328dd6..f365ac8df 100644 --- a/Context/Normalizer/AbstractNormalizerContextBuilder.php +++ b/Context/Normalizer/AbstractNormalizerContextBuilder.php @@ -104,17 +104,25 @@ public function withAllowExtraAttributes(?bool $allowExtraAttributes): static } /** - * Configures an hashmap of classes containing hashmaps of constructor argument => default value. + * Configures a hashmap of classes containing hashmaps of constructor argument => default value. * * The names need to match the parameter names in the constructor arguments. * * Eg: [Foo::class => ['foo' => true, 'bar' => 0]] * - * @param array>|null $defaultContructorArguments + * @param array>|null $defaultConstructorArguments + */ + public function withDefaultConstructorArguments(?array $defaultConstructorArguments): static + { + return $this->with(AbstractNormalizer::DEFAULT_CONSTRUCTOR_ARGUMENTS, $defaultConstructorArguments); + } + + /** + * Deprecated in Symfony 7.1, use withDefaultConstructorArguments() instead. */ public function withDefaultContructorArguments(?array $defaultContructorArguments): static { - return $this->with(AbstractNormalizer::DEFAULT_CONSTRUCTOR_ARGUMENTS, $defaultContructorArguments); + return self::withDefaultConstructorArguments($defaultContructorArguments); } /** diff --git a/Tests/Context/Normalizer/AbstractNormalizerContextBuilderTest.php b/Tests/Context/Normalizer/AbstractNormalizerContextBuilderTest.php index 158fa8fea..4b8f0cc3f 100644 --- a/Tests/Context/Normalizer/AbstractNormalizerContextBuilderTest.php +++ b/Tests/Context/Normalizer/AbstractNormalizerContextBuilderTest.php @@ -41,7 +41,7 @@ public function testWithers(array $values) ->withGroups($values[AbstractNormalizer::GROUPS]) ->withAttributes($values[AbstractNormalizer::ATTRIBUTES]) ->withAllowExtraAttributes($values[AbstractNormalizer::ALLOW_EXTRA_ATTRIBUTES]) - ->withDefaultContructorArguments($values[AbstractNormalizer::DEFAULT_CONSTRUCTOR_ARGUMENTS]) + ->withDefaultConstructorArguments($values[AbstractNormalizer::DEFAULT_CONSTRUCTOR_ARGUMENTS]) ->withCallbacks($values[AbstractNormalizer::CALLBACKS]) ->withCircularReferenceHandler($values[AbstractNormalizer::CIRCULAR_REFERENCE_HANDLER]) ->withIgnoredAttributes($values[AbstractNormalizer::IGNORED_ATTRIBUTES])