diff --git a/Tests/Domain/SecurityIdentityRetrievalStrategyTest.php b/Tests/Domain/SecurityIdentityRetrievalStrategyTest.php index deebb44..edc56f1 100644 --- a/Tests/Domain/SecurityIdentityRetrievalStrategyTest.php +++ b/Tests/Domain/SecurityIdentityRetrievalStrategyTest.php @@ -284,7 +284,7 @@ public function getRoles(): array return []; } - public function eraseCredentials() + public function eraseCredentials(): void { } diff --git a/Voter/AclVoter.php b/Voter/AclVoter.php index 14c5d56..897a189 100644 --- a/Voter/AclVoter.php +++ b/Voter/AclVoter.php @@ -26,8 +26,10 @@ * This voter can be used as a base class for implementing your own permissions. * * @author Johannes M. Schmitt + * + * @internal */ -class AclVoter implements VoterInterface +abstract class InternalAclVoter implements VoterInterface { private $aclProvider; private $permissionMap; @@ -51,7 +53,10 @@ public function supportsAttribute($attribute) return \is_string($attribute) && $this->permissionMap->contains($attribute); } - public function vote(TokenInterface $token, $subject, array $attributes) + /** + * @internal + */ + protected function internalVote(TokenInterface $token, $subject, array $attributes) { foreach ($attributes as $attribute) { if (!$this->supportsAttribute($attribute)) { @@ -145,3 +150,21 @@ public function supportsClass($class) return true; } } + +if (class_exists(\Symfony\Component\Security\Core\Security::class)) { + class AclVoter extends InternalAclVoter + { + public function vote(TokenInterface $token, $subject, array $attributes) + { + return $this->internalVote($token, $subject, $attributes); + } + } +} else { + class AclVoter extends InternalAclVoter + { + public function vote(TokenInterface $token, mixed $subject, array $attributes): int + { + return $this->internalVote($token, $subject, $attributes); + } + } +}