/** * Parses a variable or any other valid member expression that is prefixed * with PHP's reference operator. * * <code> * // ----------- * foreach ( $array as &$this->foo ) {} * // ----------- * * // ---------- * $foo = &$bar->baz; * // ---------- * </code> * * @return PHP_Depend_Code_ASTUnaryExpression * @since 0.9.18 */ private function _parseVariableOrMemberByReference() { $this->_tokenStack->push(); $token = $this->consumeToken(self::T_BITWISE_AND); $this->consumeComments(); $expr = $this->builder->buildASTUnaryExpression($token->image); $expr->addChild($this->_parseVariableOrConstantOrPrimaryPrefix()); return $this->_setNodePositionsAndReturn($expr); }
/** * Parses a unary expression which represents php's by reference operator, * that is followed by a variable node. * * @return PHP_Depend_Code_ASTUnaryExpression * @since 0.9.11 */ private function _parseVariableByReference() { $this->_tokenStack->push(); $token = $this->_consumeToken(self::T_BITWISE_AND); $this->_consumeComments(); $variable = $this->_parseCompoundVariableOrVariableVariableOrVariable(); $expression = $this->_builder->buildASTUnaryExpression($token->image); $expression->addChild($variable); return $this->_setNodePositionsAndReturn($expression); }