protected function getGroups(array $annotations) :? array
    {
        if (empty($annotations)) {
            return [];
        }

        return array_values(array_unique(array_reduce($annotations, function ($carry, $annotation) {
            return array_merge($carry, $annotation->getGroups());
        }, [])));
    }