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

Skip to content

Commit 78803b2

Browse files
Remove all "nullable-by-default-value" setters
1 parent 917ffde commit 78803b2

File tree

56 files changed

+199
-39
lines changed

Some content is hidden

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

56 files changed

+199
-39
lines changed

UPGRADE-6.2.md

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,30 @@
11
UPGRADE FROM 6.1 to 6.2
22
=======================
33

4+
Config
5+
------
6+
7+
* Deprecate calling `NodeBuilder::setParent()` without any arguments
8+
9+
Console
10+
-------
11+
12+
* Deprecate calling `*Command::setApplication()`, `*FormatterStyle::setForeground/setBackground()`, `Helper::setHelpSet()`, `Input*::setDefault()`, `Question::setAutocompleterCallback/setValidator()`without any arguments
13+
* Change the signature of `OutputFormatterStyleInterface::setForeground/setBackground()` to `setForeground/setBackground(?string)`
14+
* Change the signature of `HelperInterface::setHelperSet()` to `setHelperSet(?HelperSet)`
15+
416
DependencyInjection
517
-------------------
618

7-
* The signature of `ContainerAwareInterface::setContainer()` has been updated to `setContainer(?ContainerInterface $container)`; explicitly pass `null` if you want to unset the container
19+
* Change the signature of `ContainerAwareInterface::setContainer()` to `setContainer(?ContainerInterface)`
20+
* Deprecate calling `ContainerAwareTrait::setContainer()` without arguments
21+
22+
Form
23+
----
24+
25+
* Deprecate calling `Button/Form::setParent()`, `ButtonBuilder/FormConfigBuilder::setDataMapper()`, `TransformationFailedException::setInvalidMessage()` without arguments
26+
* Change the signature of `FormConfigBuilderInterface::setDataMapper()` to `setDataMapper(?DataMapperInterface)`
27+
* Change the signature of `FormInterface::setParent()` to `setParent(?self)`
828

929
FrameworkBundle
1030
---------------
@@ -18,11 +38,13 @@ HttpFoundation
1838
--------------
1939

2040
* Deprecate `Request::getContentType()`, use `Request::getContentTypeFormat()` instead
41+
* Deprecate calling `JsonResponse::setCallback()`, `Response::setExpires/setLastModified/setEtag()`, `MockArraySessionStorage/NativeSessionStorage::setMetadataBag()`, `NativeSessionStorage::setSaveHandler()` without arguments
2142

2243
HttpKernel
2344
----------
2445

2546
* Deprecate `ArgumentValueResolverInterface`, use `ValueResolverInterface` instead
47+
* Deprecate calling `ConfigDataCollector::setKernel()`, `RouterListener::setCurrentRequest()` without arguments
2648

2749
Ldap
2850
----
@@ -34,6 +56,16 @@ Mailer
3456

3557
* Deprecate the `OhMySMTP` transport, use `MailPace` instead
3658

59+
Mime
60+
----
61+
62+
* Deprecate calling `Message::setBody()` without arguments
63+
64+
PropertyAccess
65+
--------------
66+
67+
* Deprecate calling `PropertyAccessorBuilder::setCacheItemPool()` without arguments
68+
3769
Security
3870
--------
3971

@@ -42,13 +74,26 @@ Security
4274
* Deprecate the `Symfony\Component\Security\Core\Security` class and service, use `Symfony\Bundle\SecurityBundle\Security\Security` instead
4375
* Passing empty username or password parameter when using `JsonLoginAuthenticator` is not supported anymore
4476
* Add `$lifetime` parameter to `LoginLinkHandlerInterface::createLoginLink()`
45-
* The signature of `TokenStorageInterface::setToken()` has been updated to `setToken(?TokenInterface $token)`; explicitly pass `null` if you want to unset the token
77+
* Change the signature of `TokenStorageInterface::setToken()` to `setToken(?TokenInterface $token)`
78+
* Deprecate calling `TokenStorage::setToken()` or `UsageTrackingTokenStorage::setToken()` without arguments
79+
80+
Serializer
81+
----------
82+
83+
* Deprecate calling `AttributeMetadata::setSerializedName()`, `ClassMetadata::setClassDiscriminatorMapping()` without arguments
84+
* Change the signature of `AttributeMetadataInterface::setSerializedName()` to `setSerializedName(?string)`
85+
* Change the signature of `ClassMetadataInterface::setClassDiscriminatorMapping()` to `setClassDiscriminatorMapping(?ClassDiscriminatorMapping)`
4686

4787
Validator
4888
---------
4989

5090
* Deprecate the `loose` e-mail validation mode, use `html5` instead
5191

92+
VarDumper
93+
---------
94+
95+
* Deprecate calling `VarDumper::setHandler()` without arguments
96+
5297
Workflow
5398
--------
5499

@@ -58,3 +103,4 @@ Workflow
58103
```
59104
* The first argument of `WorkflowDumpCommand` should be a `ServiceLocator` of
60105
all workflows indexed by names
106+
* Deprecate calling `Definition::setInitialPlaces()` without arguments

src/Symfony/Bridge/Doctrine/Tests/Fixtures/ContainerAwareFixture.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class ContainerAwareFixture implements FixtureInterface, ContainerAwareInterface
2020
{
2121
public $container;
2222

23-
public function setContainer(ContainerInterface $container = null)
23+
public function setContainer(?ContainerInterface $container)
2424
{
2525
$this->container = $container;
2626
}

src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerResolverTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ class ContainerAwareController implements ContainerAwareInterface
172172
{
173173
private $container;
174174

175-
public function setContainer(ContainerInterface $container = null)
175+
public function setContainer(?ContainerInterface $container)
176176
{
177177
$this->container = $container;
178178
}

src/Symfony/Component/Config/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
6.2
5+
---
6+
7+
* Deprecate calling `NodeBuilder::setParent()` without any arguments
8+
49
6.1
510
---
611

src/Symfony/Component/Config/Definition/Builder/NodeBuilder.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ public function __construct()
4141
*/
4242
public function setParent(ParentNodeDefinitionInterface $parent = null): static
4343
{
44+
if (1 > \func_num_args()) {
45+
trigger_deprecation('symfony/form', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
46+
}
4447
$this->parent = $parent;
4548

4649
return $this;

src/Symfony/Component/Console/CHANGELOG.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@ CHANGELOG
44
6.2
55
---
66

7-
* Improve truecolor terminal detection in some cases
8-
* Add support for 256 color terminals (conversion from Ansi24 to Ansi8 if terminal is capable of it)
7+
* Improve truecolor terminal detection in some cases
8+
* Add support for 256 color terminals (conversion from Ansi24 to Ansi8 if terminal is capable of it)
9+
* Deprecate calling `*Command::setApplication()`, `*FormatterStyle::setForeground/setBackground()`, `Helper::setHelpSet()`, `Input*::setDefault()`, `Question::setAutocompleterCallback/setValidator()`without any arguments
10+
* Change the signature of `OutputFormatterStyleInterface::setForeground/setBackground()` to `setForeground/setBackground(?string)`
11+
* Change the signature of `HelperInterface::setHelperSet()` to `setHelperSet(?HelperSet)`
912

1013
6.1
1114
---

src/Symfony/Component/Console/Command/Command.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,9 @@ public function ignoreValidationErrors()
149149

150150
public function setApplication(Application $application = null)
151151
{
152+
if (1 > \func_num_args()) {
153+
trigger_deprecation('symfony/console', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
154+
}
152155
$this->application = $application;
153156
if ($application) {
154157
$this->setHelperSet($application->getHelperSet());

src/Symfony/Component/Console/Command/LazyCommand.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ public function ignoreValidationErrors(): void
4747

4848
public function setApplication(Application $application = null): void
4949
{
50+
if (1 > \func_num_args()) {
51+
trigger_deprecation('symfony/console', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
52+
}
5053
if ($this->command instanceof parent) {
5154
$this->command->setApplication($application);
5255
}

src/Symfony/Component/Console/Formatter/NullOutputFormatterStyle.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,17 @@ public function apply(string $text): string
2323

2424
public function setBackground(string $color = null): void
2525
{
26+
if (1 > \func_num_args()) {
27+
trigger_deprecation('symfony/console', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
28+
}
2629
// do nothing
2730
}
2831

2932
public function setForeground(string $color = null): void
3033
{
34+
if (1 > \func_num_args()) {
35+
trigger_deprecation('symfony/console', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
36+
}
3137
// do nothing
3238
}
3339

src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,17 @@ public function __construct(string $foreground = null, string $background = null
4040

4141
public function setForeground(string $color = null)
4242
{
43+
if (1 > \func_num_args()) {
44+
trigger_deprecation('symfony/console', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
45+
}
4346
$this->color = new Color($this->foreground = $color ?: '', $this->background, $this->options);
4447
}
4548

4649
public function setBackground(string $color = null)
4750
{
51+
if (1 > \func_num_args()) {
52+
trigger_deprecation('symfony/console', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
53+
}
4854
$this->color = new Color($this->foreground, $this->background = $color ?: '', $this->options);
4955
}
5056

0 commit comments

Comments
 (0)