DX: apply rector rules up to php8.0

This commit is contained in:
2023-04-15 01:05:37 +02:00
parent d8870e906f
commit dde3002100
714 changed files with 2348 additions and 9263 deletions

View File

@@ -30,11 +30,8 @@ class AccompanyingPeriodWorkEvaluationVoter extends Voter implements ChillVoterI
public const STATS = 'CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_EVALUATION_STATS';
private Security $security;
public function __construct(Security $security)
public function __construct(private Security $security)
{
$this->security = $security;
}
protected function supports($attribute, $subject)
@@ -49,15 +46,10 @@ class AccompanyingPeriodWorkEvaluationVoter extends Voter implements ChillVoterI
*/
protected function voteOnAttribute($attribute, $subject, TokenInterface $token): bool
{
switch ($attribute) {
case self::STATS:
return $this->security->isGranted(AccompanyingPeriodVoter::STATS, $subject);
case self::SEE:
return $this->security->isGranted(AccompanyingPeriodWorkVoter::SEE, $subject->getAccompanyingPeriodWork());
default:
throw new UnexpectedValueException("attribute {$attribute} is not supported");
}
return match ($attribute) {
self::STATS => $this->security->isGranted(AccompanyingPeriodVoter::STATS, $subject),
self::SEE => $this->security->isGranted(AccompanyingPeriodWorkVoter::SEE, $subject->getAccompanyingPeriodWork()),
default => throw new UnexpectedValueException("attribute {$attribute} is not supported"),
};
}
}