$this->security->isGranted(CalendarVoter::EDIT, $subject), self::SEE => $this->security->isGranted(CalendarVoter::SEE, $subject), default => throw new LogicException('attribute not supported for this Voter'), }; } elseif ($subject instanceof CalendarDoc) { 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), }; } throw new LogicException('Subject not supported for this Voter'); } }