Skip to content

Commit 4acf430

Browse files
Remove all "nullable-by-default-value" setters
1 parent 20917ce commit 4acf430

File tree

4 files changed

+4
-8
lines changed

4 files changed

+4
-8
lines changed

Authentication/Token/Storage/TokenStorage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function getToken(): ?TokenInterface
4040
public function setToken(TokenInterface $token = null)
4141
{
4242
if (1 > \func_num_args()) {
43-
trigger_deprecation('symfony/security-core', '6.2', 'Calling "%s()" without any arguments is deprecated. Please explicitly pass null if you want to unset the token.', __METHOD__);
43+
trigger_deprecation('symfony/security-core', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
4444
}
4545

4646
if ($token) {

Authentication/Token/Storage/UsageTrackingTokenStorage.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@ public function getToken(): ?TokenInterface
4646

4747
public function setToken(TokenInterface $token = null): void
4848
{
49-
if (1 > \func_num_args()) {
50-
trigger_deprecation('symfony/security-core', '6.2', 'Calling "%s()" without any arguments is deprecated. Please explicitly pass null if you want to unset the token.', __METHOD__);
51-
}
52-
5349
$this->storage->setToken($token);
5450

5551
if ($token && $this->shouldTrackUsage()) {

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ CHANGELOG
66

77
* Deprecate the `Security` class, use `Symfony\Bundle\SecurityBundle\Security\Security` instead
88
* Change the signature of `TokenStorageInterface::setToken()` to `setToken(?TokenInterface $token)`
9-
* Deprecate calling `TokenStorage::setToken()` or `UsageTrackingTokenStorage::setToken()` without arguments
9+
* Deprecate calling `TokenStorage::setToken()` without arguments
1010

1111
6.0
1212
---

Tests/Authentication/Token/Storage/TokenStorageTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ class TokenStorageTest extends TestCase
2727
public function testGetSetTokenLegacy()
2828
{
2929
$tokenStorage = new TokenStorage();
30-
$token = new UsernamePasswordToken('username', 'password', 'provider');
30+
$token = new UsernamePasswordToken(new InMemoryUser('username', 'password'), 'provider');
3131
$tokenStorage->setToken($token);
3232
$this->assertSame($token, $tokenStorage->getToken());
3333

34-
$this->expectDeprecation('Since symfony/security-core 6.2: Calling "Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage::setToken()" without any arguments is deprecated. Please explicitly pass null if you want to unset the token.');
34+
$this->expectDeprecation('Since symfony/security-core 6.2: Calling "Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage::setToken()" without any arguments is deprecated, pass null explicitly instead.');
3535

3636
$tokenStorage->setToken();
3737
$this->assertNull($tokenStorage->getToken());

0 commit comments

Comments
 (0)