8000 [Form] Deprecate not configuring the `default_protocol` option of the… · symfony/symfony@21658fd · GitHub
[go: up one dir, main page]

Skip to content 8000

Commit 21658fd

Browse files
committed
[Form] Deprecate not configuring the default_protocol option of the UrlType
1 parent a2f75a2 commit 21658fd

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

UPGRADE-6.4.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Form
2929

3030
* Deprecate using `DateTime` or `DateTimeImmutable` model data with a different timezone than configured with the
3131
`model_timezone` option in `DateType`, `DateTimeType`, and `TimeType`
32+
* Deprecate not configuring the `default_protocol` option of the `UrlType`, it will default to `null` in 7.0
3233

3334
FrameworkBundle
3435
---------------

src/Symfony/Component/Form/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ CHANGELOG
66

77
* Deprecate using `DateTime` or `DateTimeImmutable` model data with a different timezone than configured with the
88
`model_timezone` option in `DateType`, `DateTimeType`, and `TimeType`
9+
* Deprecate not configuring the `default_protocol` option of the `UrlType`, it will default to `null` in 7.0
910

1011
6.3
1112
---

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Symfony\Component\Form\FormBuilderInterface;
1717
use Symfony\Component\Form\FormInterface;
1818
use Symfony\Component\Form\FormView;
19+
use Symfony\Component\OptionsResolver\Options;
1920
use Symfony\Component\OptionsResolver\OptionsResolver;
2021

2122
class UrlType extends AbstractType
@@ -47,7 +48,11 @@ public function buildView(FormView $view, FormInterface $form, array $options)
4748
public function configureOptions(OptionsResolver $resolver)
4849
{
4950
$resolver->setDefaults([
50-
'default_protocol' => 'http',
51+
'default_protocol' => static function (Options $options) {
52+
trigger_deprecation('symfony/form', '6.4', 'Not configuring the "default_protocol" option is deprecated. It will default to "null" in 7.0.');
53+
54+
return 'http';
55+
},
5156
'invalid_message' => 'Please enter a valid URL.',
5257
]);
5358

0 commit comments

Comments
 (0)
0