Add return typing to match parent class : required in symfony 6

This commit is contained in:
Julie Lenaerts 2024-08-14 10:36:26 +02:00
parent 0e9c5090d0
commit e70c8feb16
19 changed files with 31 additions and 36 deletions

View File

@ -53,13 +53,13 @@ class ActivityStatsVoter extends AbstractChillVoter implements ProvideRoleHierar
} }
#[\Override] #[\Override]
protected function supports($attribute, $subject) protected function supports($attribute, $subject): bool
{ {
return $this->helper->supports($attribute, $subject); return $this->helper->supports($attribute, $subject);
} }
#[\Override] #[\Override]
protected function voteOnAttribute($attribute, $subject, TokenInterface $token) protected function voteOnAttribute($attribute, $subject, TokenInterface $token): bool
{ {
return $this->helper->voteOnAttribute($attribute, $subject, $token); return $this->helper->voteOnAttribute($attribute, $subject, $token);
} }

View File

@ -68,13 +68,13 @@ class BudgetElementVoter extends Voter implements ProvideRoleHierarchyInterface
} }
#[\Override] #[\Override]
protected function supports($attribute, $subject) protected function supports($attribute, $subject): bool
{ {
return $this->voter->supports($attribute, $subject); return $this->voter->supports($attribute, $subject);
} }
#[\Override] #[\Override]
protected function voteOnAttribute($attribute, $subject, TokenInterface $token) protected function voteOnAttribute($attribute, $subject, TokenInterface $token): bool
{ {
if ( if (
$subject instanceof Person $subject instanceof Person

View File

@ -74,7 +74,7 @@ class PersonDocumentVoter extends AbstractChillVoter implements ProvideRoleHiera
} }
#[\Override] #[\Override]
protected function supports($attribute, $subject) protected function supports($attribute, $subject): bool
{ {
return $this->voterHelper->supports($attribute, $subject); return $this->voterHelper->supports($attribute, $subject);
} }
@ -86,7 +86,7 @@ class PersonDocumentVoter extends AbstractChillVoter implements ProvideRoleHiera
* @return bool * @return bool
*/ */
#[\Override] #[\Override]
protected function voteOnAttribute($attribute, $subject, TokenInterface $token) protected function voteOnAttribute($attribute, $subject, TokenInterface $token): bool
{ {
$this->logger->debug(sprintf('Voting from %s class', self::class)); $this->logger->debug(sprintf('Voting from %s class', self::class));

View File

@ -82,13 +82,13 @@ class EventVoter extends AbstractChillVoter implements ProvideRoleHierarchyInter
} }
#[\Override] #[\Override]
public function supports($attribute, $subject) public function supports($attribute, $subject): bool
{ {
return $this->voterHelper->supports($attribute, $subject); return $this->voterHelper->supports($attribute, $subject);
} }
#[\Override] #[\Override]
protected function voteOnAttribute($attribute, $subject, TokenInterface $token) protected function voteOnAttribute($attribute, $subject, TokenInterface $token): bool
{ {
$this->logger->debug(sprintf('Voting from %s class', self::class)); $this->logger->debug(sprintf('Voting from %s class', self::class));

View File

@ -79,18 +79,13 @@ class ParticipationVoter extends AbstractChillVoter implements ProvideRoleHierar
} }
#[\Override] #[\Override]
public function supports($attribute, $subject) public function supports($attribute, $subject): bool
{ {
return $this->voterHelper->supports($attribute, $subject); return $this->voterHelper->supports($attribute, $subject);
} }
/**
* @param string $attribute
*
* @return bool
*/
#[\Override] #[\Override]
protected function voteOnAttribute($attribute, $subject, TokenInterface $token) protected function voteOnAttribute($attribute, $subject, TokenInterface $token): bool
{ {
$this->logger->debug(sprintf('Voting from %s class', self::class)); $this->logger->debug(sprintf('Voting from %s class', self::class));

View File

@ -46,7 +46,7 @@ class ExportsJobVoter extends AbstractChillVoter implements ProvideRoleHierarchy
* @return bool * @return bool
*/ */
#[\Override] #[\Override]
protected function supports($attribute, $subject) protected function supports($attribute, $subject): bool
{ {
if ($subject instanceof Center) { if ($subject instanceof Center) {
return self::EXPORT === $attribute; return self::EXPORT === $attribute;
@ -62,7 +62,7 @@ class ExportsJobVoter extends AbstractChillVoter implements ProvideRoleHierarchy
* @return bool * @return bool
*/ */
#[\Override] #[\Override]
protected function voteOnAttribute($attribute, $subject, TokenInterface $token) protected function voteOnAttribute($attribute, $subject, TokenInterface $token): bool
{ {
$user = $token->getUser(); $user = $token->getUser();

View File

@ -50,7 +50,7 @@ class JobVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterfa
} }
#[\Override] #[\Override]
protected function supports($attribute, $subject) protected function supports($attribute, $subject): bool
{ {
if (!\in_array($attribute, self::ALL, true)) { if (!\in_array($attribute, self::ALL, true)) {
return false; return false;
@ -68,7 +68,7 @@ class JobVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterfa
} }
#[\Override] #[\Override]
protected function voteOnAttribute($attribute, $subject, TokenInterface $token) protected function voteOnAttribute($attribute, $subject, TokenInterface $token): bool
{ {
if ($subject instanceof Person) { if ($subject instanceof Person) {
$center = $subject->getCenter(); $center = $subject->getCenter();

View File

@ -30,7 +30,7 @@ class EntityWorkflowVoter extends Voter
public function __construct(private readonly EntityWorkflowManager $manager, private readonly Security $security) {} public function __construct(private readonly EntityWorkflowManager $manager, private readonly Security $security) {}
#[\Override] #[\Override]
protected function supports($attribute, $subject) protected function supports($attribute, $subject): bool
{ {
return $subject instanceof EntityWorkflow && \in_array($attribute, self::getRoles(), true); return $subject instanceof EntityWorkflow && \in_array($attribute, self::getRoles(), true);
} }

View File

@ -23,7 +23,7 @@ class WorkflowEntityDeletionVoter extends Voter
public function __construct(private $handlers, private readonly EntityWorkflowRepository $entityWorkflowRepository) {} public function __construct(private $handlers, private readonly EntityWorkflowRepository $entityWorkflowRepository) {}
#[\Override] #[\Override]
protected function supports($attribute, $subject) protected function supports($attribute, $subject): bool
{ {
if (!\is_object($subject)) { if (!\is_object($subject)) {
return false; return false;
@ -40,7 +40,7 @@ class WorkflowEntityDeletionVoter extends Voter
} }
#[\Override] #[\Override]
protected function voteOnAttribute($attribute, $subject, TokenInterface $token) protected function voteOnAttribute($attribute, $subject, TokenInterface $token): bool
{ {
foreach ($this->handlers as $handler) { foreach ($this->handlers as $handler) {
if ($handler->isObjectSupported($subject)) { if ($handler->isObjectSupported($subject)) {

View File

@ -625,7 +625,7 @@ class AccompanyingPeriod implements
} }
#[\Override] #[\Override]
public function getGroupSequence() public function getGroupSequence(): array|Assert\GroupSequence
{ {
if (self::STEP_DRAFT === $this->getStep()) { if (self::STEP_DRAFT === $this->getStep()) {
return [[self::STEP_DRAFT]]; return [[self::STEP_DRAFT]];

View File

@ -25,13 +25,13 @@ class AccompanyingPeriodCommentVoter extends Voter
public function __construct(private readonly Security $security) {} public function __construct(private readonly Security $security) {}
#[\Override] #[\Override]
protected function supports($attribute, $subject) protected function supports($attribute, $subject): bool
{ {
return $subject instanceof Comment; return $subject instanceof Comment;
} }
#[\Override] #[\Override]
protected function voteOnAttribute($attribute, $subject, TokenInterface $token) protected function voteOnAttribute($attribute, $subject, TokenInterface $token): bool
{ {
return match ($attribute) { return match ($attribute) {
self::EDIT => $this->security->isGranted(AccompanyingPeriodVoter::EDIT, $subject->getAccompanyingPeriod()), self::EDIT => $this->security->isGranted(AccompanyingPeriodVoter::EDIT, $subject->getAccompanyingPeriod()),

View File

@ -23,13 +23,13 @@ class AccompanyingPeriodResourceVoter extends Voter
public function __construct(private readonly AccessDecisionManagerInterface $accessDecisionManager) {} public function __construct(private readonly AccessDecisionManagerInterface $accessDecisionManager) {}
#[\Override] #[\Override]
protected function supports($attribute, $subject) protected function supports($attribute, $subject): bool
{ {
return $subject instanceof Resource && self::EDIT === $attribute; return $subject instanceof Resource && self::EDIT === $attribute;
} }
#[\Override] #[\Override]
protected function voteOnAttribute($attribute, $subject, TokenInterface $token) protected function voteOnAttribute($attribute, $subject, TokenInterface $token): bool
{ {
return match ($attribute) { return match ($attribute) {
self::EDIT => $this->accessDecisionManager->decide( self::EDIT => $this->accessDecisionManager->decide(

View File

@ -151,7 +151,7 @@ class AccompanyingPeriodVoter extends AbstractChillVoter implements ProvideRoleH
} }
#[\Override] #[\Override]
protected function supports($attribute, $subject) protected function supports($attribute, $subject): bool
{ {
return $this->voterHelper->supports($attribute, $subject); return $this->voterHelper->supports($attribute, $subject);
} }

View File

@ -28,7 +28,7 @@ class AccompanyingPeriodWorkEvaluationDocumentVoter extends Voter
public function __construct(private readonly AccessDecisionManagerInterface $accessDecisionManager) {} public function __construct(private readonly AccessDecisionManagerInterface $accessDecisionManager) {}
#[\Override] #[\Override]
protected function supports($attribute, $subject) protected function supports($attribute, $subject): bool
{ {
return $subject instanceof AccompanyingPeriodWorkEvaluationDocument return $subject instanceof AccompanyingPeriodWorkEvaluationDocument
&& self::SEE === $attribute; && self::SEE === $attribute;

View File

@ -31,7 +31,7 @@ class AccompanyingPeriodWorkEvaluationVoter extends Voter implements ChillVoterI
public function __construct(private readonly Security $security) {} public function __construct(private readonly Security $security) {}
#[\Override] #[\Override]
protected function supports($attribute, $subject) protected function supports($attribute, $subject): bool
{ {
return $subject instanceof AccompanyingPeriodWorkEvaluation return $subject instanceof AccompanyingPeriodWorkEvaluation
&& \in_array($attribute, self::ALL, true); && \in_array($attribute, self::ALL, true);

View File

@ -70,7 +70,7 @@ class HouseholdVoter extends Voter implements ProvideRoleHierarchyInterface, Chi
} }
#[\Override] #[\Override]
protected function supports($attribute, $subject) protected function supports($attribute, $subject): bool
{ {
return ($subject instanceof Household return ($subject instanceof Household
&& \in_array($attribute, self::ALL, true)) && \in_array($attribute, self::ALL, true))

View File

@ -58,7 +58,7 @@ class ReportVoter extends AbstractChillVoter implements ProvideRoleHierarchyInte
} }
#[\Override] #[\Override]
protected function supports($attribute, $subject) protected function supports($attribute, $subject): bool
{ {
if ($subject instanceof Report) { if ($subject instanceof Report) {
return \in_array($attribute, [ return \in_array($attribute, [
@ -72,7 +72,7 @@ class ReportVoter extends AbstractChillVoter implements ProvideRoleHierarchyInte
} }
#[\Override] #[\Override]
protected function voteOnAttribute($attribute, $subject, TokenInterface $token) protected function voteOnAttribute($attribute, $subject, TokenInterface $token): bool
{ {
if (!$token->getUser() instanceof User) { if (!$token->getUser() instanceof User) {
return false; return false;

View File

@ -84,13 +84,13 @@ final class TaskVoter extends AbstractChillVoter implements ProvideRoleHierarchy
} }
#[\Override] #[\Override]
public function supports($attribute, $subject) public function supports($attribute, $subject): bool
{ {
return $this->voter->supports($attribute, $subject); return $this->voter->supports($attribute, $subject);
} }
#[\Override] #[\Override]
protected function voteOnAttribute($attribute, $subject, TokenInterface $token) protected function voteOnAttribute($attribute, $subject, TokenInterface $token): bool
{ {
if (!$token->getUser() instanceof User) { if (!$token->getUser() instanceof User) {
return false; return false;

View File

@ -62,7 +62,7 @@ class ThirdPartyVoter extends AbstractChillVoter implements ProvideRoleHierarchy
} }
#[\Override] #[\Override]
protected function supports($attribute, $subject) protected function supports($attribute, $subject): bool
{ {
if ($subject instanceof ThirdParty) { if ($subject instanceof ThirdParty) {
return \in_array($attribute, $this->getRoles(), true); return \in_array($attribute, $this->getRoles(), true);