diff --git a/UPGRADE-5.1.md b/UPGRADE-5.1.md index 64dba4d81e73f..2436c700141a8 100644 --- a/UPGRADE-5.1.md +++ b/UPGRADE-5.1.md @@ -43,6 +43,7 @@ Form * Implementing the `FormConfigBuilderInterface` without implementing the `setIsEmptyCallback()` method is deprecated. The method will be added to the interface in 6.0. * Added argument `callable|null $filter` to `ChoiceListFactoryInterface::createListFromChoices()` and `createListFromLoader()` - not defining them is deprecated. + * Using `Symfony\Component\Form\Extension\Validator\Util\ServerParams` class is deprecated, use its parent `Symfony\Component\Form\Util\ServerParams` instead. FrameworkBundle --------------- diff --git a/UPGRADE-6.0.md b/UPGRADE-6.0.md index 9dedb88b08395..b6717866e3432 100644 --- a/UPGRADE-6.0.md +++ b/UPGRADE-6.0.md @@ -41,6 +41,7 @@ Form * Added the `getIsEmptyCallback()` method to the `FormConfigInterface`. * Added the `setIsEmptyCallback()` method to the `FormConfigBuilderInterface`. * Added argument `callable|null $filter` to `ChoiceListFactoryInterface::createListFromChoices()` and `createListFromLoader()`. + * The `Symfony\Component\Form\Extension\Validator\Util\ServerParams` class has been removed, use its parent `Symfony\Component\Form\Util\ServerParams` instead. FrameworkBundle --------------- diff --git a/src/Symfony/Component/Form/CHANGELOG.md b/src/Symfony/Component/Form/CHANGELOG.md index e22e5826fb149..0d7d7efed0c6c 100644 --- a/src/Symfony/Component/Form/CHANGELOG.md +++ b/src/Symfony/Component/Form/CHANGELOG.md @@ -16,6 +16,7 @@ CHANGELOG * Implementing the `FormConfigBuilderInterface` without implementing the `setIsEmptyCallback()` method is deprecated. The method will be added to the interface in 6.0. * Added a `rounding_mode` option for the PercentType and correctly round the value when submitted + * Deprecated `Symfony\Component\Form\Extension\Validator\Util\ServerParams` in favor of its parent class `Symfony\Component\Form\Util\ServerParams` 5.0.0 ----- diff --git a/src/Symfony/Component/Form/Extension/Validator/Util/ServerParams.php b/src/Symfony/Component/Form/Extension/Validator/Util/ServerParams.php index 54437f76a3537..98e9f0c98a87f 100644 --- a/src/Symfony/Component/Form/Extension/Validator/Util/ServerParams.php +++ b/src/Symfony/Component/Form/Extension/Validator/Util/ServerParams.php @@ -13,8 +13,12 @@ use Symfony\Component\Form\Util\ServerParams as BaseServerParams; +trigger_deprecation('symfony/form', '5.1', 'The "%s" class is deprecated. Use "%s" instead.', ServerParams::class, BaseServerParams::class); + /** * @author Bernhard Schussek + * + * @deprecated since Symfony 5.1. Use {@see BaseServerParams} instead. */ class ServerParams extends BaseServerParams { diff --git a/src/Symfony/Component/Form/Tests/Extension/Validator/Util/LegacyServerParamsTest.php b/src/Symfony/Component/Form/Tests/Extension/Validator/Util/LegacyServerParamsTest.php new file mode 100644 index 0000000000000..8b0b0d7ecf1fb --- /dev/null +++ b/src/Symfony/Component/Form/Tests/Extension/Validator/Util/LegacyServerParamsTest.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Tests\Extension\Validator\Util; + +use PHPUnit\Framework\TestCase; +use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait; +use Symfony\Component\Form\Extension\Validator\Util\ServerParams; + +class LegacyServerParamsTest extends TestCase +{ + use ExpectDeprecationTrait; + + /** + * @group legacy + */ + public function testClassIsDeprecated() + { + $this->expectDeprecation('Since symfony/form 5.1: The "Symfony\Component\Form\Extension\Validator\Util\ServerParams" class is deprecated. Use "Symfony\Component\Form\Util\ServerParams" instead.'); + + new ServerParams(); + } +} diff --git a/src/Symfony/Component/Form/Tests/Extension/Validator/Util/ServerParamsTest.php b/src/Symfony/Component/Form/Tests/Util/ServerParamsTest.php similarity index 94% rename from src/Symfony/Component/Form/Tests/Extension/Validator/Util/ServerParamsTest.php rename to src/Symfony/Component/Form/Tests/Util/ServerParamsTest.php index 8d3b5f6fa00ff..56994760884d4 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Validator/Util/ServerParamsTest.php +++ b/src/Symfony/Component/Form/Tests/Util/ServerParamsTest.php @@ -9,10 +9,10 @@ * file that was distributed with this source code. */ -namespace Symfony\Component\Form\Tests\Extension\Validator\Util; +namespace Symfony\Component\Form\Tests\Util; use PHPUnit\Framework\TestCase; -use Symfony\Component\Form\Extension\Validator\Util\ServerParams; +use Symfony\Component\Form\Util\ServerParams; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack;