1
0
mirror of synced 2025-03-21 15:33:51 +03:00

[2.0] Fixed DDC-77 - Prevent PHP Warning on certain annotation constallations

This commit is contained in:
beberlei 2009-10-30 00:20:17 +00:00
parent 49bcc69f3a
commit 1eec9f211b
2 changed files with 19 additions and 7 deletions

View File

@ -235,9 +235,10 @@ class Parser
// If it really an annotation class?
if (
! $this->_isNestedAnnotation && $this->_lexer->lookahead != null &&
(! $this->_isNestedAnnotation && $this->_lexer->lookahead != null &&
! $this->_lexer->isNextToken('(') &&
! $this->_lexer->isNextToken('@') ||
! $this->_lexer->isNextToken('@')) ||
! class_exists($name) ||
! is_subclass_of($name, 'Doctrine\Common\Annotations\Annotation')
) {
$this->_lexer->skipUntil('@');

View File

@ -73,11 +73,22 @@ DOCBLOCK;
*/
DOCBLOCK;
$result = $parser->parse($docblock);
$this->assertEquals(1, count($result));
$annot = $result['Doctrine\Tests\Common\Annotations\Name'];
$this->assertTrue($annot instanceof Name);
$this->assertEquals("bar", $annot->foo);
$result = $parser->parse($docblock);
$this->assertEquals(1, count($result));
$annot = $result['Doctrine\Tests\Common\Annotations\Name'];
$this->assertTrue($annot instanceof Name);
$this->assertEquals("bar", $annot->foo);
}
/**
* @group DDC-77
*/
public function testAnnotationWithoutClassIsIgnoredWithoutWarning()
{
$parser = new Parser();
$result = $parser->parse("@param");
$this->assertEquals(0, count($result));
}
}