diff --git a/Authorization/TraceableAccessDecisionManager.php b/Authorization/TraceableAccessDecisionManager.php index 3a44f67a..7a85198d 100644 --- a/Authorization/TraceableAccessDecisionManager.php +++ b/Authorization/TraceableAccessDecisionManager.php @@ -109,3 +109,7 @@ public function getDecisionLog(): array return $this->decisionLog; } } + +if (!class_exists(DebugAccessDecisionManager::class, false)) { + class_alias(TraceableAccessDecisionManager::class, DebugAccessDecisionManager::class); +} diff --git a/Exception/UserNotFoundException.php b/Exception/UserNotFoundException.php index 17f488b6..98ebf538 100644 --- a/Exception/UserNotFoundException.php +++ b/Exception/UserNotFoundException.php @@ -71,3 +71,7 @@ public function __unserialize(array $data): void parent::__unserialize($parentData); } } + +if (!class_exists(UsernameNotFoundException::class, false)) { + class_alias(UserNotFoundException::class, UsernameNotFoundException::class); +} diff --git a/Tests/Authorization/TraceableAccessDecisionManagerTest.php b/Tests/Authorization/TraceableAccessDecisionManagerTest.php index 30d2dfd3..4b97885e 100644 --- a/Tests/Authorization/TraceableAccessDecisionManagerTest.php +++ b/Tests/Authorization/TraceableAccessDecisionManagerTest.php @@ -15,6 +15,7 @@ use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security\Core\Authorization\AccessDecisionManager; use Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface; +use Symfony\Component\Security\Core\Authorization\DebugAccessDecisionManager; use Symfony\Component\Security\Core\Authorization\TraceableAccessDecisionManager; use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface; @@ -170,6 +171,13 @@ public function provideObjectsAndLogs(): \Generator ]; } + public function testDebugAccessDecisionManagerAliasExistsForBC() + { + $adm = new TraceableAccessDecisionManager(new AccessDecisionManager()); + + $this->assertInstanceOf(DebugAccessDecisionManager::class, $adm, 'For BC, TraceableAccessDecisionManager must be an instance of DebugAccessDecisionManager'); + } + /** * Tests decision log returned when a voter call decide method of AccessDecisionManager. */