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

Skip to content

Commit 94eb384

Browse files
committed
bug #14258 [Form] Cleanup deprecation notices (nicolas-grekas)
This PR was merged into the 2.7 branch. Discussion ---------- [Form] Cleanup deprecation notices | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - This uses the same technique used for FlattenException in HttpKernel that prevents repeated notices triggered by the constructor. Commits ------- 3f58862 [Form] Cleanup deprecation notices
2 parents 81bf910 + 3f58862 commit 94eb384

13 files changed

+55
-72
lines changed

src/Symfony/Component/Form/ChoiceList/View/ChoiceView.php

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,17 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace Symfony\Component\Form\ChoiceList\View;
13-
14-
use Symfony\Component\Form\Extension\Core\View\ChoiceView as LegacyChoiceView;
12+
namespace Symfony\Component\Form\Extension\Core\View;
1513

1614
/**
1715
* Represents a choice in templates.
1816
*
1917
* @author Bernhard Schussek <[email protected]>
18+
*
19+
* @deprecated since version 2.7, to be removed in 3.0.
20+
* Use {@link \Symfony\Component\Form\ChoiceList\View\ChoiceView} instead.
2021
*/
21-
class ChoiceView extends LegacyChoiceView
22+
class ChoiceView
2223
{
2324
/**
2425
* The label displayed to humans.
@@ -41,6 +42,32 @@ class ChoiceView extends LegacyChoiceView
4142
*/
4243
public $data;
4344

45+
/**
46+
* Creates a new ChoiceView.
47+
*
48+
* @param mixed $data The original choice.
49+
* @param string $value The view representation of the choice.
50+
* @param string $label The label displayed to humans.
51+
*/
52+
public function __construct($data, $value, $label)
53+
{
54+
$this->data = $data;
55+
$this->value = $value;
56+
$this->label = $label;
57+
}
58+
}
59+
60+
namespace Symfony\Component\Form\ChoiceList\View;
61+
62+
use Symfony\Component\Form\Extension\Core\View\ChoiceView as LegacyChoiceView;
63+
64+
/**
65+
* Represents a choice in templates.
66+
*
67+
* @author Bernhard Schussek <[email protected]>
68+
*/
69+
class ChoiceView extends LegacyChoiceView
70+
{
4471
/**
4572
* Additional attributes for the HTML tag.
4673
*
@@ -58,9 +85,8 @@ class ChoiceView extends LegacyChoiceView
5885
*/
5986
public function __construct($label, $value, $data, array $attr = array())
6087
{
61-
$this->label = $label;
62-
$this->value = $value;
63-
$this->data = $data;
88+
parent::__construct($data, $value, $label);
89+
6490
$this->attr = $attr;
6591
}
6692
}

src/Symfony/Component/Form/Extension/Core/ChoiceList/ChoiceList.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
*
3535
* @author Bernhard Schussek <[email protected]>
3636
*
37-
* @deprecated Deprecated since Symfony 2.7, to be removed in Symfony 3.0.
37+
* @deprecated since version 2.7, to be removed in 3.0.
3838
* Use {@link \Symfony\Component\Form\ChoiceList\ArrayChoiceList} instead.
3939
*/
4040
class ChoiceList implements ChoiceListInterface

src/Symfony/Component/Form/Extension/Core/ChoiceList/ChoiceListInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
*
2929
* @author Bernhard Schussek <[email protected]>
3030
*
31-
* @deprecated Deprecated since Symfony 2.7, to be removed in Symfony 3.0.
31+
* @deprecated since version 2.7, to be removed in 3.0.
3232
* Use {@link BaseChoiceListInterface} instead.
3333
*/
3434
interface ChoiceListInterface extends BaseChoiceListInterface

src/Symfony/Component/Form/Extension/Core/ChoiceList/LazyChoiceList.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@
2222
*
2323
* @author Bernhard Schussek <[email protected]>
2424
*
25-
* @deprecated Deprecated since Symfony 2.7, to be removed in Symfony 3.0.
26-
* Use {@link \Symfony\Component\Form\ChoiceList\LazyChoiceList}
27-
* instead.
25+
* @deprecated since version 2.7, to be removed in 3.0.
26+
* Use {@link \Symfony\Component\Form\ChoiceList\LazyChoiceList} instead.
2827
*/
2928
abstract class LazyChoiceList implements ChoiceListInterface
3029
{

src/Symfony/Component/Form/Extension/Core/ChoiceList/ObjectChoiceList.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,8 @@
3333
*
3434
* @author Bernhard Schussek <[email protected]>
3535
*
36-
* @deprecated Deprecated since Symfony 2.7, to be removed in Symfony 3.0.
37-
* Use {@link \Symfony\Component\Form\ChoiceList\ArrayChoiceList}
38-
* instead.
36+
* @deprecated since Symfony 2.7, to be removed in version 3.0.
37+
* Use {@link \Symfony\Component\Form\ChoiceList\ArrayChoiceList} instead.
3938
*/
4039
class ObjectChoiceList extends ChoiceList
4140
{

src/Symfony/Component/Form/Extension/Core/ChoiceList/SimpleChoiceList.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,8 @@
2929
*
3030
* @author Bernhard Schussek <[email protected]>
3131
*
32-
* @deprecated Deprecated since Symfony 2.7, to be removed in Symfony 3.0.
33-
* Use {@link \Symfony\Component\Form\ChoiceList\ArrayChoiceList}
34-
* instead.
32+
* @deprecated since version 2.7, to be removed in 3.0.
33+
* Use {@link \Symfony\Component\Form\ChoiceList\ArrayChoiceList} instead.
3534
*/
3635
class SimpleChoiceList extends ChoiceList
3736
{

src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoiceToBooleanArrayTransformer.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@
1818
/**
1919
* @author Bernhard Schussek <[email protected]>
2020
*
21-
* @deprecated Deprecated since Symfony 2.7, to be removed in Symfony 3.0.
22-
* Use {@link \Symfony\Component\Form\ChoiceList\LazyChoiceList}
23-
* instead.
21+
* @deprecated since version 2.7, to be removed in 3.0.
22+
* Use {@link \Symfony\Component\Form\ChoiceList\LazyChoiceList} instead.
2423
*/
2524
class ChoiceToBooleanArrayTransformer implements DataTransformerInterface
2625
{

src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoicesToBooleanArrayTransformer.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@
1818
/**
1919
* @author Bernhard Schussek <[email protected]>
2020
*
21-
* @deprecated Deprecated since Symfony 2.7, to be removed in Symfony 3.0.
22-
* Use {@link \Symfony\Component\Form\ChoiceList\LazyChoiceList}
23-
* instead.
21+
* @deprecated since version 2.7, to be removed in 3.0.
22+
* Use {@link \Symfony\Component\Form\ChoiceList\LazyChoiceList} instead.
2423
*/
2524
class ChoicesToBooleanArrayTransformer implements DataTransformerInterface
2625
{

src/Symfony/Component/Form/Extension/Core/EventListener/FixCheckboxInputListener.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@
2323
*
2424
* @author Bernhard Schussek <[email protected]>
2525
*
26-
* @deprecated Deprecated since Symfony 2.7, to be removed in Symfony 3.0.
27-
* Use {@link \Symfony\Component\Form\Extension\Core\DataMapper\CheckboxListMapper}
28-
* instead.
26+
* @deprecated since version 2.7, to be removed in 3.0.
27+
* Use {@link \Symfony\Component\Form\Extension\Core\DataMapper\CheckboxListMapper} instead.
2928
*/
3029
class FixCheckboxInputListener implements EventSubscriberInterface
3130
{

src/Symfony/Component/Form/Extension/Core/EventListener/FixRadioInputListener.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@
2222
*
2323
* @author Bernhard Schussek <[email protected]>
2424
*
25-
* @deprecated Deprecated since Symfony 2.7, to be removed in Symfony 3.0.
26-
* Use {@link \Symfony\Component\Form\Extension\Core\DataMapper\RadioListMapper}
27-
* instead.
25+
* @deprecated since version 2.7, to be removed in 3.0.
26+
* Use {@link \Symfony\Component\Form\Extension\Core\DataMapper\RadioListMapper} instead.
2827
*/
2928
class FixRadioInputListener implements EventSubscriberInterface
3029
{

src/Symfony/Component/Form/Extension/Core/View/ChoiceView.php

Lines changed: 4 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -11,50 +11,14 @@
1111

1212
namespace Symfony\Component\Form\Extension\Core\View;
1313

14+
trigger_error('The '.__NAMESPACE__.'\ChoiceView class is deprecated since version 2.7 and will be removed in 3.0. Use Symfony\Component\Form\ChoiceList\View\ChoiceView instead.', E_USER_DEPRECATED);
15+
1416
/**
1517
* Represents a choice in templates.
1618
*
1719
* @author Bernhard Schussek <[email protected]>
1820
*
19-
* @deprecated Deprecated since Symfony 2.7, to be removed in Symfony 3.0.
21+
* @deprecated since version 2.7, to be removed in 3.0.
2022
* Use {@link \Symfony\Component\Form\ChoiceList\View\ChoiceView} instead.
2123
*/
22-
class ChoiceView
23-
{
24-
/**
25-
* The original choice value.
26-
*
27-
* @var mixed
28-
*/
29-
public $data;
30-
31-
/**
32-
* The view representation of the choice.
33-
*
34-
* @var string
35-
*/
36-
public $value;
37-
38-
/**
39-
* The label displayed to humans.
40-
*
41-
* @var string
42-
*/
43-
public $label;
44-
45-
/**
46-
* Creates a new ChoiceView.
47-
*
48-
* @param mixed $data The original choice.
49-
* @param string $value The view representation of the choice.
50-
* @param string $label The label displayed to humans.
51-
*/
52-
public function __construct($data, $value, $label)
53-
{
54-
$this->data = $data;
55-
$this->value = $value;
56-
$this->label = $label;
57-
58-
trigger_error('The '.__CLASS__.' class is deprecated since version 2.7 and will be removed in 3.0. Use Symfony\Component\Form\ChoiceList\View\ChoiceView instead.', E_USER_DEPRECATED);
59-
}
60-
}
24+
class_exists('Symfony\Component\Form\ChoiceList\View\ChoiceView');

src/Symfony/Component/Form/FormTypeExtensionInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function finishView(FormView $view, FormInterface $form, array $options);
6464
*
6565
* @param OptionsResolverInterface $resolver The resolver for the options.
6666
*
67-
* @deprecated Deprecated since Symfony 2.7, to be removed in Symfony 3.0.
67+
* @deprecated since version 2.7, to be removed in 3.0.
6868
* Use the method configureOptions instead. This method will be
6969
* added to the FormTypeExtensionInterface with Symfony 3.0
7070
*/

src/Symfony/Component/Form/FormTypeInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function finishView(FormView $view, FormInterface $form, array $options);
7373
*
7474
* @param OptionsResolverInterface $resolver The resolver for the options.
7575
*
76-
* @deprecated Deprecated since Symfony 2.7, to be renamed in Symfony 3.0.
76+
* @deprecated since version 2.7, to be renamed in 3.0.
7777
* Use the method configureOptions instead. This method will be
7878
* added to the FormTypeInterface with Symfony 3.0.
7979
*/

0 commit comments

Comments
 (0)