extensions/felixfbecker.php-intellisense-0.0.12/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/DisallowShortOpenTagSniff.php
/**
     * Processes this test, when one of its tokens is encountered.
     *
     * @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
     */
Processes this test, when one of its tokens is encountered.
@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
Processes this test when one of its tokens is encountered . @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
public function process(File $phpcsFile, $stackPtr)
    {
        $tokens  = $phpcsFile->getTokens();
        $openTag = $tokens[$stackPtr];
        if ($openTag['content'] === '<?') {
            $error = 'Short PHP opening tag used; expected "<?php" but found "%s"';
            $data  = array($openTag['content']);
            $fix   = $phpcsFile->addFixableError($error, $stackPtr, 'Found', $data);
            if ($fix === true) {
                $phpcsFile->fixer->replaceToken($stackPtr, '<?php');
            }
            $phpcsFile->recordMetric($stackPtr, 'PHP short open tag used', 'yes');
        } else {
            $phpcsFile->recordMetric($stackPtr, 'PHP short open tag used', 'no');
        }
        if ($openTag['code'] === T_OPEN_TAG_WITH_ECHO) {
            $nextVar = $tokens[$phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true)];
            $error   = 'Short PHP opening tag used with echo; expected "<?php echo %s ..." but found "%s %s ..."';
            $data    = array(
                        $nextVar['content'],
                        $openTag['content'],
                        $nextVar['content'],
                       );
            $fix     = $phpcsFile->addFixableError($error, $stackPtr, 'EchoFound', $data);
            if ($fix === true) {
                if ($tokens[($stackPtr + 1)]['code'] !== T_WHITESPACE) {
                    $phpcsFile->fixer->replaceToken($stackPtr, '<?php echo ');
                } else {
                    $phpcsFile->fixer->replaceToken($stackPtr, '<?php echo');
                }
            }
        }
    }
public function process ( File $ phpcsFile , $ stackPtr ) { $ tokens = $ phpcsFile -> getTokens ( ) ; $ openTag = $ tokens [ $ stackPtr ] ; if ( $ openTag [ 'content' ] === '<?' ) { $ error = 'Short PHP opening tag used; expected "<?php" but found "%s"' ; $ data = array ( $ openTag [ 'content' ] ) ; $ fix = $ phpcsFile -> addFixableError ( $ error , $ stackPtr , 'Found' , $ data ) ; if ( $ fix === true ) { $ phpcsFile -> fixer -> replaceToken ( $ stackPtr , '<?php' ) ; } $ phpcsFile -> recordMetric ( $ stackPtr , 'PHP short open tag used' , 'yes' ) ; } else { $ phpcsFile -> recordMetric ( $ stackPtr , 'PHP short open tag used' , 'no' ) ; } if ( $ openTag [ 'code' ] === T_OPEN_TAG_WITH_ECHO ) { $ nextVar = $ tokens [ $ phpcsFile -> findNext ( Tokens :: $ emptyTokens , ( $ stackPtr + 1 ) , null , true ) ] ; $ error = 'Short PHP opening tag used with echo; expected "<?php echo %s ..." but found "%s %s ..."' ; $ data = array ( $ nextVar [ 'content' ] , $ openTag [ 'content' ] , $ nextVar [ 'content' ] , ) ; $ fix = $ phpcsFile -> addFixableError ( $ error , $ stackPtr , 'EchoFound' , $ data ) ; if ( $ fix === true ) { if ( $ tokens [ ( $ stackPtr + 1 ) ] [ 'code' ] !== T_WHITESPACE ) { $ phpcsFile -> fixer -> replaceToken ( $ stackPtr , '<?php echo ' ) ; } else { $ phpcsFile -> fixer -> replaceToken ( $ stackPtr , '<?php echo' ) ; } } } }
Processes this test, when one of its tokens is encountered.
Processes this test when one of its tokens is encountered .