[2.0] Fixed DDC-77 - Prevent PHP Warning on certain annotation constallations
This commit is contained in:
parent
49bcc69f3a
commit
1eec9f211b
@ -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('@');
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user