PHP/CodeSniffer/Graze/Sniffs/Commenting/MissingFunctionCommentSniff.php
public function process(File $phpcsFile, $stackPtr)
    {
        $tokens = $phpcsFile->getTokens();

        $find = Tokens::$methodPrefixes;
        $find[] = T_WHITESPACE;

        $commentEnd = $phpcsFile->findPrevious($find, ($stackPtr - 1), null, true);
        if ($tokens[$commentEnd]['code'] === T_COMMENT) {
            // Inline comments might just be closing comments for
            // control structures or functions instead of function comments
            // using the wrong comment type. If there is other code on the line,
            // assume they relate to that code.
            $prev = $phpcsFile->findPrevious($find, ($commentEnd - 1), null, true);
            if ($prev !== false && $tokens[$prev]['line'] === $tokens[$commentEnd]['line']) {
                $commentEnd = $prev;
            }
        }

        if ($tokens[$commentEnd]['code'] !== T_DOC_COMMENT_CLOSE_TAG
            && $tokens[$commentEnd]['code'] !== T_COMMENT
        ) {
            if (array_key_exists('scope_opener', $tokens[$stackPtr])
                && $this->functionHasReturn($phpcsFile, $stackPtr)) {
                $phpcsFile->addError('Function has return keyword but no doc block', $stackPtr, static::ERROR_CODE_RETURN);
                return;
            }

            if ($this->functionHasParams($phpcsFile, $stackPtr)) {
                $phpcsFile->addError('Function has parameters but no doc block', $stackPtr, static::ERROR_CODE_PARAMETER);
            }
        }
    }
public function process(File $phpcsFile, $stackPtr)
    {
        $tokens = $phpcsFile->getTokens();

        $find = Tokens::$methodPrefixes;
        $find[] = T_WHITESPACE;

        $commentEnd = $phpcsFile->findPrevious($find, ($stackPtr - 1), null, true);
        if ($tokens[$commentEnd]['code'] === T_COMMENT) {
            // Inline comments might just be closing comments for
            // control structures or functions instead of function comments
            // using the wrong comment type. If there is other code on the line,
            // assume they relate to that code.
            $prev = $phpcsFile->findPrevious($find, ($commentEnd - 1), null, true);
            if ($prev !== false && $tokens[$prev]['line'] === $tokens[$commentEnd]['line']) {
                $commentEnd = $prev;
            }
        }

        if ($tokens[$commentEnd]['code'] !== T_DOC_COMMENT_CLOSE_TAG
            && $tokens[$commentEnd]['code'] !== T_COMMENT
        ) {
            if (array_key_exists('scope_opener', $tokens[$stackPtr])
                && $this->functionHasReturn($phpcsFile, $stackPtr)) {
                $phpcsFile->addError('Function has return keyword but no doc block', $stackPtr, static::ERROR_CODE_RETURN);
                return;
            }

            if ($this->functionHasParams($phpcsFile, $stackPtr)) {
                $phpcsFile->addError('Function has parameters but no doc block', $stackPtr, static::ERROR_CODE_PARAMETER);
            }
        }
    }
@param File $phpcsFile
@param int  $stackPtr

@return int|void