private function checkMapNames(array $map): void
    {
        $names = array_keys($map);
        $bad_names = preg_grep(self::RE_NAME, $names, PREG_GREP_INVERT);
        if ($bad_names) {
            throw new \InvalidArgumentException(
                'Bad names: ' . join(', ', $bad_names)
            );
        }
    }