src/Utils.php
public static function calculateTrailingWhitespaceIndent(Token $token)
    {
        if (!$token->isWhitespace()) {
            throw new \InvalidArgumentException(sprintf('The given token must be whitespace, got "%s".', $token->getName()));
        }

        $str = strrchr(
            str_replace(["\r\n", "\r"], "\n", $token->getContent()),
            "\n"
        );

        if (false === $str) {
            return '';
        }

        return ltrim($str, "\n");
    }
public static function calculateTrailingWhitespaceIndent(Token $token)
    {
        if (!$token->isWhitespace()) {
            throw new \InvalidArgumentException(sprintf('The given token must be whitespace, got "%s".', $token->getName()));
        }

        $str = strrchr(
            str_replace(["\r\n", "\r"], "\n", $token->getContent()),
            "\n"
        );

        if (false === $str) {
            return '';
        }

        return ltrim($str, "\n");
    }
public static function calculateTrailingWhitespaceIndent ( Token $ token ) { if ( ! $ token -> isWhitespace ( ) ) { throw new \ InvalidArgumentException ( sprintf ( 'The given token must be whitespace, got "%s".' , $ token -> getName ( ) ) ) ; } $ str = strrchr ( str_replace ( [ "\r\n" , "\r" ] , "\n" , $ token -> getContent ( ) ) , "\n" ) ; if ( false === $ str ) { return '' ; } return ltrim ( $ str , "\n" ) ; }
Calculate the trailing whitespace.

What we're doing here is grabbing everything after the final newline.

@param Token $token

@return string
Calculate the trailing whitespace .