extensions/felixfbecker.php-intellisense-0.0.12/vendor/squizlabs/php_codesniffer/src/Files/File.php
/**
     * Determine if the passed token is a reference operator.
     *
     * Returns true if the specified token position represents a reference.
     * Returns false if the token represents a bitwise operator.
     *
     * @param int $stackPtr The position of the T_BITWISE_AND token.
     *
     * @return boolean
     */
Determine if the passed token is a reference operator.
Returns true if the specified token position represents a reference.
Returns false if the token represents a bitwise operator.

@param int $stackPtr The position of the T_BITWISE_AND token.

@return boolean
Determine if the passed token is a reference operator . Returns true if the specified token position represents a reference . Returns false if the token represents a bitwise operator . @param int $stackPtr The position of the T_BITWISE_AND token . @return boolean
public function isReference($stackPtr)
    {
        if ($this->tokens[$stackPtr]['code'] !== T_BITWISE_AND) {
            return false;
        }
        $tokenBefore = $this->findPrevious(
            Util\Tokens::$emptyTokens,
            ($stackPtr - 1),
            null,
            true
        );
        if ($this->tokens[$tokenBefore]['code'] === T_FUNCTION) {
            return true;
        }
        if ($this->tokens[$tokenBefore]['code'] === T_DOUBLE_ARROW) {
            return true;
        }
        if ($this->tokens[$tokenBefore]['code'] === T_AS) {
            return true;
        }
        if ($this->tokens[$tokenBefore]['code'] === T_OPEN_SHORT_ARRAY) {
            return true;
        }
        if (isset(Util\Tokens::$assignmentTokens[$this->tokens[$tokenBefore]['code']]) === true) {
            return true;
        }
        if (isset($this->tokens[$stackPtr]['nested_parenthesis']) === true) {
            $brackets    = $this->tokens[$stackPtr]['nested_parenthesis'];
            $lastBracket = array_pop($brackets);
            if (isset($this->tokens[$lastBracket]['parenthesis_owner']) === true) {
                $owner = $this->tokens[$this->tokens[$lastBracket]['parenthesis_owner']];
                if ($owner['code'] === T_FUNCTION
                    || $owner['code'] === T_CLOSURE
                    || $owner['code'] === T_ARRAY
                ) {
                    return true;
                }
            } else {
                $prev = false;
                for ($t = ($this->tokens[$lastBracket]['parenthesis_opener'] - 1); $t >= 0; $t--) {
                    if ($this->tokens[$t]['code'] !== T_WHITESPACE) {
                        $prev = $t;
                        break;
                    }
                }
                if ($prev !== false && $this->tokens[$prev]['code'] === T_USE) {
                    return true;
                }
            }
        }
        $tokenAfter = $this->findNext(
            Util\Tokens::$emptyTokens,
            ($stackPtr + 1),
            null,
            true
        );
        if ($this->tokens[$tokenAfter]['code'] === T_VARIABLE
            && ($this->tokens[$tokenBefore]['code'] === T_OPEN_PARENTHESIS
            || $this->tokens[$tokenBefore]['code'] === T_COMMA)
        ) {
            return true;
        }
        return false;
    }
public function isReference ( $ stackPtr ) { if ( $ this -> tokens [ $ stackPtr ] [ 'code' ] !== T_BITWISE_AND ) { return false ; } $ tokenBefore = $ this -> findPrevious ( Util \ Tokens :: $ emptyTokens , ( $ stackPtr - 1 ) , null , true ) ; if ( $ this -> tokens [ $ tokenBefore ] [ 'code' ] === T_FUNCTION ) { return true ; } if ( $ this -> tokens [ $ tokenBefore ] [ 'code' ] === T_DOUBLE_ARROW ) { return true ; } if ( $ this -> tokens [ $ tokenBefore ] [ 'code' ] === T_AS ) { return true ; } if ( $ this -> tokens [ $ tokenBefore ] [ 'code' ] === T_OPEN_SHORT_ARRAY ) { return true ; } if ( isset ( Util \ Tokens :: $ assignmentTokens [ $ this -> tokens [ $ tokenBefore ] [ 'code' ] ] ) === true ) { return true ; } if ( isset ( $ this -> tokens [ $ stackPtr ] [ 'nested_parenthesis' ] ) === true ) { $ brackets = $ this -> tokens [ $ stackPtr ] [ 'nested_parenthesis' ] ; $ lastBracket = array_pop ( $ brackets ) ; if ( isset ( $ this -> tokens [ $ lastBracket ] [ 'parenthesis_owner' ] ) === true ) { $ owner = $ this -> tokens [ $ this -> tokens [ $ lastBracket ] [ 'parenthesis_owner' ] ] ; if ( $ owner [ 'code' ] === T_FUNCTION || $ owner [ 'code' ] === T_CLOSURE || $ owner [ 'code' ] === T_ARRAY ) { return true ; } } else { $ prev = false ; for ( $ t = ( $ this -> tokens [ $ lastBracket ] [ 'parenthesis_opener' ] - 1 ) ; $ t >= 0 ; $ t -- ) { if ( $ this -> tokens [ $ t ] [ 'code' ] !== T_WHITESPACE ) { $ prev = $ t ; break ; } } if ( $ prev !== false && $ this -> tokens [ $ prev ] [ 'code' ] === T_USE ) { return true ; } } } $ tokenAfter = $ this -> findNext ( Util \ Tokens :: $ emptyTokens , ( $ stackPtr + 1 ) , null , true ) ; if ( $ this -> tokens [ $ tokenAfter ] [ 'code' ] === T_VARIABLE && ( $ this -> tokens [ $ tokenBefore ] [ 'code' ] === T_OPEN_PARENTHESIS || $ this -> tokens [ $ tokenBefore ] [ 'code' ] === T_COMMA ) ) { return true ; } return false ; }
Determine if the passed token is a reference operator.
Determine if the passed token is a reference operator .
// Function returns a reference. // Inside a foreach loop, this is a reference. // Inside a foreach loop, this is a reference. // Inside an array declaration, this is a reference. // This is directly after an assignment. It's a reference. Even if // it is part of an operation, the other tests will handle it. // Inside a function or array declaration, this is a reference. //end if //end if