public static function toClassname($string)
    {
        if (empty($string)) {
            return null;
        }

        $classnameMatches = [];
        if (preg_match('/^([a-zA-Z_]{1}[a-zA-Z0-9_\\\\]*)\::class$/', $string, $classnameMatches) != false) {
            if (class_exists($classnameMatches[1])) {
                return $classnameMatches[1];
            }
        }

        return null;
    }