protected function process_regexp_separator_e(PHP_CodeSniffer_File $phpcsFile, $stackPtr) {
        $tokens = $phpcsFile->getTokens();
        $token = $tokens[$stackPtr];
        $text = trim($token['content'], " '\"\t\n");
        if (@preg_match($text, '') !== false) {
            // Regular expression found. Look for used separator (1st char).
            $separator = substr($text, 0, 1);
            // Get rid of separator.
            $text = trim($text, $separator);
            $parts = preg_split('~' . preg_quote($separator, '~') . '~', $text);
            // Need exactly 2 parts.
            if (isset($parts[1]) && !isset($parts[2])) {
                $modifiers = $parts[1];
                if (preg_match('~^[imsxeADSUXJu]+$~', $modifiers)) { // Only when modifiers are valid.
                    if (strpos($modifiers, 'e') !== false) {
                        $error = 'The use of the /e modifier in regular expressions is forbidden';
                        $phpcsFile->addError($error, $stackPtr, 'Found');
                    }
                }
            }
        }
    }
protected function process_regexp_separator_e(PHP_CodeSniffer_File $phpcsFile, $stackPtr) {
        $tokens = $phpcsFile->getTokens();
        $token = $tokens[$stackPtr];
        $text = trim($token['content'], " '\"\t\n");
        if (@preg_match($text, '') !== false) {
            // Regular expression found. Look for used separator (1st char).
            $separator = substr($text, 0, 1);
            // Get rid of separator.
            $text = trim($text, $separator);
            $parts = preg_split('~' . preg_quote($separator, '~') . '~', $text);
            // Need exactly 2 parts.
            if (isset($parts[1]) && !isset($parts[2])) {
                $modifiers = $parts[1];
                if (preg_match('~^[imsxeADSUXJu]+$~', $modifiers)) { // Only when modifiers are valid.
                    if (strpos($modifiers, 'e') !== false) {
                        $error = 'The use of the /e modifier in regular expressions is forbidden';
                        $phpcsFile->addError($error, $stackPtr, 'Found');
                    }
                }
            }
        }
    }
protected function process_regexp_separator_e ( PHP_CodeSniffer_File $ phpcsFile , $ stackPtr ) { $ tokens = $ phpcsFile -> getTokens ( ) ; $ token = $ tokens [ $ stackPtr ] ; $ text = trim ( $ token [ 'content' ] , " '\"\t\n" ) ; if ( @ preg_match ( $ text , '' ) !== false ) { // Regular expression found. Look for used separator (1st char). $ separator = substr ( $ text , 0 , 1 ) ; // Get rid of separator. $ text = trim ( $ text , $ separator ) ; $ parts = preg_split ( '~' . preg_quote ( $ separator , '~' ) . '~' , $ text ) ; // Need exactly 2 parts. if ( isset ( $ parts [ 1 ] ) && ! isset ( $ parts [ 2 ] ) ) { $ modifiers = $ parts [ 1 ] ; if ( preg_match ( '~^[imsxeADSUXJu]+$~' , $ modifiers ) ) { // Only when modifiers are valid. if ( strpos ( $ modifiers , 'e' ) !== false ) { $ error = 'The use of the /e modifier in regular expressions is forbidden' ; $ phpcsFile -> addError ( $ error , $ stackPtr , 'Found' ) ; } } } } }
Detect strings being regexp and using the "e" modifier.

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

@return void
Detect strings being regexp and using the e modifier .