src/Standards/BestIt/Sniffs/Functions/FluentSetterSniff.php
private function fixNoReturnFound(File $phpcsFile, int $closingBracePtr): void
    {
        $tokens = $phpcsFile->getTokens();
        $closingBraceToken = $tokens[$closingBracePtr];

        $expectedReturnSpaces = str_repeat($this->identation, $closingBraceToken['level'] + 1);

        $phpcsFile->fixer->beginChangeset();
        $phpcsFile->fixer->addNewlineBefore($closingBracePtr - 1);
        $phpcsFile->fixer->addContentBefore($closingBracePtr - 1, $expectedReturnSpaces . 'return $this;');
        $phpcsFile->fixer->addNewlineBefore($closingBracePtr - 1);
        $phpcsFile->fixer->endChangeset();
    }
private function fixNoReturnFound(File $phpcsFile, int $closingBracePtr): void
    {
        $tokens = $phpcsFile->getTokens();
        $closingBraceToken = $tokens[$closingBracePtr];

        $expectedReturnSpaces = str_repeat($this->identation, $closingBraceToken['level'] + 1);

        $phpcsFile->fixer->beginChangeset();
        $phpcsFile->fixer->addNewlineBefore($closingBracePtr - 1);
        $phpcsFile->fixer->addContentBefore($closingBracePtr - 1, $expectedReturnSpaces . 'return $this;');
        $phpcsFile->fixer->addNewlineBefore($closingBracePtr - 1);
        $phpcsFile->fixer->endChangeset();
    }
private function fixNoReturnFound ( File $ phpcsFile , int $ closingBracePtr ) : void { $ tokens = $ phpcsFile -> getTokens ( ) ; $ closingBraceToken = $ tokens [ $ closingBracePtr ] ; $ expectedReturnSpaces = str_repeat ( $ this -> identation , $ closingBraceToken [ 'level' ] + 1 ) ; $ phpcsFile -> fixer -> beginChangeset ( ) ; $ phpcsFile -> fixer -> addNewlineBefore ( $ closingBracePtr - 1 ) ; $ phpcsFile -> fixer -> addContentBefore ( $ closingBracePtr - 1 , $ expectedReturnSpaces . 'return $this;' ) ; $ phpcsFile -> fixer -> addNewlineBefore ( $ closingBracePtr - 1 ) ; $ phpcsFile -> fixer -> endChangeset ( ) ; }
Fixes if no return statement is found.

@param File $phpcsFile The php cs file
@param int $closingBracePtr Pointer to the closing curly brace of the function

@return void
Fixes if no return statement is found .