You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
trigger deprecation warning when using empty_value
The `empty_value` option is deprecated in the `choice`, `date`, and
`time` form types. Therefore, a deprecation warning must be triggered
when the users configures a value for this option.
The `datetime` form type does not need to be updated as it passes
configured values to the `date` and `time` form types which trigger
deprecation warnings anyway.
Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php
+5-1Lines changed: 5 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -253,7 +253,11 @@ public function configureOptions(OptionsResolver $resolver)
253
253
};
254
254
255
255
// for BC with the "empty_value" option
256
-
$placeholder = function (Options$options) {
256
+
$placeholder = function (Options$options) use ($emptyValue) {
257
+
if ($emptyValue !== $options['empty_value']) {
258
+
@trigger_error('The form option "empty_value" is deprecated since version 2.6 and will be removed in 3.0. Use "placeholder" instead.', E_USER_DEPRECATED);
Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Core/Type/DateType.php
+5-1Lines changed: 5 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -179,7 +179,11 @@ public function configureOptions(OptionsResolver $resolver)
179
179
return$options['required'] ? null : '';
180
180
};
181
181
182
-
$placeholder = function (Options$options) {
182
+
$placeholder = function (Options$options) use ($emptyValue) {
183
+
if ($emptyValue !== $options['empty_value']) {
184
+
@trigger_error('The form option "empty_value" is deprecated since version 2.6 and will be removed in 3.0. Use "placeholder" instead.', E_USER_DEPRECATED);
Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Core/Type/TimeType.php
+5-1Lines changed: 5 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -168,7 +168,11 @@ public function configureOptions(OptionsResolver $resolver)
168
168
};
169
169
170
170
// for BC with the "empty_value" option
171
-
$placeholder = function (Options$options) {
171
+
$placeholder = function (Options$options) use ($emptyValue) {
172
+
if ($emptyValue !== $options['empty_value']) {
173
+
@trigger_error('The form option "empty_value" is deprecated since version 2.6 and will be removed in 3.0. Use "placeholder" instead.', E_USER_DEPRECATED);
0 commit comments