Skip to content

Commit 9ff5951

Browse files
Merge branch '5.0' into 5.1
* 5.0: [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 8620e1c + 9f39c46 commit 9ff5951

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

OptionsResolver.php

+1
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,7 @@ public function addNormalizer(string $option, \Closure $normalizer, bool $forceP
556556
}
557557

558558
if ($forcePrepend) {
559+
$this->normalizers[$option] = $this->normalizers[$option] ?? [];
559560
array_unshift($this->normalizers[$option], $normalizer);
560561
} else {
561562
$this->normalizers[$option][] = $normalizer;

Tests/OptionsResolverTest.php

+11
Original file line numberDiff line numberDiff line change
@@ -1512,6 +1512,17 @@ public function testForcePrependNormalizerClosure()
15121512
$this->assertEquals(['foo' => '2nd-normalized-1st-normalized-bar'], $this->resolver->resolve());
15131513
}
15141514

1515+
public function testForcePrependNormalizerForResolverWithoutPreviousNormalizers()
1516+
{
1517+
// defined by superclass
1518+
$this->resolver->setDefault('foo', 'bar');
1519+
$this->resolver->addNormalizer('foo', function (Options $options, $value) {
1520+
return '1st-normalized-'.$value;
1521+
}, true);
1522+
1523+
$this->assertEquals(['foo' => '1st-normalized-bar'], $this->resolver->resolve());
1524+
}
1525+
15151526
public function testAddNormalizerFailsIfUnknownOption()
15161527
{
15171528
$this->expectException('Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException');

0 commit comments

Comments
 (0)