src/Standards/BestIt/Sniffs/DocTags/RequiredMethodTagsSniff.php
protected function fixMinReturn(int $stackPos): void
    {
        $closePos = $this->tokens[$stackPos]['comment_closer'];
        $closeTag = $this->tokens[$closePos];
        $indent = str_repeat(' ', $closeTag['column'] - 1);
        $fileDecorator = $this->getFile();

        $returnTypeHint = FunctionHelper::findReturnTypeHint(
            $fileDecorator->getBaseFile(),
            $fileDecorator->findNext([T_FUNCTION], $closePos + 1)
        );

        $typeHint = $returnTypeHint ? $returnTypeHint->getTypeHint() : 'void';

        $fixer = $fileDecorator->fixer;

        $fixer->beginChangeset();

        $fixer->replaceToken(
            $closePos,
            "*\n{$indent}* @return {$typeHint}\n{$indent}{$closeTag['content']}"
        );

        $fixer->endChangeset();
    }
protected function fixMinReturn(int $stackPos): void
    {
        $closePos = $this->tokens[$stackPos]['comment_closer'];
        $closeTag = $this->tokens[$closePos];
        $indent = str_repeat(' ', $closeTag['column'] - 1);
        $fileDecorator = $this->getFile();

        $returnTypeHint = FunctionHelper::findReturnTypeHint(
            $fileDecorator->getBaseFile(),
            $fileDecorator->findNext([T_FUNCTION], $closePos + 1)
        );

        $typeHint = $returnTypeHint ? $returnTypeHint->getTypeHint() : 'void';

        $fixer = $fileDecorator->fixer;

        $fixer->beginChangeset();

        $fixer->replaceToken(
            $closePos,
            "*\n{$indent}* @return {$typeHint}\n{$indent}{$closeTag['content']}"
        );

        $fixer->endChangeset();
    }
protected function fixMinReturn ( int $ stackPos ) : void { $ closePos = $ this -> tokens [ $ stackPos ] [ 'comment_closer' ] ; $ closeTag = $ this -> tokens [ $ closePos ] ; $ indent = str_repeat ( ' ' , $ closeTag [ 'column' ] - 1 ) ; $ fileDecorator = $ this -> getFile ( ) ; $ returnTypeHint = FunctionHelper :: findReturnTypeHint ( $ fileDecorator -> getBaseFile ( ) , $ fileDecorator -> findNext ( [ T_FUNCTION ] , $ closePos + 1 ) ) ; $ typeHint = $ returnTypeHint ? $ returnTypeHint -> getTypeHint ( ) : 'void' ; $ fixer = $ fileDecorator -> fixer ; $ fixer -> beginChangeset ( ) ; $ fixer -> replaceToken ( $ closePos , "*\n{$indent}* @return {$typeHint}\n{$indent}{$closeTag['content']}" ) ; $ fixer -> endChangeset ( ) ; }
Adds a return annotation if there is none.

@param int $stackPos

@return void
Adds a return annotation if there is none .