Skip to content

Commit 9f39c46

Browse files
Merge branch '4.4' into 5.0
* 4.4: [Cache] Use the default expiry when saving (not when creating) items Fix typo Fix DBAL deprecation [Form] Fix ChoiceType translation domain Add Tagalog translations for new form messages [Form] Add missing vietnamese translations sync translations from master [OptionsResolver] Fix force prepend normalizer add vietnamese translation for html5 color validation
2 parents 60bce23 + 376bd3a commit 9f39c46

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

OptionsResolver.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,7 @@ public function addNormalizer(string $option, \Closure $normalizer, bool $forceP
532532
}
533533

534534
if ($forcePrepend) {
535+
$this->normalizers[$option] = $this->normalizers[$option] ?? [];
535536
array_unshift($this->normalizers[$option], $normalizer);
536537
} else {
537538
$this->normalizers[$option][] = $normalizer;

Tests/OptionsResolverTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,6 +1506,17 @@ public function testForcePrependNormalizerClosure()
15061506
$this->assertEquals(['foo' => '2nd-normalized-1st-normalized-bar'], $this->resolver->resolve());
15071507
}
15081508

1509+
public function testForcePrependNormalizerForResolverWithoutPreviousNormalizers()
1510+
{
1511+
// defined by superclass
1512+
$this->resolver->setDefault('foo', 'bar');
1513+
$this->resolver->addNormalizer('foo', function (Options $options, $value) {
1514+
return '1st-normalized-'.$value;
1515+
}, true);
1516+
1517+
$this->assertEquals(['foo' => '1st-normalized-bar'], $this->resolver->resolve());
1518+
}
1519+
15091520
public function testAddNormalizerFailsIfUnknownOption()
15101521
{
15111522
$this->expectException('Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException');

0 commit comments

Comments
 (0)