src/Parser/Doctrine/StringManipulator.php
final public static function replaceAllDotsExceptLast(string $string): string
    {
        $countDots = substr_count($string, '.');
        if ($countDots > 1) {
            $stringArray = explode('.', $string);
            $string = '';
            for ($i = 0; $i < $countDots - 1; ++$i) {
                $string .= $stringArray[$i].'_';
            }
            $string .= $stringArray[$countDots - 1].'.'.$stringArray[$countDots];
        }

        return $string;
    }
final public static function replaceAllDotsExceptLast(string $string): string
    {
        $countDots = substr_count($string, '.');
        if ($countDots > 1) {
            $stringArray = explode('.', $string);
            $string = '';
            for ($i = 0; $i < $countDots - 1; ++$i) {
                $string .= $stringArray[$i].'_';
            }
            $string .= $stringArray[$countDots - 1].'.'.$stringArray[$countDots];
        }

        return $string;
    }
Will convert "object.something.cool.today" TO "object_something_cool.today".
Will convert "object.something.cool" TO "object_something.cool".
Will convert "object.something" TO "object.something".
Will convert "object" TO "object".

@param string $string

@return string