src/Standards/BestIt/Sniffs/TypeHints/ReturnTypeDeclarationSniff.php
private function addReturnType(): void
    {
        $file = $this->getFile();
        $returnTypeHint = $this->createReturnType();

        $file->fixer->beginChangeset();

        if ($this->isCustomArrayType($returnTypeHint)) {
            $returnTypeHint = ($returnTypeHint[0] === '?' ? '?' : '') . 'array';
        }

        $file->fixer->addContent(
            $this->token['parenthesis_closer'],
            ': ' . $returnTypeHint
        );

        $file->fixer->endChangeset();
    }
private function addReturnType(): void
    {
        $file = $this->getFile();
        $returnTypeHint = $this->createReturnType();

        $file->fixer->beginChangeset();

        if ($this->isCustomArrayType($returnTypeHint)) {
            $returnTypeHint = ($returnTypeHint[0] === '?' ? '?' : '') . 'array';
        }

        $file->fixer->addContent(
            $this->token['parenthesis_closer'],
            ': ' . $returnTypeHint
        );

        $file->fixer->endChangeset();
    }
private function addReturnType ( ) : void { $ file = $ this -> getFile ( ) ; $ returnTypeHint = $ this -> createReturnType ( ) ; $ file -> fixer -> beginChangeset ( ) ; if ( $ this -> isCustomArrayType ( $ returnTypeHint ) ) { $ returnTypeHint = ( $ returnTypeHint [ 0 ] === '?' ? '?' : '' ) . 'array' ; } $ file -> fixer -> addContent ( $ this -> token [ 'parenthesis_closer' ] , ': ' . $ returnTypeHint ) ; $ file -> fixer -> endChangeset ( ) ; }
Adds the return type to fix the error.

@return void
Adds the return type to fix the error .