Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 748c37b

Browse files
add upgrade path for empty_data option in TextType
1 parent 2fe4442 commit 748c37b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/Symfony/Component/Form/Extension/Core/Type/TextType.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ public function buildForm(FormBuilderInterface $builder, array $options)
2727
// See https://github.com/symfony/symfony/issues/5906#issuecomment-203189375
2828
if ('' === $options['empty_data']) {
2929
$builder->addViewTransformer($this);
30+
} elseif ($options['empty_data'] instanceof \Closure) {
31+
// we assume that this is the default value from \Symfony\Component\Form\Extension\Core\Type\FormType::configureOptions()
32+
@trigger_error(sprintf('The default value of "empty_data" option in "%s" will be changed to empty string in Symfony 6.0. Declare "NULL" as value for "empty_data" if you stil want use "NULL" as data.', __CLASS__), \E_USER_DEPRECATED);
3033
}
3134
}
3235

0 commit comments

Comments
 (0)