diff --git a/lib/Doctrine/Common/Annotations/DocParser.php b/lib/Doctrine/Common/Annotations/DocParser.php index cf4cd9c83..b128b93a9 100644 --- a/lib/Doctrine/Common/Annotations/DocParser.php +++ b/lib/Doctrine/Common/Annotations/DocParser.php @@ -368,8 +368,9 @@ private function findInitialTokenPosition($input) // search for first valid annotation while (($pos = strpos($input, '@', $pos)) !== false) { $preceding = substr($input, $pos - 1, 1); - // if the @ is preceded by a space or * it is valid - if ($pos === 0 || $preceding === ' ' || $preceding === '*') { + + // if the @ is preceded by a space, a tab or * it is valid + if ($pos === 0 || $preceding === ' ' || $preceding === '*' || $preceding === "\t") { return $pos; } diff --git a/tests/Doctrine/Tests/Common/Annotations/DocParserTest.php b/tests/Doctrine/Tests/Common/Annotations/DocParserTest.php index 661682276..f171e4773 100644 --- a/tests/Doctrine/Tests/Common/Annotations/DocParserTest.php +++ b/tests/Doctrine/Tests/Common/Annotations/DocParserTest.php @@ -1282,6 +1282,20 @@ public function testTrailingCommaIsAllowed() $this->assertEquals(array('Foo', 'Bar'), $annots[0]->value); } + public function testTabPrefixIsAllowed() + { + $docblock = <<createTestParser(); + $result = $parser->parse($docblock); + $this->assertCount(1, $result); + $this->assertInstanceOf('Doctrine\Tests\Common\Annotations\Name', $result[0]); + } + public function testDefaultAnnotationValueIsNotOverwritten() { $parser = $this->createTestParser();