PHP/CodeSniffer/Graze/Sniffs/Commenting/MissingFunctionCommentSniff.php
private function functionHasReturn(File $phpcsFile, $stackPtr)
    {
        $tokens = $phpcsFile->getTokens();
        $start = $tokens[$stackPtr]['scope_opener'];
        $end = $tokens[$stackPtr]['scope_closer'];

        for ($i = $start; $i <= $end; $i++) {
            if ($tokens[$i]['code'] === T_CLOSURE || $tokens[$i]['code'] === T_FUNCTION) {
                // skip over closures within our function
                $i = $tokens[$i]['scope_closer'];
            }

            // if we hit a return keyword that isn't immediately followed by a semicolon, we need a doc block
            if ($tokens[$i]['code'] === T_RETURN && $tokens[$i + 1]['code'] !== T_SEMICOLON) {
                return true;
            }
        }

        return false;
    }
private function functionHasReturn(File $phpcsFile, $stackPtr)
    {
        $tokens = $phpcsFile->getTokens();
        $start = $tokens[$stackPtr]['scope_opener'];
        $end = $tokens[$stackPtr]['scope_closer'];

        for ($i = $start; $i <= $end; $i++) {
            if ($tokens[$i]['code'] === T_CLOSURE || $tokens[$i]['code'] === T_FUNCTION) {
                // skip over closures within our function
                $i = $tokens[$i]['scope_closer'];
            }

            // if we hit a return keyword that isn't immediately followed by a semicolon, we need a doc block
            if ($tokens[$i]['code'] === T_RETURN && $tokens[$i + 1]['code'] !== T_SEMICOLON) {
                return true;
            }
        }

        return false;
    }
@param File $phpcsFile
@param int  $stackPtr

@return bool