private function hasPossibleReferenceToThis(Tokens $tokens, $startIndex, $endIndex)
    {
        for ($i = $startIndex; $i < $endIndex; ++$i) {
            if ($tokens[$i]->isGivenKind(T_VARIABLE) && '$this' === strtolower($tokens[$i]->getContent())) {
                return true; // directly accessing '$this'
            }

            if ($tokens[$i]->isGivenKind([
                T_INCLUDE,                    // loading additional symbols we cannot analyze here
                T_INCLUDE_ONCE,               // "
                T_REQUIRE,                    // "
                T_REQUIRE_ONCE,               // "
                CT::T_DYNAMIC_VAR_BRACE_OPEN, // "$h = ${$g};" case
                T_EVAL,                       // "$c = eval('return $this;');" case
            ])) {
                return true;
            }

            if ($tokens[$i]->equals('$')) {
                $nextIndex = $tokens->getNextMeaningfulToken($i);
                if ($tokens[$nextIndex]->isGivenKind(T_VARIABLE)) {
                    return true; // "$$a" case
                }
            }
        }

        return false;
    }
private function hasPossibleReferenceToThis(Tokens $tokens, $startIndex, $endIndex)
    {
        for ($i = $startIndex; $i < $endIndex; ++$i) {
            if ($tokens[$i]->isGivenKind(T_VARIABLE) && '$this' === strtolower($tokens[$i]->getContent())) {
                return true; 
            }

            if ($tokens[$i]->isGivenKind([
                T_INCLUDE,                    
                T_INCLUDE_ONCE,               
                T_REQUIRE,                    
                T_REQUIRE_ONCE,               
                CT::T_DYNAMIC_VAR_BRACE_OPEN, 
                T_EVAL,                       
            ])) {
                return true;
            }

            if ($tokens[$i]->equals('$')) {
                $nextIndex = $tokens->getNextMeaningfulToken($i);
                if ($tokens[$nextIndex]->isGivenKind(T_VARIABLE)) {
                    return true; 
                }
            }
        }

        return false;
    }
private function hasPossibleReferenceToThis ( Tokens $ tokens , $ startIndex , $ endIndex ) { for ( $ i = $ startIndex ; $ i < $ endIndex ; ++ $ i ) { if ( $ tokens [ $ i ] -> isGivenKind ( T_VARIABLE ) && '$this' === strtolower ( $ tokens [ $ i ] -> getContent ( ) ) ) { return true ; // directly accessing '$this' } if ( $ tokens [ $ i ] -> isGivenKind ( [ T_INCLUDE , // loading additional symbols we cannot analyze here T_INCLUDE_ONCE , // " T_REQUIRE , // " T_REQUIRE_ONCE , // " CT :: T_DYNAMIC_VAR_BRACE_OPEN , // "$h = ${$g};" case T_EVAL , // "$c = eval('return $this;');" case ] ) ) { return true ; } if ( $ tokens [ $ i ] -> equals ( '$' ) ) { $ nextIndex = $ tokens -> getNextMeaningfulToken ( $ i ) ; if ( $ tokens [ $ nextIndex ] -> isGivenKind ( T_VARIABLE ) ) { return true ; // "$$a" case } } } return false ; }
Returns 'true' if there is a possible reference to '$this' within the given tokens index range.

@param Tokens $tokens
@param int    $startIndex
@param int    $endIndex

@return bool
Returns true if there is a possible reference to $this within the given tokens index range .