Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0dc4d3b

Browse files
committed
feature#41743 [Form] remove remaining deprecation layers (xabbuh)
This PR was merged into the 6.0 branch.Discussion----------[Form] remove remaining deprecation layers| Q | A| ------------- | ---| Branch? | 6.0| Bug fix? | no| New feature? | no| Deprecations? | no| Tickets || License | MIT| Doc PR |Commits-------b0bb650 remove remaining deprecation layers
2 parents90b9ddf +b0bb650 commit0dc4d3b

File tree

73 files changed

+55
-725
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+55
-725
lines changed

‎src/Symfony/Component/Form/ChoiceList/Factory/CachingFactoryDecorator.php‎

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,8 @@ public function getDecoratedFactory()
8989
* @param callable|Cache\ChoiceFilter|null $filter The callable or static option for
9090
* filtering the choices
9191
*/
92-
publicfunctioncreateListFromChoices(iterable$choices,$value =null/*, $filter = null*/)
92+
publicfunctioncreateListFromChoices(iterable$choices,$value =null,$filter =null)
9393
{
94-
$filter =\func_num_args() >2 ?func_get_arg(2) :null;
95-
9694
if ($choicesinstanceof \Traversable) {
9795
$choices =iterator_to_array($choices);
9896
}
@@ -134,10 +132,8 @@ public function createListFromChoices(iterable $choices, $value = null/*, $filte
134132
* @param callable|Cache\ChoiceFilter|null $filter The callable or static option for
135133
* filtering the choices
136134
*/
137-
publicfunctioncreateListFromLoader(ChoiceLoaderInterface$loader,$value =null/*, $filter = null*/)
135+
publicfunctioncreateListFromLoader(ChoiceLoaderInterface$loader,$value =null,$filter =null)
138136
{
139-
$filter =\func_num_args() >2 ?func_get_arg(2) :null;
140-
141137
$cache =true;
142138

143139
if ($loaderinstanceofCache\ChoiceLoader) {
@@ -181,9 +177,8 @@ public function createListFromLoader(ChoiceLoaderInterface $loader, $value = nul
181177
* @param array|callable|Cache\ChoiceAttr|null $attr The option or static option generating the HTML attributes
182178
* @param array|callable|Cache\ChoiceTranslationParameters $labelTranslationParameters The parameters used to translate the choice labels
183179
*/
184-
publicfunctioncreateView(ChoiceListInterface$list,$preferredChoices =null,$label =null,$index =null,$groupBy =null,$attr =null/*, $labelTranslationParameters = []*/)
180+
publicfunctioncreateView(ChoiceListInterface$list,$preferredChoices =null,$label =null,$index =null,$groupBy =null,$attr =null,$labelTranslationParameters = [])
185181
{
186-
$labelTranslationParameters =\func_num_args() >6 ?func_get_arg(6) : [];
187182
$cache =true;
188183

189184
if ($preferredChoicesinstanceofCache\PreferredChoice) {

‎src/Symfony/Component/Form/ChoiceList/Factory/ChoiceListFactoryInterface.php‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ interface ChoiceListFactoryInterface
3535
*
3636
* @return ChoiceListInterface The choice list
3737
*/
38-
publicfunctioncreateListFromChoices(iterable$choices,callable$value =null/*, callable $filter = null*/);
38+
publicfunctioncreateListFromChoices(iterable$choices,callable$value =null,callable$filter =null);
3939

4040
/**
4141
* Creates a choice list that is loaded with the given loader.
@@ -48,7 +48,7 @@ public function createListFromChoices(iterable $choices, callable $value = null/
4848
*
4949
* @return ChoiceListInterface The choice list
5050
*/
51-
publicfunctioncreateListFromLoader(ChoiceLoaderInterface$loader,callable$value =null/*, callable $filter = null*/);
51+
publicfunctioncreateListFromLoader(ChoiceLoaderInterface$loader,callable$value =null,callable$filter =null);
5252

5353
/**
5454
* Creates a view for the given choice list.
@@ -84,5 +84,5 @@ public function createListFromLoader(ChoiceLoaderInterface $loader, callable $va
8484
*
8585
* @return ChoiceListView The choice list view
8686
*/
87-
publicfunctioncreateView(ChoiceListInterface$list,$preferredChoices =null,$label =null,callable$index =null,callable$groupBy =null,$attr =null/*, $labelTranslationParameters = []*/);
87+
publicfunctioncreateView(ChoiceListInterface$list,$preferredChoices =null,$label =null,callable$index =null,callable$groupBy =null,$attr =null,$labelTranslationParameters = []);
8888
}

‎src/Symfony/Component/Form/ChoiceList/Factory/DefaultChoiceListFactory.php‎

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,9 @@ class DefaultChoiceListFactory implements ChoiceListFactoryInterface
3232
{
3333
/**
3434
* {@inheritdoc}
35-
*
36-
* @param callable|null $filter
3735
*/
38-
publicfunctioncreateListFromChoices(iterable$choices,callable$value =null/*, callable $filter = null*/)
36+
publicfunctioncreateListFromChoices(iterable$choices,callable$value =null,callable$filter =null)
3937
{
40-
$filter =\func_num_args() >2 ?func_get_arg(2) :null;
41-
4238
if ($filter) {
4339
// filter the choice list lazily
4440
return$this->createListFromLoader(newFilterChoiceLoaderDecorator(
@@ -53,13 +49,9 @@ public function createListFromChoices(iterable $choices, callable $value = null/
5349

5450
/**
5551
* {@inheritdoc}
56-
*
57-
* @param callable|null $filter
5852
*/
59-
publicfunctioncreateListFromLoader(ChoiceLoaderInterface$loader,callable$value =null/*, callable $filter = null*/)
53+
publicfunctioncreateListFromLoader(ChoiceLoaderInterface$loader,callable$value =null,callable$filter =null)
6054
{
61-
$filter =\func_num_args() >2 ?func_get_arg(2) :null;
62-
6355
if ($filter) {
6456
$loader =newFilterChoiceLoaderDecorator($loader,$filter);
6557
}
@@ -72,9 +64,8 @@ public function createListFromLoader(ChoiceLoaderInterface $loader, callable $va
7264
*
7365
* @param array|callable $labelTranslationParameters The parameters used to translate the choice labels
7466
*/
75-
publicfunctioncreateView(ChoiceListInterface$list,$preferredChoices =null,$label =null,callable$index =null,callable$groupBy =null,$attr =null/*, $labelTranslationParameters = []*/)
67+
publicfunctioncreateView(ChoiceListInterface$list,$preferredChoices =null,$label =null,callable$index =null,callable$groupBy =null,$attr =null,$labelTranslationParameters = [])
7668
{
77-
$labelTranslationParameters =\func_num_args() >6 ?func_get_arg(6) : [];
7869
$preferredViews = [];
7970
$preferredViewsOrder = [];
8071
$otherViews = [];

‎src/Symfony/Component/Form/ChoiceList/Factory/PropertyAccessDecorator.php‎

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,8 @@ public function getDecoratedFactory()
6666
*
6767
* @return ChoiceListInterface The choice list
6868
*/
69-
publicfunctioncreateListFromChoices(iterable$choices,$value =null/*, $filter = null*/)
69+
publicfunctioncreateListFromChoices(iterable$choices,$value =null,$filter =null)
7070
{
71-
$filter =\func_num_args() >2 ?func_get_arg(2) :null;
72-
7371
if (\is_string($value)) {
7472
$value =newPropertyPath($value);
7573
}
@@ -109,10 +107,8 @@ public function createListFromChoices(iterable $choices, $value = null/*, $filte
109107
*
110108
* @return ChoiceListInterface The choice list
111109
*/
112-
publicfunctioncreateListFromLoader(ChoiceLoaderInterface$loader,$value =null/*, $filter = null*/)
110+
publicfunctioncreateListFromLoader(ChoiceLoaderInterface$loader,$value =null,$filter =null)
113111
{
114-
$filter =\func_num_args() >2 ?func_get_arg(2) :null;
115-
116112
if (\is_string($value)) {
117113
$value =newPropertyPath($value);
118114
}
@@ -154,9 +150,8 @@ public function createListFromLoader(ChoiceLoaderInterface $loader, $value = nul
154150
*
155151
* @return ChoiceListView The choice list view
156152
*/
157-
publicfunctioncreateView(ChoiceListInterface$list,$preferredChoices =null,$label =null,$index =null,$groupBy =null,$attr =null/*, $labelTranslationParameters = []*/)
153+
publicfunctioncreateView(ChoiceListInterface$list,$preferredChoices =null,$label =null,$index =null,$groupBy =null,$attr =null,$labelTranslationParameters = [])
158154
{
159-
$labelTranslationParameters =\func_num_args() >6 ?func_get_arg(6) : [];
160155
$accessor =$this->propertyAccessor;
161156

162157
if (\is_string($label)) {

‎src/Symfony/Component/Form/Extension/Core/DataMapper/RadioListMapper.php‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ class RadioListMapper implements DataMapperInterface
3030
*/
3131
publicfunctionmapDataToForms($choice,\Traversable$radios)
3232
{
33-
if (\is_array($radios)) {
34-
trigger_deprecation('symfony/form','5.3','Passing an array as the second argument of the "%s()" method is deprecated, pass "\Traversable" instead.',__METHOD__);
35-
}
36-
3733
if (!\is_string($choice)) {
3834
thrownewUnexpectedTypeException($choice,'string');
3935
}

‎src/Symfony/Component/Form/Extension/Core/DataTransformer/PercentToLocalizedStringTransformer.php‎

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ class PercentToLocalizedStringTransformer implements DataTransformerInterface
3939
/**
4040
* @see self::$types for a list of supported types
4141
*
42-
* @param int$scale The scale
43-
* @param string$type One of the supported types
44-
* @param int|null $roundingMode A value from \NumberFormatter, such as \NumberFormatter::ROUND_HALFUP
45-
* @param bool$html5Format Use an HTML5 specific format, see https://www.w3.org/TR/html51/sec-forms.html#date-time-and-number-formats
42+
* @param int $scale The scale
43+
* @param string $type One of the supported types
44+
* @param int $roundingMode A value from \NumberFormatter, such as \NumberFormatter::ROUND_HALFUP
45+
* @param bool $html5Format Use an HTML5 specific format, see https://www.w3.org/TR/html51/sec-forms.html#date-time-and-number-formats
4646
*
4747
* @throws UnexpectedTypeException if the given value of type is unknown
4848
*/
49-
publicfunction__construct(int$scale =null,string$type =null,?int$roundingMode =null,bool$html5Format =false)
49+
publicfunction__construct(int$scale =null,string$type =null,int$roundingMode =\NumberFormatter::ROUND_HALFUP,bool$html5Format =false)
5050
{
5151
if (null ===$scale) {
5252
$scale =0;
@@ -56,10 +56,6 @@ public function __construct(int $scale = null, string $type = null, ?int $roundi
5656
$type =self::FRACTIONAL;
5757
}
5858

59-
if (null ===$roundingMode && (\func_num_args() <4 ||func_get_arg(3))) {
60-
trigger_deprecation('symfony/form','5.1','Not passing a rounding mode to "%s()" is deprecated. Starting with Symfony 6.0 it will default to "\NumberFormatter::ROUND_HALFUP".',__METHOD__);
61-
}
62-
6359
if (!\in_array($type,self::$types,true)) {
6460
thrownewUnexpectedTypeException($type,implode('", "',self::$types));
6561
}

‎src/Symfony/Component/Form/Extension/Core/Type/BirthdayType.php‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespaceSymfony\Component\Form\Extension\Core\Type;
1313

1414
useSymfony\Component\Form\AbstractType;
15-
useSymfony\Component\OptionsResolver\Options;
1615
useSymfony\Component\OptionsResolver\OptionsResolver;
1716

1817
class BirthdayTypeextends AbstractType
@@ -24,11 +23,7 @@ public function configureOptions(OptionsResolver $resolver)
2423
{
2524
$resolver->setDefaults([
2625
'years' =>range((int)date('Y') -120,date('Y')),
27-
'invalid_message' =>function (Options$options,$previousValue) {
28-
return ($options['legacy_error_messages'] ??true)
29-
?$previousValue
30-
:'Please enter a valid birthdate.';
31-
},
26+
'invalid_message' =>'Please enter a valid birthdate.',
3227
]);
3328

3429
$resolver->setAllowedTypes('years','array');

‎src/Symfony/Component/Form/Extension/Core/Type/CheckboxType.php‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
useSymfony\Component\Form\FormBuilderInterface;
1717
useSymfony\Component\Form\FormInterface;
1818
useSymfony\Component\Form\FormView;
19-
useSymfony\Component\OptionsResolver\Options;
2019
useSymfony\Component\OptionsResolver\OptionsResolver;
2120

2221
class CheckboxTypeextends AbstractType
@@ -61,11 +60,7 @@ public function configureOptions(OptionsResolver $resolver)
6160
'empty_data' =>$emptyData,
6261
'compound' =>false,
6362
'false_values' => [null],
64-
'invalid_message' =>function (Options$options,$previousValue) {
65-
return ($options['legacy_error_messages'] ??true)
66-
?$previousValue
67-
:'The checkbox has an invalid value.';
68-
},
63+
'invalid_message' =>'The checkbox has an invalid value.',
6964
'is_empty_callback' =>staticfunction ($modelData):bool {
7065
returnfalse ===$modelData;
7166
},

‎src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php‎

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -52,31 +52,13 @@ class ChoiceType extends AbstractType
5252
private$choiceListFactory;
5353
private$translator;
5454

55-
/**
56-
* @param TranslatorInterface $translator
57-
*/
58-
publicfunction__construct(ChoiceListFactoryInterface$choiceListFactory =null,$translator =null)
55+
publicfunction__construct(ChoiceListFactoryInterface$choiceListFactory =null,TranslatorInterface$translator =null)
5956
{
6057
$this->choiceListFactory =$choiceListFactory ??newCachingFactoryDecorator(
6158
newPropertyAccessDecorator(
6259
newDefaultChoiceListFactory()
6360
)
6461
);
65-
66-
// BC, to be removed in 6.0
67-
if ($this->choiceListFactoryinstanceof CachingFactoryDecorator) {
68-
return;
69-
}
70-
71-
$ref =new \ReflectionMethod($this->choiceListFactory,'createListFromChoices');
72-
73-
if ($ref->getNumberOfParameters() <3) {
74-
trigger_deprecation('symfony/form','5.1','Not defining a third parameter "callable|null $filter" in "%s::%s()" is deprecated.',$ref->class,$ref->name);
75-
}
76-
77-
if (null !==$translator && !$translatorinstanceof TranslatorInterface) {
78-
thrownew \TypeError(sprintf('Argument 2 passed to "%s()" must be han instance of "%s", "%s" given.',__METHOD__, TranslatorInterface::class,\is_object($translator) ?\get_class($translator) :\gettype($translator)));
79-
}
8062
$this->translator =$translator;
8163
}
8264

@@ -390,11 +372,7 @@ public function configureOptions(OptionsResolver $resolver)
390372
'data_class' =>null,
391373
'choice_translation_domain' =>true,
392374
'trim' =>false,
393-
'invalid_message' =>function (Options$options,$previousValue) {
394-
return ($options['legacy_error_messages'] ??true)
395-
?$previousValue
396-
:'The selected choice is invalid.';
397-
},
375+
'invalid_message' =>'The selected choice is invalid.',
398376
]);
399377

400378
$resolver->setNormalizer('placeholder',$placeholderNormalizer);

‎src/Symfony/Component/Form/Extension/Core/Type/CollectionType.php‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,7 @@ public function configureOptions(OptionsResolver $resolver)
121121
'entry_type' => TextType::class,
122122
'entry_options' => [],
123123
'delete_empty' =>false,
124-
'invalid_message' =>function (Options$options,$previousValue) {
125-
return ($options['legacy_error_messages'] ??true)
126-
?$previousValue
127-
:'The collection is invalid.';
128-
},
124+
'invalid_message' =>'The collection is invalid.',
129125
]);
130126

131127
$resolver->setNormalizer('entry_options',$entryOptionsNormalizer);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp