diff --git a/lib/Doctrine/Common/Annotations/DocLexer.php b/lib/Doctrine/Common/Annotations/DocLexer.php index ddc84d699..bb88b08fe 100644 --- a/lib/Doctrine/Common/Annotations/DocLexer.php +++ b/lib/Doctrine/Common/Annotations/DocLexer.php @@ -76,7 +76,7 @@ final class DocLexer extends AbstractLexer protected function getCatchablePatterns() { return array( - '[a-z_\\\][a-z0-9_\:\\\]*[a-z]{1}', + '[a-z_\\\][a-z0-9_\:\\\]*[a-z_]{1}', '(?:[+-]?[0-9]+(?:[\.][0-9]+)*)(?:[eE][+-]?[0-9]+)?', '"(?:[^"]|"")*"', ); diff --git a/tests/Doctrine/Tests/Common/Annotations/DocLexerTest.php b/tests/Doctrine/Tests/Common/Annotations/DocLexerTest.php index 03a55c805..beb37a00e 100644 --- a/tests/Doctrine/Tests/Common/Annotations/DocLexerTest.php +++ b/tests/Doctrine/Tests/Common/Annotations/DocLexerTest.php @@ -28,7 +28,7 @@ public function testMarkerAnnotation() public function testScannerTokenizesDocBlockWhitConstants() { $lexer = new DocLexer(); - $docblock = '@AnnotationWithConstants(PHP_EOL, ClassWithConstants::SOME_VALUE, \Doctrine\Tests\Common\Annotations\Fixtures\IntefaceWithConstants::SOME_VALUE)'; + $docblock = '@AnnotationWithConstants(PHP_EOL, ClassWithConstants::SOME_VALUE, ClassWithConstants::CONSTANT_, \Doctrine\Tests\Common\Annotations\Fixtures\IntefaceWithConstants::SOME_VALUE)'; $tokens = array ( array( @@ -67,13 +67,23 @@ public function testScannerTokenizesDocBlockWhitConstants() 'type' => DocLexer::T_COMMA, ), array( - 'value' => '\\Doctrine\\Tests\\Common\\Annotations\\Fixtures\\IntefaceWithConstants::SOME_VALUE', + 'value' => 'ClassWithConstants::CONSTANT_', 'position' => 66, 'type' => DocLexer::T_IDENTIFIER, ), + array( + 'value' => ',', + 'position' => 95, + 'type' => DocLexer::T_COMMA, + ), + array( + 'value' => '\\Doctrine\\Tests\\Common\\Annotations\\Fixtures\\IntefaceWithConstants::SOME_VALUE', + 'position' => 97, + 'type' => DocLexer::T_IDENTIFIER, + ), array( 'value' => ')', - 'position' => 143, + 'position' => 174, 'type' => DocLexer::T_CLOSE_PARENTHESIS, ) diff --git a/tests/Doctrine/Tests/Common/Annotations/DocParserTest.php b/tests/Doctrine/Tests/Common/Annotations/DocParserTest.php index 5b99787ae..2b6c08448 100644 --- a/tests/Doctrine/Tests/Common/Annotations/DocParserTest.php +++ b/tests/Doctrine/Tests/Common/Annotations/DocParserTest.php @@ -742,6 +742,10 @@ public function getConstantsProvider() '@AnnotationWithConstants(ClassWithConstants::SOME_VALUE)', ClassWithConstants::SOME_VALUE ); + $provider[] = array( + '@AnnotationWithConstants(ClassWithConstants::OTHER_KEY_)', + ClassWithConstants::OTHER_KEY_ + ); $provider[] = array( '@AnnotationWithConstants(Doctrine\Tests\Common\Annotations\Fixtures\ClassWithConstants::SOME_VALUE)', ClassWithConstants::SOME_VALUE diff --git a/tests/Doctrine/Tests/Common/Annotations/Fixtures/ClassWithConstants.php b/tests/Doctrine/Tests/Common/Annotations/Fixtures/ClassWithConstants.php index 055e245c0..0918534e5 100644 --- a/tests/Doctrine/Tests/Common/Annotations/Fixtures/ClassWithConstants.php +++ b/tests/Doctrine/Tests/Common/Annotations/Fixtures/ClassWithConstants.php @@ -4,7 +4,7 @@ class ClassWithConstants { - const SOME_VALUE = 'ClassWithConstants.SOME_VALUE'; const SOME_KEY = 'ClassWithConstants.SOME_KEY'; + const OTHER_KEY_ = 'ClassWithConstants.OTHER_KEY_'; } \ No newline at end of file