public function isClassConstant(File $phpcsFile, $stackPtr)
    {
        $tokens = $phpcsFile->getTokens();

        if (isset($tokens[$stackPtr]) === false || $tokens[$stackPtr]['code'] !== \T_CONST) {
            return false;
        }

        // Note: traits can not declare constants.
        $validScopes = array(
            'T_CLASS'      => true,
            'T_ANON_CLASS' => true,
            'T_INTERFACE'  => true,
        );
        if ($this->validDirectScope($phpcsFile, $stackPtr, $validScopes) !== false) {
            return true;
        }

        return false;
    }
public function isClassConstant(File $phpcsFile, $stackPtr)
    {
        $tokens = $phpcsFile->getTokens();

        if (isset($tokens[$stackPtr]) === false || $tokens[$stackPtr]['code'] !== \T_CONST) {
            return false;
        }

        // Note: traits can not declare constants.
        $validScopes = array(
            'T_CLASS'      => true,
            'T_ANON_CLASS' => true,
            'T_INTERFACE'  => true,
        );
        if ($this->validDirectScope($phpcsFile, $stackPtr, $validScopes) !== false) {
            return true;
        }

        return false;
    }
public function isClassConstant ( File $ phpcsFile , $ stackPtr ) { $ tokens = $ phpcsFile -> getTokens ( ) ; if ( isset ( $ tokens [ $ stackPtr ] ) === false || $ tokens [ $ stackPtr ] [ 'code' ] !== \ T_CONST ) { return false ; } // Note: traits can not declare constants. $ validScopes = array ( 'T_CLASS' => true , 'T_ANON_CLASS' => true , 'T_INTERFACE' => true , ) ; if ( $ this -> validDirectScope ( $ phpcsFile , $ stackPtr , $ validScopes ) !== false ) { return true ; } return false ; }
Check whether a T_CONST token is a class constant declaration.

@param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile.
@param int                   $stackPtr  The position in the stack of the
T_CONST token to verify.

@return bool
Check whether a T_CONST token is a class constant declaration .