private function fixSpacing(File $phpcs_file, $tokens, $required_spacing, $start, $end): void
    {
        if (($start + 1) === $end && empty($required_spacing) === false) {
            //insert whitespace if there is no whitespace, and whitespace is required
            $phpcs_file->fixer->addContent($start, $required_spacing);

            return;
        }

        //otherwise, if there is whitespace, change the whitespace to the required spacing
        for ($i = ($start + 1); $i < $end; $i++) {
            if ($tokens[$i]['code'] !== T_WHITESPACE) {
                continue;
            }

            if (($i + 1) === $end) {
                $phpcs_file->fixer->replaceToken($i, $required_spacing);
                continue;
            }

            $phpcs_file->fixer->replaceToken($i, '');
        }
    }
private function fixSpacing(File $phpcs_file, $tokens, $required_spacing, $start, $end): void
    {
        if (($start + 1) === $end && empty($required_spacing) === false) {
            //insert whitespace if there is no whitespace, and whitespace is required
            $phpcs_file->fixer->addContent($start, $required_spacing);

            return;
        }

        //otherwise, if there is whitespace, change the whitespace to the required spacing
        for ($i = ($start + 1); $i < $end; $i++) {
            if ($tokens[$i]['code'] !== T_WHITESPACE) {
                continue;
            }

            if (($i + 1) === $end) {
                $phpcs_file->fixer->replaceToken($i, $required_spacing);
                continue;
            }

            $phpcs_file->fixer->replaceToken($i, '');
        }
    }
private function fixSpacing ( File $ phpcs_file , $ tokens , $ required_spacing , $ start , $ end ) : void { if ( ( $ start + 1 ) === $ end && empty ( $ required_spacing ) === false ) { //insert whitespace if there is no whitespace, and whitespace is required $ phpcs_file -> fixer -> addContent ( $ start , $ required_spacing ) ; return ; } //otherwise, if there is whitespace, change the whitespace to the required spacing for ( $ i = ( $ start + 1 ) ; $ i < $ end ; $ i ++ ) { if ( $ tokens [ $ i ] [ 'code' ] !== T_WHITESPACE ) { continue ; } if ( ( $ i + 1 ) === $ end ) { $ phpcs_file -> fixer -> replaceToken ( $ i , $ required_spacing ) ; continue ; } $ phpcs_file -> fixer -> replaceToken ( $ i , '' ) ; } }
Fix the spacing between start and end

@param File $phpcs_file The file being scanned.
@param array $tokens Token stack for this file
@param string $required_spacing Required spacing between start and end
@param int $start Position of the start in the token stack
@param int $end Position of the end in the token stack

@return void
Fix the spacing between start and end