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

Appearance settings

Commit 611f45c

Browse filesBrowse files
committed
[Form] Deprecated unused old ServerParams util
1 parent 2059db2 commit 611f45c
Copy full SHA for 611f45c

File tree

6 files changed

+45
-2
lines changed
Filter options

6 files changed

+45
-2
lines changed

‎UPGRADE-5.1.md

Copy file name to clipboardExpand all lines: UPGRADE-5.1.md
+1Lines 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

Copy file name to clipboardExpand all lines: UPGRADE-6.0.md
+1Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/CHANGELOG.md
+1Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Validator/Util/ServerParams.php
+9Lines 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
}
+31Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Tests/Util/ServerParamsTest.php
+2-2Lines 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\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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.