Skip to content

Commit eb2967d

Browse files
Revert "minor #45899 [Messenger] [Security/Core] Remove legacy class aliases (nicolas-grekas)"
This reverts commit 758ed6bf66648a17432496162cd02215b8809df4, reversing changes made to 1bd3af4ec6303a4cf3de0218abc29ca9fdd7a793.
1 parent 6bac15f commit eb2967d

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

Authorization/TraceableAccessDecisionManager.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,7 @@ public function getDecisionLog(): array
109109
return $this->decisionLog;
110110
}
111111
}
112+
113+
if (!class_exists(DebugAccessDecisionManager::class, false)) {
114+
class_alias(TraceableAccessDecisionManager::class, DebugAccessDecisionManager::class);
115+
}

Exception/UserNotFoundException.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,7 @@ public function __unserialize(array $data): void
7171
parent::__unserialize($parentData);
7272
}
7373
}
74+
75+
if (!class_exists(UsernameNotFoundException::class, false)) {
76+
class_alias(UserNotFoundException::class, UsernameNotFoundException::class);
77+
}

Tests/Authorization/TraceableAccessDecisionManagerTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
1616
use Symfony\Component\Security\Core\Authorization\AccessDecisionManager;
1717
use Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface;
18+
use Symfony\Component\Security\Core\Authorization\DebugAccessDecisionManager;
1819
use Symfony\Component\Security\Core\Authorization\TraceableAccessDecisionManager;
1920
use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
2021

@@ -170,6 +171,13 @@ public function provideObjectsAndLogs(): \Generator
170171
];
171172
}
172173

174+
public function testDebugAccessDecisionManagerAliasExistsForBC()
175+
{
176+
$adm = new TraceableAccessDecisionManager(new AccessDecisionManager());
177+
178+
$this->assertInstanceOf(DebugAccessDecisionManager::class, $adm, 'For BC, TraceableAccessDecisionManager must be an instance of DebugAccessDecisionManager');
179+
}
180+
173181
/**
174182
* Tests decision log returned when a voter call decide method of AccessDecisionManager.
175183
*/

0 commit comments

Comments
 (0)