Commit 1eec9f21 authored by beberlei's avatar beberlei

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

parent 49bcc69f
...@@ -235,9 +235,10 @@ class Parser ...@@ -235,9 +235,10 @@ class Parser
// If it really an annotation class? // If it really an annotation class?
if ( if (
! $this->_isNestedAnnotation && $this->_lexer->lookahead != null && (! $this->_isNestedAnnotation && $this->_lexer->lookahead != null &&
! $this->_lexer->isNextToken('(') && ! $this->_lexer->isNextToken('(') &&
! $this->_lexer->isNextToken('@') || ! $this->_lexer->isNextToken('@')) ||
! class_exists($name) ||
! is_subclass_of($name, 'Doctrine\Common\Annotations\Annotation') ! is_subclass_of($name, 'Doctrine\Common\Annotations\Annotation')
) { ) {
$this->_lexer->skipUntil('@'); $this->_lexer->skipUntil('@');
......
...@@ -73,11 +73,22 @@ DOCBLOCK; ...@@ -73,11 +73,22 @@ DOCBLOCK;
*/ */
DOCBLOCK; DOCBLOCK;
$result = $parser->parse($docblock); $result = $parser->parse($docblock);
$this->assertEquals(1, count($result)); $this->assertEquals(1, count($result));
$annot = $result['Doctrine\Tests\Common\Annotations\Name']; $annot = $result['Doctrine\Tests\Common\Annotations\Name'];
$this->assertTrue($annot instanceof Name); $this->assertTrue($annot instanceof Name);
$this->assertEquals("bar", $annot->foo); $this->assertEquals("bar", $annot->foo);
}
/**
* @group DDC-77
*/
public function testAnnotationWithoutClassIsIgnoredWithoutWarning()
{
$parser = new Parser();
$result = $parser->parse("@param");
$this->assertEquals(0, count($result));
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment