8000 [Form] Deprecated unused old `ServerParams` util · symfony/symfony@611f45c · GitHub
[go: up one dir, main page]

Skip to content

Commit 611f45c

Browse files
committed
[Form] Deprecated unused old ServerParams util
1 parent 2059db2 commit 611f45c

File tree

6 files changed

+45
-2
lines changed

6 files changed

+45
-2
lines changed

UPGRADE-5.1.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ Form
4343
* Implementing the `FormConfigBuilderInterface` without implementing the `setIsEmptyCallback()` method
4444
is deprecated. The method will be added to the interface in 6.0.
4545
* Added argument `callable|null $filter` to `ChoiceListFactoryInterface::createListFromChoices()` and `createListFromLoader()` - not defining them is deprecated.
46+
* Using `Symfony\Component\Form\Extension\Validator\Util\ServerParams` class is deprecated, use its parent `Symfony\Component\Form\Util\ServerParams` instead.
4647

4748
FrameworkBundle
4849
---------------

UPGRADE-6.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ Form
4141
* Added the `getIsEmptyCallback()` method to the `FormConfigInterface`.
4242
* Added the `setIsEmptyCallback()` method to the `FormConfigBuilderInterface`.
4343
* Added argument `callable|null $filter` to `ChoiceListFactoryInterface::createListFromChoices()` and `createListFromLoader()`.
44+
* The `Symfony\Component\Form\Extension\Validator\Util\ServerParams` class has been removed, use its parent `Symfony\Component\Form\Util\ServerParams` instead.
4445

4546
FrameworkBundle
4647
---------------

src/Symfony/Component/Form/CHANGELOG.md

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

7+
* Deprecated `Symfony\Component\Form\Extension\Validator\Util\ServerParams` in favor of its parent class `Symfony\Component\Form\Util\ServerParams`
78
* Added `collection_entry` block prefix to `CollectionType` entries
89
* Added a `choice_filter` option to `ChoiceType`
910
* Added argument `callable|null $filter` to `ChoiceListFactoryInterface::createListFromChoices()` and `createListFromLoader()` - not defining them is deprecated.

src/Symfony/Component/Form/Extension/Validator/Util/ServerParams.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,19 @@
1212
namespace Symfony\Component\Form\Extension\Validator\Util;
1313

1414
use Symfony\Component\Form\Util\ServerParams as BaseServerParams;
15+
use Symfony\Component\HttpFoundation\RequestStack;
1516

1617
/**
1718
* @author Bernhard Schussek <bschussek@gmail.com>
19+
*
20+
* @deprecated since Symfony 5.1. Use {@see BaseServerParams} instead.
1821
*/
1922
class ServerParams extends BaseServerParams
2023
{
24+
public function __construct(RequestStack $requestStack = null)
25+
{
26+
trigger_deprecation('symfony/form', '5.1', 'The "%s" class will be removed in 6.0. Use "%s" instead.', __CLASS__, BaseServerParams::class);
27+
28+
parent::__construct($requestStack);
29+
}
2130
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Form\Tests\Extension\Validator\Util;
13+
14+
use PHPUnit\Framework\TestCase;
15+
use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait;
16+
use Symfony\Component\Form\Extension\Validator\Util\ServerParams;
17+
18+
class LegacyServerParamsTest extends TestCase
19+
{
20+
use ExpectDeprecationTrait;
21+
22+
/**
23+
* @group legacy
24+
*/
25+
public function testClassIsDeprecated()
26+
{
27+
$this->expectDeprecation('Since symfony/form 5.1: The "Symfony\Component\Form\Extension\Validator\Util\ServerParams" class will be removed in 6.0. Use "Symfony\Component\Form\Util\ServerParams" instead.');
28+
29+
new ServerParams();
30+
}
31+
}

src/Symfony/Component/Form/Tests/Extension/Validator/Util/ServerParamsTest.php renamed to src/Symfony/Component/Form/Tests/Util/ServerParamsTest.php

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

12-
namespace Symfony\Component\Form\Tests\Extension\Validator\Util;
12+
namespace Symfony\Component\Form\Tests\Util;
1313

1414
use PHPUnit\Framework< 5CC9 /span>\TestCase;
15-
use Symfony\Component\Form\Extension\Validator\Util\ServerParams;
15+
use Symfony\Component\Form\Util\ServerParams;
1616
use Symfony\Component\HttpFoundation\Request;
1717
use Symfony\Component\HttpFoundation\RequestStack;
1818

0 commit comments

Comments
 (0)
0