mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-10-05 21:09:43 +00:00
DX: apply rector rules up to php8.0
This commit is contained in:
@@ -21,11 +21,8 @@ class AccompanyingPeriodResourceVoter extends Voter
|
||||
{
|
||||
public const EDIT = 'CHILL_PERSON_ACCOMPANYING_PERIOD_RESOURCE_EDIT';
|
||||
|
||||
private AccessDecisionManagerInterface $accessDecisionManager;
|
||||
|
||||
public function __construct(AccessDecisionManagerInterface $accessDecisionManager)
|
||||
public function __construct(private AccessDecisionManagerInterface $accessDecisionManager)
|
||||
{
|
||||
$this->accessDecisionManager = $accessDecisionManager;
|
||||
}
|
||||
|
||||
protected function supports($attribute, $subject)
|
||||
@@ -35,17 +32,13 @@ class AccompanyingPeriodResourceVoter extends Voter
|
||||
|
||||
protected function voteOnAttribute($attribute, $subject, TokenInterface $token)
|
||||
{
|
||||
/** @var \Chill\PersonBundle\Entity\AccompanyingPeriod\Resource $subject */
|
||||
switch ($attribute) {
|
||||
case self::EDIT:
|
||||
return $this->accessDecisionManager->decide(
|
||||
$token,
|
||||
[AccompanyingPeriodVoter::EDIT],
|
||||
$subject->getAccompanyingPeriod()
|
||||
);
|
||||
|
||||
default:
|
||||
throw new UnexpectedValueException("attribute not supported: {$attribute}");
|
||||
}
|
||||
return match ($attribute) {
|
||||
self::EDIT => $this->accessDecisionManager->decide(
|
||||
$token,
|
||||
[AccompanyingPeriodVoter::EDIT],
|
||||
$subject->getAccompanyingPeriod()
|
||||
),
|
||||
default => throw new UnexpectedValueException("attribute not supported: {$attribute}"),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user