Exemplo n.º 1
0
 /**
  * testAcceptReturnsReturnValueOfVisitMethod
  *
  * @return void
  * @covers PHP_Depend_Code_ASTNode
  * @covers PHP_Depend_Code_ASTExpression
  * @group pdepend
  * @group pdepend::ast
  * @group unittest
  */
 public function testAcceptReturnsReturnValueOfVisitMethod()
 {
     $visitor = $this->getMock('PHP_Depend_Code_ASTVisitorI');
     $visitor->expects($this->once())->method('__call')->with($this->equalTo('visitExpression'))->will($this->returnValue(42));
     $expr = new PHP_Depend_Code_ASTExpression();
     self::assertEquals(42, $expr->accept($visitor));
 }
Exemplo n.º 2
0
 /**
  * Parses an index expression as it is valid to access elements in a php
  * string or array.
  *
  * @param PHP_Depend_Code_ASTNode       $node  The context source node.
  * @param PHP_Depend_Code_ASTExpression $expr  The concrete index expression.
  * @param integer                       $open  The open token type.
  * @param integer                       $close The close token type.
  *
  * @return PHP_Depend_Code_ASTNode
  * @since 0.9.12
  */
 private function _parseIndexExpression(PHP_Depend_Code_ASTNode $node, PHP_Depend_Code_ASTExpression $expr, $open, $close)
 {
     $this->consumeToken($open);
     if (($child = $this->_parseOptionalExpression()) != null) {
         $expr->addChild($child);
     }
     $token = $this->consumeToken($close);
     $expr->configureLinesAndColumns($node->getStartLine(), $token->endLine, $node->getStartColumn(), $token->endColumn);
     return $this->parseOptionalIndexExpression($expr);
 }
Exemplo n.º 3
0
 /**
  * The magic sleep method will be called by PHP's runtime environment right
  * before an instance of this class gets serialized. It should return an
  * array with those property names that should be serialized for this class.
  *
  * @return array(string)
  * @since 0.10.0
  */
 public function __sleep()
 {
     return array_merge(array('once'), parent::__sleep());
 }