src/Fixer/Whitespace/CompactNullableTypehintFixer.php
protected function applyFix(\SplFileInfo $file, Tokens $tokens)
    {
        static $typehintKinds = [
            CT::T_ARRAY_TYPEHINT,
            T_CALLABLE,
            T_NS_SEPARATOR,
            T_STRING,
        ];

        for ($index = $tokens->count() - 1; $index >= 0; --$index) {
            if (!$tokens[$index]->isGivenKind(CT::T_NULLABLE_TYPE)) {
                continue;
            }

            // remove whitespaces only if there are only whitespaces
            // between '?' and the variable type
            if (
                $tokens[$index + 1]->isWhitespace() &&
                $tokens[$index + 2]->isGivenKind($typehintKinds)
            ) {
                $tokens->removeTrailingWhitespace($index);
            }
        }
    }
protected function applyFix(\SplFileInfo $file, Tokens $tokens)
    {
        static $typehintKinds = [
            CT::T_ARRAY_TYPEHINT,
            T_CALLABLE,
            T_NS_SEPARATOR,
            T_STRING,
        ];

        for ($index = $tokens->count() - 1; $index >= 0; --$index) {
            if (!$tokens[$index]->isGivenKind(CT::T_NULLABLE_TYPE)) {
                continue;
            }

            // remove whitespaces only if there are only whitespaces
            // between '?' and the variable type
            if (
                $tokens[$index + 1]->isWhitespace() &&
                $tokens[$index + 2]->isGivenKind($typehintKinds)
            ) {
                $tokens->removeTrailingWhitespace($index);
            }
        }
    }
protected function applyFix ( \ SplFileInfo $ file , Tokens $ tokens ) { static $ typehintKinds = [ CT :: T_ARRAY_TYPEHINT , T_CALLABLE , T_NS_SEPARATOR , T_STRING , ] ; for ( $ index = $ tokens -> count ( ) - 1 ; $ index >= 0 ; -- $ index ) { if ( ! $ tokens [ $ index ] -> isGivenKind ( CT :: T_NULLABLE_TYPE ) ) { continue ; } // remove whitespaces only if there are only whitespaces // between '?' and the variable type if ( $ tokens [ $ index + 1 ] -> isWhitespace ( ) && $ tokens [ $ index + 2 ] -> isGivenKind ( $ typehintKinds ) ) { $ tokens -> removeTrailingWhitespace ( $ index ) ; } } }
{@inheritdoc}
{