protected function processDeprecated(PHP_CodeSniffer_File $phpcsFile, $stackPtr, $commentStart)
    {
        $tokens = $phpcsFile->getTokens();
        foreach ($tokens[$commentStart]['comment_tags'] as $pos => $tag) {
            if ($tokens[$tag]['content'] !== '@deprecated') {
                continue;
            }

            $content = $tokens[($tag + 2)]['content'];
            if (empty($content) === true || $tokens[($tag + 2)]['code'] !== T_DOC_COMMENT_STRING) {
                $error = 'Deprecated type missing for @deprecated tag in function comment';
                $phpcsFile->addError($error, $tag, 'MissingDeprecatedType');
            } else {
                //ONGR Validate that return comment begins with capital letter and ends with full stop.
                if ($content !== null) {
                    $firstChar = $content{0};
                    if (preg_match('|\p{Lu}|u', $firstChar) === 0) {
                        $error = 'Deprecated comment must start with a capital letter';
                        $fix = $phpcsFile->addFixableError($error, ($tag + 2), 'DeprecatedCommentNotCapital');

                        if ($fix === true) {
                            $newComment = ucfirst($content);
                            $tokenLength = strlen($tokens[($tag + 2)]['content']);
                            $commentLength = strlen($content);
                            $tokenWithoutComment
                                = substr($tokens[($tag + 2)]['content'], 0, $tokenLength - $commentLength);

                            $phpcsFile->fixer->replaceToken(($tag + 2), $tokenWithoutComment . $newComment);
                        }
                    }

                    $lastChar = substr($content, -1);
                    if ($lastChar !== '.') {
                        $error = 'Deprecated comment must end with a full stop';
                        $fix = $phpcsFile->addFixableError($error, ($tag + 2), 'DeprecatedCommentFullStop');

                        if ($fix === true) {
                            $phpcsFile->fixer->addContent(($tag + 2), '.');
                        }
                    }
                }
            }
        }
    }
protected function processDeprecated(PHP_CodeSniffer_File $phpcsFile, $stackPtr, $commentStart)
    {
        $tokens = $phpcsFile->getTokens();
        foreach ($tokens[$commentStart]['comment_tags'] as $pos => $tag) {
            if ($tokens[$tag]['content'] !== '@deprecated') {
                continue;
            }

            $content = $tokens[($tag + 2)]['content'];
            if (empty($content) === true || $tokens[($tag + 2)]['code'] !== T_DOC_COMMENT_STRING) {
                $error = 'Deprecated type missing for @deprecated tag in function comment';
                $phpcsFile->addError($error, $tag, 'MissingDeprecatedType');
            } else {
                //ONGR Validate that return comment begins with capital letter and ends with full stop.
                if ($content !== null) {
                    $firstChar = $content{0};
                    if (preg_match('|\p{Lu}|u', $firstChar) === 0) {
                        $error = 'Deprecated comment must start with a capital letter';
                        $fix = $phpcsFile->addFixableError($error, ($tag + 2), 'DeprecatedCommentNotCapital');

                        if ($fix === true) {
                            $newComment = ucfirst($content);
                            $tokenLength = strlen($tokens[($tag + 2)]['content']);
                            $commentLength = strlen($content);
                            $tokenWithoutComment
                                = substr($tokens[($tag + 2)]['content'], 0, $tokenLength - $commentLength);

                            $phpcsFile->fixer->replaceToken(($tag + 2), $tokenWithoutComment . $newComment);
                        }
                    }

                    $lastChar = substr($content, -1);
                    if ($lastChar !== '.') {
                        $error = 'Deprecated comment must end with a full stop';
                        $fix = $phpcsFile->addFixableError($error, ($tag + 2), 'DeprecatedCommentFullStop');

                        if ($fix === true) {
                            $phpcsFile->fixer->addContent(($tag + 2), '.');
                        }
                    }
                }
            }
        }
    }
protected function processDeprecated ( PHP_CodeSniffer_File $ phpcsFile , $ stackPtr , $ commentStart ) { $ tokens = $ phpcsFile -> getTokens ( ) ; foreach ( $ tokens [ $ commentStart ] [ 'comment_tags' ] as $ pos => $ tag ) { if ( $ tokens [ $ tag ] [ 'content' ] !== '@deprecated' ) { continue ; } $ content = $ tokens [ ( $ tag + 2 ) ] [ 'content' ] ; if ( empty ( $ content ) === true || $ tokens [ ( $ tag + 2 ) ] [ 'code' ] !== T_DOC_COMMENT_STRING ) { $ error = 'Deprecated type missing for @deprecated tag in function comment' ; $ phpcsFile -> addError ( $ error , $ tag , 'MissingDeprecatedType' ) ; } else { //ONGR Validate that return comment begins with capital letter and ends with full stop. if ( $ content !== null ) { $ firstChar = $ content { 0 } ; if ( preg_match ( '|\p{Lu}|u' , $ firstChar ) === 0 ) { $ error = 'Deprecated comment must start with a capital letter' ; $ fix = $ phpcsFile -> addFixableError ( $ error , ( $ tag + 2 ) , 'DeprecatedCommentNotCapital' ) ; if ( $ fix === true ) { $ newComment = ucfirst ( $ content ) ; $ tokenLength = strlen ( $ tokens [ ( $ tag + 2 ) ] [ 'content' ] ) ; $ commentLength = strlen ( $ content ) ; $ tokenWithoutComment = substr ( $ tokens [ ( $ tag + 2 ) ] [ 'content' ] , 0 , $ tokenLength - $ commentLength ) ; $ phpcsFile -> fixer -> replaceToken ( ( $ tag + 2 ) , $ tokenWithoutComment . $ newComment ) ; } } $ lastChar = substr ( $ content , - 1 ) ; if ( $ lastChar !== '.' ) { $ error = 'Deprecated comment must end with a full stop' ; $ fix = $ phpcsFile -> addFixableError ( $ error , ( $ tag + 2 ) , 'DeprecatedCommentFullStop' ) ; if ( $ fix === true ) { $ phpcsFile -> fixer -> addContent ( ( $ tag + 2 ) , '.' ) ; } } } } } }
Process any deprecated tags that this function comment has.

@param PHP_CodeSniffer_File $phpcsFile    The file being scanned.
@param int                  $stackPtr     The position of the current token
in the stack passed in $tokens.
@param int                  $commentStart The position in the stack where the comment started.

@return void
Process any deprecated tags that this function comment has .