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]
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);
}

View File

@ -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

View File

@ -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));

View File

@ -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));

View File

@ -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));

View File

@ -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();

View File

@ -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();

View File

@ -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);
}

View File

@ -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)) {

View File

@ -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]];

View File

@ -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()),

View File

@ -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(

View File

@ -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);
}

View File

@ -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;

View File

@ -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);

View File

@ -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))

View File

@ -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;

View File

@ -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;

View File

@ -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);