Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DCOM-179 #19

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/Doctrine/Common/Annotations/DocLexer.php
Expand Up @@ -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]+)?',
'"(?:[^"]|"")*"',
);
Expand Down
16 changes: 13 additions & 3 deletions tests/Doctrine/Tests/Common/Annotations/DocLexerTest.php
Expand Up @@ -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(
Expand Down Expand Up @@ -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,
)

Expand Down
4 changes: 4 additions & 0 deletions tests/Doctrine/Tests/Common/Annotations/DocParserTest.php
Expand Up @@ -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
Expand Down
Expand Up @@ -4,7 +4,7 @@

class ClassWithConstants
{

const SOME_VALUE = 'ClassWithConstants.SOME_VALUE';
const SOME_KEY = 'ClassWithConstants.SOME_KEY';
const OTHER_KEY_ = 'ClassWithConstants.OTHER_KEY_';
}