/** * This method parses an optional else-, else+if- or elseif-statement. * * @param PHP_Depend_Code_ASTStatement $stmt The owning if/elseif statement. * * @return PHP_Depend_Code_ASTStatement * @since 0.9.12 */ private function _parseOptionalElseOrElseIfStatement(PHP_Depend_Code_ASTStatement $stmt) { $this->consumeComments(); switch ($this->tokenizer->peek()) { case self::T_ELSE: $this->consumeToken(self::T_ELSE); $this->consumeComments(); if ($this->tokenizer->peek() === self::T_IF) { $stmt->addChild($this->_parseIfStatement()); } else { $this->_parseStatementBody($stmt); } break; case self::T_ELSEIF: $stmt->addChild($this->_parseElseIfStatement()); break; } return $stmt; }
/** * 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 */ public function __sleep() { return array_merge(array('newName', 'newModifier'), parent::__sleep()); }
/** * 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('values'), parent::__sleep()); }
/** * testStatementHasExpectedEndColumn * * @param PHP_Depend_Code_ASTStatement $stmt * * @return void * @depends testStatement */ public function testStatementHasExpectedEndColumn($stmt) { $this->assertEquals(6, $stmt->getEndColumn()); }
/** * testAcceptReturnsReturnValueOfVisitMethod * * @return void * @covers PHP_Depend_Code_ASTNode * @covers PHP_Depend_Code_ASTStatement * @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('visitStatement'))->will($this->returnValue(42)); $stmt = new PHP_Depend_Code_ASTStatement(); self::assertEquals(42, $stmt->accept($visitor)); }