mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-10-19 11:42:51 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -15,8 +15,6 @@ use Chill\CalendarBundle\Entity\CalendarDoc;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
||||
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
use UnexpectedValueException;
|
||||
use function in_array;
|
||||
|
||||
class CalendarDocVoter extends Voter
|
||||
{
|
||||
@@ -33,19 +31,18 @@ class CalendarDocVoter extends Voter
|
||||
|
||||
protected function supports($attribute, $subject): bool
|
||||
{
|
||||
return in_array($attribute, self::ALL, true) && $subject instanceof CalendarDoc;
|
||||
return \in_array($attribute, self::ALL, true) && $subject instanceof CalendarDoc;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CalendarDoc $subject
|
||||
* @param mixed $attribute
|
||||
*/
|
||||
protected function voteOnAttribute($attribute, $subject, TokenInterface $token): bool
|
||||
{
|
||||
return match ($attribute) {
|
||||
self::EDIT => $this->security->isGranted(CalendarVoter::EDIT, $subject->getCalendar()),
|
||||
self::SEE => $this->security->isGranted(CalendarVoter::SEE, $subject->getCalendar()),
|
||||
default => throw new UnexpectedValueException('Attribute not supported: ' . $attribute),
|
||||
default => throw new \UnexpectedValueException('Attribute not supported: '.$attribute),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user