getScope(); } if ($entity instanceof HasScopesInterface) { return $entity->getScopes(); } throw new UnexpectedValueException( 'should be an instanceof %s or %s', HasScopesInterface::class, HasScopeInterface::class ); } public function supports($entity, ?array $options = []): bool { return $entity instanceof HasScopeInterface || $entity instanceof HasScopesInterface; } }