Skip to content

Commit 26b9d6a

Browse files
javaDeveloperKidjavaDeveloperKid
authored andcommitted
fix typo in AbstractNormalizerContextBuilder::withDefaultContructorArguments()
1 parent c35173c commit 26b9d6a

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

src/Symfony/Component/Serializer/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ CHANGELOG
88
* Add `Default` and "class name" default groups
99
* Add `AbstractNormalizer::FILTER_BOOL` context option
1010
* Add `CamelCaseToSnakeCaseNameConverter::REQUIRE_SNAKE_CASE_PROPERTIES` context option
11+
* Deprecate `AbstractNormalizerContextBuilder::withDefaultContructorArguments(?array $defaultContructorArguments)`, use `withDefaultConstructorArguments(?array $defaultConstructorArguments)` instead (note the missing `s` character in Contructor word in deprecated method)
1112

1213
7.0
1314
---

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

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,17 +104,29 @@ public function withAllowExtraAttributes(?bool $allowExtraAttributes): static
104104
}
105105

106106
/**
107-
* Configures an hashmap of classes containing hashmaps of constructor argument => default value.
107+
* @deprecated since Symfony 7.1, use withDefaultConstructorArguments(?array $defaultConstructorArguments)" instead
108+
*
109+
* @param array<class-string, array<string, mixed>>|null $defaultContructorArguments
110+
*/
111+
public function withDefaultContructorArguments(?array $defaultContructorArguments): static
112+
{
113+
trigger_deprecation('symfony/serializer', '7.1', 'The "%s()" method is deprecated, use "withDefaultConstructorArguments(?array $defaultConstructorArguments)" instead.', __METHOD__);
114+
115+
return self::withDefaultConstructorArguments($defaultContructorArguments);
116+
}
117+
118+
/**
119+
* Configures a hashmap of classes containing hashmaps of constructor argument => default value.
108120
*
109121
* The names need to match the parameter names in the constructor arguments.
110122
*
111123
* Eg: [Foo::class => ['foo' => true, 'bar' => 0]]
112124
*
113-
* @param array<class-string, array<string, mixed>>|null $defaultContructorArguments
125+
* @param array<class-string, array<string, mixed>>|null $defaultConstructorArguments
114126
*/
115-
public function withDefaultContructorArguments(?array $defaultContructorArguments): static
127+
public function withDefaultConstructorArguments(?array $defaultConstructorArguments): static
116128
{
117-
return $this->with(AbstractNormalizer::DEFAULT_CONSTRUCTOR_ARGUMENTS, $defaultContructorArguments);
129+
return $this->with(AbstractNormalizer::DEFAULT_CONSTRUCTOR_ARGUMENTS, $defaultConstructorArguments);
118130
}
119131

120132
/**

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

Lines 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)