From e70c8feb167be48abcacc115c228ef7040f8444f Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 14 Aug 2024 10:36:26 +0200 Subject: [PATCH] Add return typing to match parent class : required in symfony 6 --- .../Security/Authorization/ActivityStatsVoter.php | 4 ++-- .../Security/Authorization/BudgetElementVoter.php | 4 ++-- .../Security/Authorization/PersonDocumentVoter.php | 4 ++-- src/Bundle/ChillEventBundle/Security/EventVoter.php | 4 ++-- .../ChillEventBundle/Security/ParticipationVoter.php | 9 ++------- .../src/Security/Authorization/ExportsJobVoter.php | 4 ++-- .../src/Security/Authorization/JobVoter.php | 4 ++-- .../Security/Authorization/EntityWorkflowVoter.php | 2 +- .../Authorization/WorkflowEntityDeletionVoter.php | 4 ++-- .../ChillPersonBundle/Entity/AccompanyingPeriod.php | 2 +- .../Authorization/AccompanyingPeriodCommentVoter.php | 4 ++-- .../Authorization/AccompanyingPeriodResourceVoter.php | 4 ++-- .../Security/Authorization/AccompanyingPeriodVoter.php | 2 +- .../AccompanyingPeriodWorkEvaluationDocumentVoter.php | 2 +- .../AccompanyingPeriodWorkEvaluationVoter.php | 2 +- .../Security/Authorization/HouseholdVoter.php | 2 +- .../Security/Authorization/ReportVoter.php | 4 ++-- .../ChillTaskBundle/Security/Authorization/TaskVoter.php | 4 ++-- .../Security/Voter/ThirdPartyVoter.php | 2 +- 19 files changed, 31 insertions(+), 36 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Security/Authorization/ActivityStatsVoter.php b/src/Bundle/ChillActivityBundle/Security/Authorization/ActivityStatsVoter.php index 1ba72f7d5..d0b7fd949 100644 --- a/src/Bundle/ChillActivityBundle/Security/Authorization/ActivityStatsVoter.php +++ b/src/Bundle/ChillActivityBundle/Security/Authorization/ActivityStatsVoter.php @@ -53,13 +53,13 @@ class ActivityStatsVoter extends AbstractChillVoter implements ProvideRoleHierar } #[\Override] - protected function supports($attribute, $subject) + protected function supports($attribute, $subject): bool { return $this->helper->supports($attribute, $subject); } #[\Override] - protected function voteOnAttribute($attribute, $subject, TokenInterface $token) + protected function voteOnAttribute($attribute, $subject, TokenInterface $token): bool { return $this->helper->voteOnAttribute($attribute, $subject, $token); } diff --git a/src/Bundle/ChillBudgetBundle/Security/Authorization/BudgetElementVoter.php b/src/Bundle/ChillBudgetBundle/Security/Authorization/BudgetElementVoter.php index 906cc0406..fa97945e1 100644 --- a/src/Bundle/ChillBudgetBundle/Security/Authorization/BudgetElementVoter.php +++ b/src/Bundle/ChillBudgetBundle/Security/Authorization/BudgetElementVoter.php @@ -68,13 +68,13 @@ class BudgetElementVoter extends Voter implements ProvideRoleHierarchyInterface } #[\Override] - protected function supports($attribute, $subject) + protected function supports($attribute, $subject): bool { return $this->voter->supports($attribute, $subject); } #[\Override] - protected function voteOnAttribute($attribute, $subject, TokenInterface $token) + protected function voteOnAttribute($attribute, $subject, TokenInterface $token): bool { if ( $subject instanceof Person diff --git a/src/Bundle/ChillDocStoreBundle/Security/Authorization/PersonDocumentVoter.php b/src/Bundle/ChillDocStoreBundle/Security/Authorization/PersonDocumentVoter.php index 2c1b05676..e8c849a3d 100644 --- a/src/Bundle/ChillDocStoreBundle/Security/Authorization/PersonDocumentVoter.php +++ b/src/Bundle/ChillDocStoreBundle/Security/Authorization/PersonDocumentVoter.php @@ -74,7 +74,7 @@ class PersonDocumentVoter extends AbstractChillVoter implements ProvideRoleHiera } #[\Override] - protected function supports($attribute, $subject) + protected function supports($attribute, $subject): bool { return $this->voterHelper->supports($attribute, $subject); } @@ -86,7 +86,7 @@ class PersonDocumentVoter extends AbstractChillVoter implements ProvideRoleHiera * @return bool */ #[\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)); diff --git a/src/Bundle/ChillEventBundle/Security/EventVoter.php b/src/Bundle/ChillEventBundle/Security/EventVoter.php index ff8956e9a..35bcf0bc3 100644 --- a/src/Bundle/ChillEventBundle/Security/EventVoter.php +++ b/src/Bundle/ChillEventBundle/Security/EventVoter.php @@ -82,13 +82,13 @@ class EventVoter extends AbstractChillVoter implements ProvideRoleHierarchyInter } #[\Override] - public function supports($attribute, $subject) + public function supports($attribute, $subject): bool { return $this->voterHelper->supports($attribute, $subject); } #[\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)); diff --git a/src/Bundle/ChillEventBundle/Security/ParticipationVoter.php b/src/Bundle/ChillEventBundle/Security/ParticipationVoter.php index 3407874d0..75c574626 100644 --- a/src/Bundle/ChillEventBundle/Security/ParticipationVoter.php +++ b/src/Bundle/ChillEventBundle/Security/ParticipationVoter.php @@ -79,18 +79,13 @@ class ParticipationVoter extends AbstractChillVoter implements ProvideRoleHierar } #[\Override] - public function supports($attribute, $subject) + public function supports($attribute, $subject): bool { return $this->voterHelper->supports($attribute, $subject); } - /** - * @param string $attribute - * - * @return bool - */ #[\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)); diff --git a/src/Bundle/ChillJobBundle/src/Security/Authorization/ExportsJobVoter.php b/src/Bundle/ChillJobBundle/src/Security/Authorization/ExportsJobVoter.php index 4d24155b0..961084490 100644 --- a/src/Bundle/ChillJobBundle/src/Security/Authorization/ExportsJobVoter.php +++ b/src/Bundle/ChillJobBundle/src/Security/Authorization/ExportsJobVoter.php @@ -46,7 +46,7 @@ class ExportsJobVoter extends AbstractChillVoter implements ProvideRoleHierarchy * @return bool */ #[\Override] - protected function supports($attribute, $subject) + protected function supports($attribute, $subject): bool { if ($subject instanceof Center) { return self::EXPORT === $attribute; @@ -62,7 +62,7 @@ class ExportsJobVoter extends AbstractChillVoter implements ProvideRoleHierarchy * @return bool */ #[\Override] - protected function voteOnAttribute($attribute, $subject, TokenInterface $token) + protected function voteOnAttribute($attribute, $subject, TokenInterface $token): bool { $user = $token->getUser(); diff --git a/src/Bundle/ChillJobBundle/src/Security/Authorization/JobVoter.php b/src/Bundle/ChillJobBundle/src/Security/Authorization/JobVoter.php index 5a6951e1b..c157fc6f1 100644 --- a/src/Bundle/ChillJobBundle/src/Security/Authorization/JobVoter.php +++ b/src/Bundle/ChillJobBundle/src/Security/Authorization/JobVoter.php @@ -50,7 +50,7 @@ class JobVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterfa } #[\Override] - protected function supports($attribute, $subject) + protected function supports($attribute, $subject): bool { if (!\in_array($attribute, self::ALL, true)) { return false; @@ -68,7 +68,7 @@ class JobVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterfa } #[\Override] - protected function voteOnAttribute($attribute, $subject, TokenInterface $token) + protected function voteOnAttribute($attribute, $subject, TokenInterface $token): bool { if ($subject instanceof Person) { $center = $subject->getCenter(); diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/EntityWorkflowVoter.php b/src/Bundle/ChillMainBundle/Security/Authorization/EntityWorkflowVoter.php index 3c558b515..dec45295c 100644 --- a/src/Bundle/ChillMainBundle/Security/Authorization/EntityWorkflowVoter.php +++ b/src/Bundle/ChillMainBundle/Security/Authorization/EntityWorkflowVoter.php @@ -30,7 +30,7 @@ class EntityWorkflowVoter extends Voter public function __construct(private readonly EntityWorkflowManager $manager, private readonly Security $security) {} #[\Override] - protected function supports($attribute, $subject) + protected function supports($attribute, $subject): bool { return $subject instanceof EntityWorkflow && \in_array($attribute, self::getRoles(), true); } diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/WorkflowEntityDeletionVoter.php b/src/Bundle/ChillMainBundle/Security/Authorization/WorkflowEntityDeletionVoter.php index 7dbb94ac0..bee2b7415 100644 --- a/src/Bundle/ChillMainBundle/Security/Authorization/WorkflowEntityDeletionVoter.php +++ b/src/Bundle/ChillMainBundle/Security/Authorization/WorkflowEntityDeletionVoter.php @@ -23,7 +23,7 @@ class WorkflowEntityDeletionVoter extends Voter public function __construct(private $handlers, private readonly EntityWorkflowRepository $entityWorkflowRepository) {} #[\Override] - protected function supports($attribute, $subject) + protected function supports($attribute, $subject): bool { if (!\is_object($subject)) { return false; @@ -40,7 +40,7 @@ class WorkflowEntityDeletionVoter extends Voter } #[\Override] - protected function voteOnAttribute($attribute, $subject, TokenInterface $token) + protected function voteOnAttribute($attribute, $subject, TokenInterface $token): bool { foreach ($this->handlers as $handler) { if ($handler->isObjectSupported($subject)) { diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php index 909fc72de..869c87521 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php @@ -625,7 +625,7 @@ class AccompanyingPeriod implements } #[\Override] - public function getGroupSequence() + public function getGroupSequence(): array|Assert\GroupSequence { if (self::STEP_DRAFT === $this->getStep()) { return [[self::STEP_DRAFT]]; diff --git a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodCommentVoter.php b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodCommentVoter.php index 791190fd0..93ddcca2b 100644 --- a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodCommentVoter.php +++ b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodCommentVoter.php @@ -25,13 +25,13 @@ class AccompanyingPeriodCommentVoter extends Voter public function __construct(private readonly Security $security) {} #[\Override] - protected function supports($attribute, $subject) + protected function supports($attribute, $subject): bool { return $subject instanceof Comment; } #[\Override] - protected function voteOnAttribute($attribute, $subject, TokenInterface $token) + protected function voteOnAttribute($attribute, $subject, TokenInterface $token): bool { return match ($attribute) { self::EDIT => $this->security->isGranted(AccompanyingPeriodVoter::EDIT, $subject->getAccompanyingPeriod()), diff --git a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodResourceVoter.php b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodResourceVoter.php index 3f749eae0..07872dc51 100644 --- a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodResourceVoter.php +++ b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodResourceVoter.php @@ -23,13 +23,13 @@ class AccompanyingPeriodResourceVoter extends Voter public function __construct(private readonly AccessDecisionManagerInterface $accessDecisionManager) {} #[\Override] - protected function supports($attribute, $subject) + protected function supports($attribute, $subject): bool { return $subject instanceof Resource && self::EDIT === $attribute; } #[\Override] - protected function voteOnAttribute($attribute, $subject, TokenInterface $token) + protected function voteOnAttribute($attribute, $subject, TokenInterface $token): bool { return match ($attribute) { self::EDIT => $this->accessDecisionManager->decide( diff --git a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodVoter.php b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodVoter.php index ce7d63150..e839b0d2f 100644 --- a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodVoter.php +++ b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodVoter.php @@ -151,7 +151,7 @@ class AccompanyingPeriodVoter extends AbstractChillVoter implements ProvideRoleH } #[\Override] - protected function supports($attribute, $subject) + protected function supports($attribute, $subject): bool { return $this->voterHelper->supports($attribute, $subject); } diff --git a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodWorkEvaluationDocumentVoter.php b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodWorkEvaluationDocumentVoter.php index b99083dfc..320b32850 100644 --- a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodWorkEvaluationDocumentVoter.php +++ b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodWorkEvaluationDocumentVoter.php @@ -28,7 +28,7 @@ class AccompanyingPeriodWorkEvaluationDocumentVoter extends Voter public function __construct(private readonly AccessDecisionManagerInterface $accessDecisionManager) {} #[\Override] - protected function supports($attribute, $subject) + protected function supports($attribute, $subject): bool { return $subject instanceof AccompanyingPeriodWorkEvaluationDocument && self::SEE === $attribute; diff --git a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodWorkEvaluationVoter.php b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodWorkEvaluationVoter.php index 5978427be..c415d5c4b 100644 --- a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodWorkEvaluationVoter.php +++ b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodWorkEvaluationVoter.php @@ -31,7 +31,7 @@ class AccompanyingPeriodWorkEvaluationVoter extends Voter implements ChillVoterI public function __construct(private readonly Security $security) {} #[\Override] - protected function supports($attribute, $subject) + protected function supports($attribute, $subject): bool { return $subject instanceof AccompanyingPeriodWorkEvaluation && \in_array($attribute, self::ALL, true); diff --git a/src/Bundle/ChillPersonBundle/Security/Authorization/HouseholdVoter.php b/src/Bundle/ChillPersonBundle/Security/Authorization/HouseholdVoter.php index b3baddd7a..24bf19b7c 100644 --- a/src/Bundle/ChillPersonBundle/Security/Authorization/HouseholdVoter.php +++ b/src/Bundle/ChillPersonBundle/Security/Authorization/HouseholdVoter.php @@ -70,7 +70,7 @@ class HouseholdVoter extends Voter implements ProvideRoleHierarchyInterface, Chi } #[\Override] - protected function supports($attribute, $subject) + protected function supports($attribute, $subject): bool { return ($subject instanceof Household && \in_array($attribute, self::ALL, true)) diff --git a/src/Bundle/ChillReportBundle/Security/Authorization/ReportVoter.php b/src/Bundle/ChillReportBundle/Security/Authorization/ReportVoter.php index 78d0dd0b0..6421d4e66 100644 --- a/src/Bundle/ChillReportBundle/Security/Authorization/ReportVoter.php +++ b/src/Bundle/ChillReportBundle/Security/Authorization/ReportVoter.php @@ -58,7 +58,7 @@ class ReportVoter extends AbstractChillVoter implements ProvideRoleHierarchyInte } #[\Override] - protected function supports($attribute, $subject) + protected function supports($attribute, $subject): bool { if ($subject instanceof Report) { return \in_array($attribute, [ @@ -72,7 +72,7 @@ class ReportVoter extends AbstractChillVoter implements ProvideRoleHierarchyInte } #[\Override] - protected function voteOnAttribute($attribute, $subject, TokenInterface $token) + protected function voteOnAttribute($attribute, $subject, TokenInterface $token): bool { if (!$token->getUser() instanceof User) { return false; diff --git a/src/Bundle/ChillTaskBundle/Security/Authorization/TaskVoter.php b/src/Bundle/ChillTaskBundle/Security/Authorization/TaskVoter.php index 2c9d5b683..143d02615 100644 --- a/src/Bundle/ChillTaskBundle/Security/Authorization/TaskVoter.php +++ b/src/Bundle/ChillTaskBundle/Security/Authorization/TaskVoter.php @@ -84,13 +84,13 @@ final class TaskVoter extends AbstractChillVoter implements ProvideRoleHierarchy } #[\Override] - public function supports($attribute, $subject) + public function supports($attribute, $subject): bool { return $this->voter->supports($attribute, $subject); } #[\Override] - protected function voteOnAttribute($attribute, $subject, TokenInterface $token) + protected function voteOnAttribute($attribute, $subject, TokenInterface $token): bool { if (!$token->getUser() instanceof User) { return false; diff --git a/src/Bundle/ChillThirdPartyBundle/Security/Voter/ThirdPartyVoter.php b/src/Bundle/ChillThirdPartyBundle/Security/Voter/ThirdPartyVoter.php index c9a346700..97b0841b7 100644 --- a/src/Bundle/ChillThirdPartyBundle/Security/Voter/ThirdPartyVoter.php +++ b/src/Bundle/ChillThirdPartyBundle/Security/Voter/ThirdPartyVoter.php @@ -62,7 +62,7 @@ class ThirdPartyVoter extends AbstractChillVoter implements ProvideRoleHierarchy } #[\Override] - protected function supports($attribute, $subject) + protected function supports($attribute, $subject): bool { if ($subject instanceof ThirdParty) { return \in_array($attribute, $this->getRoles(), true);