src/Standards/BestIt/Sniffs/Functions/MultipleReturnSniff.php
private function loadReturnsOfThisFunction(): array
    {
        $returnPositions = TokenHelper::findNextAll(
            $this->file->getBaseFile(),
            [T_RETURN],
            $this->stackPos + 1,
            $this->token['scope_closer']
        );

        return array_filter($returnPositions, function (int $returnPos): bool {
            $possibleClosure = $this->file->findPrevious([T_CLOSURE, T_FUNCTION], $returnPos - 1, $this->stackPos);

            return $possibleClosure === $this->stackPos;
        });
    }
private function loadReturnsOfThisFunction(): array
    {
        $returnPositions = TokenHelper::findNextAll(
            $this->file->getBaseFile(),
            [T_RETURN],
            $this->stackPos + 1,
            $this->token['scope_closer']
        );

        return array_filter($returnPositions, function (int $returnPos): bool {
            $possibleClosure = $this->file->findPrevious([T_CLOSURE, T_FUNCTION], $returnPos - 1, $this->stackPos);

            return $possibleClosure === $this->stackPos;
        });
    }
private function loadReturnsOfThisFunction ( ) : array { $ returnPositions = TokenHelper :: findNextAll ( $ this -> file -> getBaseFile ( ) , [ T_RETURN ] , $ this -> stackPos + 1 , $ this -> token [ 'scope_closer' ] ) ; return array_filter ( $ returnPositions , function ( int $ returnPos ) : bool { $ possibleClosure = $ this -> file -> findPrevious ( [ T_CLOSURE , T_FUNCTION ] , $ returnPos - 1 , $ this -> stackPos ) ; return $ possibleClosure === $ this -> stackPos ; } ) ; }
Returns the returns of this function.

We check the "token level" to exclude the returns of nested closures.

@return int[] The positions of the returns from the same function-scope.
Returns the returns of this function .