Issue #2138867 by chx: Allow dangling commas in annotations.

8.0.x
webchick 2013-11-22 15:45:15 -08:00
parent 6deedddba3
commit 402a3cae63
15 changed files with 203 additions and 168 deletions

View File

@ -16,6 +16,7 @@
"symfony/yaml": "2.3.*", "symfony/yaml": "2.3.*",
"twig/twig": "1.12.*", "twig/twig": "1.12.*",
"doctrine/common": "2.4.*@beta", "doctrine/common": "2.4.*@beta",
"doctrine/annotations": "dev-master#463d926a8dcc49271cb7db5a08364a70ed6e3cd3",
"guzzle/http": "3.7.*", "guzzle/http": "3.7.*",
"kriswallsmith/assetic": "1.1.*@alpha", "kriswallsmith/assetic": "1.1.*@alpha",
"symfony-cmf/routing": "1.1.*@alpha", "symfony-cmf/routing": "1.1.*@alpha",

18
composer.lock generated
View File

@ -3,20 +3,20 @@
"This file locks the dependencies of your project to a known state", "This file locks the dependencies of your project to a known state",
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file" "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
], ],
"hash": "4c727150110aeae10efe10a92ff256f5", "hash": "414745173d1e926721e1d7511a65dcec",
"packages": [ "packages": [
{ {
"name": "doctrine/annotations", "name": "doctrine/annotations",
"version": "v1.1.2", "version": "dev-master",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/doctrine/annotations.git", "url": "https://github.com/doctrine/annotations.git",
"reference": "v1.1.2" "reference": "463d926a8dcc49271cb7db5a08364a70ed6e3cd3"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/doctrine/annotations/zipball/v1.1.2", "url": "https://api.github.com/repos/doctrine/annotations/zipball/463d926a8dcc49271cb7db5a08364a70ed6e3cd3",
"reference": "v1.1.2", "reference": "463d926a8dcc49271cb7db5a08364a70ed6e3cd3",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -45,7 +45,8 @@
{ {
"name": "Jonathan Wage", "name": "Jonathan Wage",
"email": "jonwage@gmail.com", "email": "jonwage@gmail.com",
"homepage": "http://www.jwage.com/" "homepage": "http://www.jwage.com/",
"role": "Creator"
}, },
{ {
"name": "Guilherme Blanco", "name": "Guilherme Blanco",
@ -63,7 +64,7 @@
{ {
"name": "Johannes Schmitt", "name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com", "email": "schmittjoh@gmail.com",
"homepage": "https://github.com/schmittjoh", "homepage": "http://jmsyst.com",
"role": "Developer of wrapped JMSSerializerBundle" "role": "Developer of wrapped JMSSerializerBundle"
} }
], ],
@ -74,7 +75,7 @@
"docblock", "docblock",
"parser" "parser"
], ],
"time": "2013-06-16 21:33:03" "time": "2013-11-19 05:59:59"
}, },
{ {
"name": "doctrine/cache", "name": "doctrine/cache",
@ -2056,6 +2057,7 @@
"minimum-stability": "stable", "minimum-stability": "stable",
"stability-flags": { "stability-flags": {
"doctrine/common": 10, "doctrine/common": 10,
"doctrine/annotations": 20,
"kriswallsmith/assetic": 15, "kriswallsmith/assetic": 15,
"symfony-cmf/routing": 15, "symfony-cmf/routing": 15,
"easyrdf/easyrdf": 10 "easyrdf/easyrdf": 10

View File

@ -4,4 +4,4 @@
require_once __DIR__ . '/composer' . '/autoload_real.php'; require_once __DIR__ . '/composer' . '/autoload_real.php';
return ComposerAutoloaderInitdcdeef3a2347836a4b3309cb54064cf9::getLoader(); return ComposerAutoloaderInite23e221879b77f56988466576fc63488::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer // autoload_real.php @generated by Composer
class ComposerAutoloaderInitdcdeef3a2347836a4b3309cb54064cf9 class ComposerAutoloaderInite23e221879b77f56988466576fc63488
{ {
private static $loader; private static $loader;
@ -19,9 +19,9 @@ class ComposerAutoloaderInitdcdeef3a2347836a4b3309cb54064cf9
return self::$loader; return self::$loader;
} }
spl_autoload_register(array('ComposerAutoloaderInitdcdeef3a2347836a4b3309cb54064cf9', 'loadClassLoader'), true, true); spl_autoload_register(array('ComposerAutoloaderInite23e221879b77f56988466576fc63488', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(); self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInitdcdeef3a2347836a4b3309cb54064cf9', 'loadClassLoader')); spl_autoload_unregister(array('ComposerAutoloaderInite23e221879b77f56988466576fc63488', 'loadClassLoader'));
$vendorDir = dirname(__DIR__); $vendorDir = dirname(__DIR__);
$baseDir = dirname(dirname($vendorDir)); $baseDir = dirname(dirname($vendorDir));

View File

@ -735,79 +735,6 @@
"parser" "parser"
] ]
}, },
{
"name": "doctrine/annotations",
"version": "v1.1.2",
"version_normalized": "1.1.2.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/annotations.git",
"reference": "v1.1.2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/annotations/zipball/v1.1.2",
"reference": "v1.1.2",
"shasum": ""
},
"require": {
"doctrine/lexer": "1.*",
"php": ">=5.3.2"
},
"require-dev": {
"doctrine/cache": "1.*"
},
"time": "2013-06-16 21:33:03",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-0": {
"Doctrine\\Common\\Annotations\\": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com",
"homepage": "http://www.jwage.com/"
},
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com",
"homepage": "http://www.instaclick.com"
},
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
{
"name": "Benjamin Eberlei",
"email": "kontakt@beberlei.de"
},
{
"name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com",
"homepage": "https://github.com/schmittjoh",
"role": "Developer of wrapped JMSSerializerBundle"
}
],
"description": "Docblock Annotations Parser",
"homepage": "http://www.doctrine-project.org",
"keywords": [
"annotations",
"docblock",
"parser"
]
},
{ {
"name": "doctrine/collections", "name": "doctrine/collections",
"version": "v1.1", "version": "v1.1",
@ -2115,5 +2042,79 @@
"filesystem", "filesystem",
"iterator" "iterator"
] ]
},
{
"name": "doctrine/annotations",
"version": "dev-master",
"version_normalized": "9999999-dev",
"source": {
"type": "git",
"url": "https://github.com/doctrine/annotations.git",
"reference": "463d926a8dcc49271cb7db5a08364a70ed6e3cd3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/annotations/zipball/463d926a8dcc49271cb7db5a08364a70ed6e3cd3",
"reference": "463d926a8dcc49271cb7db5a08364a70ed6e3cd3",
"shasum": ""
},
"require": {
"doctrine/lexer": "1.*",
"php": ">=5.3.2"
},
"require-dev": {
"doctrine/cache": "1.*"
},
"time": "2013-11-19 05:59:59",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-0": {
"Doctrine\\Common\\Annotations\\": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com",
"homepage": "http://www.jwage.com/",
"role": "Creator"
},
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com",
"homepage": "http://www.instaclick.com"
},
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
{
"name": "Benjamin Eberlei",
"email": "kontakt@beberlei.de"
},
{
"name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com",
"homepage": "http://jmsyst.com",
"role": "Developer of wrapped JMSSerializerBundle"
}
],
"description": "Docblock Annotations Parser",
"homepage": "http://www.doctrine-project.org",
"keywords": [
"annotations",
"docblock",
"parser"
]
} }
] ]

View File

@ -3,6 +3,7 @@ language: php
php: php:
- 5.3 - 5.3
- 5.4 - 5.4
- 5.5
before_script: before_script:
- composer --prefer-source --dev install - composer --prefer-source --dev install

View File

@ -69,7 +69,7 @@ class AnnotationReader implements Reader
'Required' => true, 'Attribute' => true, 'Attributes' => true, 'Required' => true, 'Attribute' => true, 'Attributes' => true,
'Target' => true, 'SuppressWarnings' => true, 'Target' => true, 'SuppressWarnings' => true,
'ingroup' => true, 'code' => true, 'endcode' => true, 'ingroup' => true, 'code' => true, 'endcode' => true,
'package_version' => true, 'fixme' => true 'package_version' => true, 'fixme' => true, 'noinspection' => true
); );
/** /**

View File

@ -19,11 +19,9 @@
namespace Doctrine\Common\Annotations; namespace Doctrine\Common\Annotations;
use Closure;
use ReflectionClass; use ReflectionClass;
use Doctrine\Common\Annotations\Annotation\Enum; use Doctrine\Common\Annotations\Annotation\Enum;
use Doctrine\Common\Annotations\Annotation\Target; use Doctrine\Common\Annotations\Annotation\Target;
use Doctrine\Common\Annotations\Annotation\Attribute;
use Doctrine\Common\Annotations\Annotation\Attributes; use Doctrine\Common\Annotations\Annotation\Attributes;
/** /**
@ -582,7 +580,7 @@ final class DocParser
} }
/** /**
* Annotation ::= "@" AnnotationName ["(" [Values] ")"] * Annotation ::= "@" AnnotationName MethodCall
* AnnotationName ::= QualifiedName | SimpleName * AnnotationName ::= QualifiedName | SimpleName
* QualifiedName ::= NameSpacePart "\" {NameSpacePart "\"}* SimpleName * QualifiedName ::= NameSpacePart "\" {NameSpacePart "\"}* SimpleName
* NameSpacePart ::= identifier | null | false | true * NameSpacePart ::= identifier | null | false | true
@ -673,16 +671,7 @@ final class DocParser
); );
} }
$values = array(); $values = $this->MethodCall();
if ($this->lexer->isNextToken(DocLexer::T_OPEN_PARENTHESIS)) {
$this->match(DocLexer::T_OPEN_PARENTHESIS);
if ( ! $this->lexer->isNextToken(DocLexer::T_CLOSE_PARENTHESIS)) {
$values = $this->Values();
}
$this->match(DocLexer::T_CLOSE_PARENTHESIS);
}
if (isset(self::$annotationMetadata[$name]['enum'])) { if (isset(self::$annotationMetadata[$name]['enum'])) {
// checks all declared attributes // checks all declared attributes
@ -736,6 +725,7 @@ final class DocParser
} }
$instance = new $name(); $instance = new $name();
foreach ($values as $property => $value) { foreach ($values as $property => $value) {
if (!isset(self::$annotationMetadata[$name]['properties'][$property])) { if (!isset(self::$annotationMetadata[$name]['properties'][$property])) {
if ('value' !== $property) { if ('value' !== $property) {
@ -755,7 +745,31 @@ final class DocParser
} }
/** /**
* Values ::= Array | Value {"," Value}* * MethodCall ::= ["(" [Values] ")"]
*
* @return array
*/
private function MethodCall()
{
$values = array();
if ( ! $this->lexer->isNextToken(DocLexer::T_OPEN_PARENTHESIS)) {
return $values;
}
$this->match(DocLexer::T_OPEN_PARENTHESIS);
if ( ! $this->lexer->isNextToken(DocLexer::T_CLOSE_PARENTHESIS)) {
$values = $this->Values();
}
$this->match(DocLexer::T_CLOSE_PARENTHESIS);
return $values;
}
/**
* Values ::= Array | Value {"," Value}* [","]
* *
* @return array * @return array
*/ */
@ -766,6 +780,7 @@ final class DocParser
// Handle the case of a single array as value, i.e. @Foo({....}) // Handle the case of a single array as value, i.e. @Foo({....})
if ($this->lexer->isNextToken(DocLexer::T_OPEN_CURLY_BRACES)) { if ($this->lexer->isNextToken(DocLexer::T_OPEN_CURLY_BRACES)) {
$values['value'] = $this->Value(); $values['value'] = $this->Value();
return $values; return $values;
} }
@ -773,6 +788,11 @@ final class DocParser
while ($this->lexer->isNextToken(DocLexer::T_COMMA)) { while ($this->lexer->isNextToken(DocLexer::T_COMMA)) {
$this->match(DocLexer::T_COMMA); $this->match(DocLexer::T_COMMA);
if ($this->lexer->isNextToken(DocLexer::T_CLOSE_PARENTHESIS)) {
break;
}
$token = $this->lexer->lookahead; $token = $this->lexer->lookahead;
$value = $this->Value(); $value = $this->Value();
@ -812,12 +832,12 @@ final class DocParser
{ {
$identifier = $this->Identifier(); $identifier = $this->Identifier();
if (!defined($identifier) && false !== strpos($identifier, '::') && '\\' !== $identifier[0]) { if ( ! defined($identifier) && false !== strpos($identifier, '::') && '\\' !== $identifier[0]) {
list($className, $const) = explode('::', $identifier); list($className, $const) = explode('::', $identifier);
$alias = (false === $pos = strpos($className, '\\'))? $className : substr($className, 0, $pos);
$alias = (false === $pos = strpos($className, '\\')) ? $className : substr($className, 0, $pos);
$found = false; $found = false;
switch (true) { switch (true) {
case !empty ($this->namespaces): case !empty ($this->namespaces):
foreach ($this->namespaces as $ns) { foreach ($this->namespaces as $ns) {

View File

@ -2,19 +2,10 @@
namespace Doctrine\Tests\Common\Annotations; namespace Doctrine\Tests\Common\Annotations;
use Doctrine\Common\Annotations\DoctrineReader;
use Doctrine\Common\Annotations\Annotation\IgnoreAnnotation; use Doctrine\Common\Annotations\Annotation\IgnoreAnnotation;
use Doctrine\Common\Annotations\Annotation\IgnorePhpDoc; use Doctrine\Common\Annotations\Annotation;
use ReflectionClass, Doctrine\Common\Annotations\AnnotationReader; use ReflectionClass, Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\Tests\Common\Annotations\DummyAnnotation;
use Doctrine\Tests\Common\Annotations\Name;
use Doctrine\Tests\Common\Annotations\DummyId;
use Doctrine\Tests\Common\Annotations\DummyJoinTable;
use Doctrine\Tests\Common\Annotations\DummyJoinColumn;
use Doctrine\Tests\Common\Annotations\DummyColumn;
use Doctrine\Tests\Common\Annotations\DummyGeneratedValue;
require_once __DIR__ . '/TopLevelAnnotation.php'; require_once __DIR__ . '/TopLevelAnnotation.php';
abstract class AbstractReaderTest extends \PHPUnit_Framework_TestCase abstract class AbstractReaderTest extends \PHPUnit_Framework_TestCase
@ -93,8 +84,16 @@ abstract class AbstractReaderTest extends \PHPUnit_Framework_TestCase
$this->assertInstanceOf('Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAll', $barAnnot[0]->annotation); $this->assertInstanceOf('Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAll', $barAnnot[0]->annotation);
} }
public function testClassWithWithDanglingComma()
{
$reader = $this->getReader();
$annots = $reader->getClassAnnotations(new \ReflectionClass('Doctrine\Tests\Common\Annotations\DummyClassWithDanglingComma'));
$this->assertCount(1, $annots);
}
/** /**
* @expectedException Doctrine\Common\Annotations\AnnotationException * @expectedException \Doctrine\Common\Annotations\AnnotationException
* @expectedExceptionMessage [Semantical Error] Annotation @AnnotationTargetPropertyMethod is not allowed to be declared on class Doctrine\Tests\Common\Annotations\Fixtures\ClassWithInvalidAnnotationTargetAtClass. You may only use this annotation on these code elements: METHOD, PROPERTY * @expectedExceptionMessage [Semantical Error] Annotation @AnnotationTargetPropertyMethod is not allowed to be declared on class Doctrine\Tests\Common\Annotations\Fixtures\ClassWithInvalidAnnotationTargetAtClass. You may only use this annotation on these code elements: METHOD, PROPERTY
*/ */
public function testClassWithInvalidAnnotationTargetAtClassDocBlock() public function testClassWithInvalidAnnotationTargetAtClassDocBlock()
@ -111,7 +110,7 @@ abstract class AbstractReaderTest extends \PHPUnit_Framework_TestCase
} }
/** /**
* @expectedException Doctrine\Common\Annotations\AnnotationException * @expectedException \Doctrine\Common\Annotations\AnnotationException
* @expectedExceptionMessage [Semantical Error] Annotation @AnnotationTargetClass is not allowed to be declared on property Doctrine\Tests\Common\Annotations\Fixtures\ClassWithInvalidAnnotationTargetAtProperty::$foo. You may only use this annotation on these code elements: CLASS * @expectedExceptionMessage [Semantical Error] Annotation @AnnotationTargetClass is not allowed to be declared on property Doctrine\Tests\Common\Annotations\Fixtures\ClassWithInvalidAnnotationTargetAtProperty::$foo. You may only use this annotation on these code elements: CLASS
*/ */
public function testClassWithInvalidAnnotationTargetAtPropertyDocBlock() public function testClassWithInvalidAnnotationTargetAtPropertyDocBlock()
@ -121,7 +120,7 @@ abstract class AbstractReaderTest extends \PHPUnit_Framework_TestCase
} }
/** /**
* @expectedException Doctrine\Common\Annotations\AnnotationException * @expectedException \Doctrine\Common\Annotations\AnnotationException
* @expectedExceptionMessage [Semantical Error] Annotation @AnnotationTargetAnnotation is not allowed to be declared on property Doctrine\Tests\Common\Annotations\Fixtures\ClassWithInvalidAnnotationTargetAtProperty::$bar. You may only use this annotation on these code elements: ANNOTATION * @expectedExceptionMessage [Semantical Error] Annotation @AnnotationTargetAnnotation is not allowed to be declared on property Doctrine\Tests\Common\Annotations\Fixtures\ClassWithInvalidAnnotationTargetAtProperty::$bar. You may only use this annotation on these code elements: ANNOTATION
*/ */
public function testClassWithInvalidNestedAnnotationTargetAtPropertyDocBlock() public function testClassWithInvalidNestedAnnotationTargetAtPropertyDocBlock()
@ -131,7 +130,7 @@ abstract class AbstractReaderTest extends \PHPUnit_Framework_TestCase
} }
/** /**
* @expectedException Doctrine\Common\Annotations\AnnotationException * @expectedException \Doctrine\Common\Annotations\AnnotationException
* @expectedExceptionMessage [Semantical Error] Annotation @AnnotationTargetClass is not allowed to be declared on method Doctrine\Tests\Common\Annotations\Fixtures\ClassWithInvalidAnnotationTargetAtMethod::functionName(). You may only use this annotation on these code elements: CLASS * @expectedExceptionMessage [Semantical Error] Annotation @AnnotationTargetClass is not allowed to be declared on method Doctrine\Tests\Common\Annotations\Fixtures\ClassWithInvalidAnnotationTargetAtMethod::functionName(). You may only use this annotation on these code elements: CLASS
*/ */
public function testClassWithInvalidAnnotationTargetAtMethodDocBlock() public function testClassWithInvalidAnnotationTargetAtMethodDocBlock()
@ -141,7 +140,7 @@ abstract class AbstractReaderTest extends \PHPUnit_Framework_TestCase
} }
/** /**
* @expectedException Doctrine\Common\Annotations\AnnotationException * @expectedException \Doctrine\Common\Annotations\AnnotationException
* @expectedExceptionMessage Expected namespace separator or identifier, got ')' at position 24 in class @Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithTargetSyntaxError. * @expectedExceptionMessage Expected namespace separator or identifier, got ')' at position 24 in class @Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithTargetSyntaxError.
*/ */
public function testClassWithAnnotationWithTargetSyntaxErrorAtClassDocBlock() public function testClassWithAnnotationWithTargetSyntaxErrorAtClassDocBlock()
@ -151,7 +150,7 @@ abstract class AbstractReaderTest extends \PHPUnit_Framework_TestCase
} }
/** /**
* @expectedException Doctrine\Common\Annotations\AnnotationException * @expectedException \Doctrine\Common\Annotations\AnnotationException
* @expectedExceptionMessage Expected namespace separator or identifier, got ')' at position 24 in class @Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithTargetSyntaxError. * @expectedExceptionMessage Expected namespace separator or identifier, got ')' at position 24 in class @Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithTargetSyntaxError.
*/ */
public function testClassWithAnnotationWithTargetSyntaxErrorAtPropertyDocBlock() public function testClassWithAnnotationWithTargetSyntaxErrorAtPropertyDocBlock()
@ -161,7 +160,7 @@ abstract class AbstractReaderTest extends \PHPUnit_Framework_TestCase
} }
/** /**
* @expectedException Doctrine\Common\Annotations\AnnotationException * @expectedException \Doctrine\Common\Annotations\AnnotationException
* @expectedExceptionMessage Expected namespace separator or identifier, got ')' at position 24 in class @Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithTargetSyntaxError. * @expectedExceptionMessage Expected namespace separator or identifier, got ')' at position 24 in class @Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithTargetSyntaxError.
*/ */
public function testClassWithAnnotationWithTargetSyntaxErrorAtMethodDocBlock() public function testClassWithAnnotationWithTargetSyntaxErrorAtMethodDocBlock()
@ -171,7 +170,7 @@ abstract class AbstractReaderTest extends \PHPUnit_Framework_TestCase
} }
/** /**
* @expectedException Doctrine\Common\Annotations\AnnotationException * @expectedException \Doctrine\Common\Annotations\AnnotationException
* @expectedExceptionMessage [Type Error] Attribute "string" of @AnnotationWithVarType declared on property Doctrine\Tests\Common\Annotations\Fixtures\ClassWithAnnotationWithVarType::$invalidProperty expects a(n) string, but got integer. * @expectedExceptionMessage [Type Error] Attribute "string" of @AnnotationWithVarType declared on property Doctrine\Tests\Common\Annotations\Fixtures\ClassWithAnnotationWithVarType::$invalidProperty expects a(n) string, but got integer.
*/ */
public function testClassWithPropertyInvalidVarTypeError() public function testClassWithPropertyInvalidVarTypeError()
@ -183,7 +182,7 @@ abstract class AbstractReaderTest extends \PHPUnit_Framework_TestCase
} }
/** /**
* @expectedException Doctrine\Common\Annotations\AnnotationException * @expectedException \Doctrine\Common\Annotations\AnnotationException
* @expectedExceptionMessage [Type Error] Attribute "annotation" of @AnnotationWithVarType declared on method Doctrine\Tests\Common\Annotations\Fixtures\ClassWithAnnotationWithVarType::invalidMethod() expects a(n) Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAll, but got an instance of Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAnnotation. * @expectedExceptionMessage [Type Error] Attribute "annotation" of @AnnotationWithVarType declared on method Doctrine\Tests\Common\Annotations\Fixtures\ClassWithAnnotationWithVarType::invalidMethod() expects a(n) Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAll, but got an instance of Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAnnotation.
*/ */
public function testClassWithMethodInvalidVarTypeError() public function testClassWithMethodInvalidVarTypeError()
@ -195,7 +194,7 @@ abstract class AbstractReaderTest extends \PHPUnit_Framework_TestCase
} }
/** /**
* @expectedException Doctrine\Common\Annotations\AnnotationException * @expectedException \Doctrine\Common\Annotations\AnnotationException
* @expectedExceptionMessage Expected namespace separator or identifier, got ')' at position 18 in class Doctrine\Tests\Common\Annotations\DummyClassSyntaxError. * @expectedExceptionMessage Expected namespace separator or identifier, got ')' at position 18 in class Doctrine\Tests\Common\Annotations\DummyClassSyntaxError.
*/ */
public function testClassSyntaxErrorContext() public function testClassSyntaxErrorContext()
@ -205,7 +204,7 @@ abstract class AbstractReaderTest extends \PHPUnit_Framework_TestCase
} }
/** /**
* @expectedException Doctrine\Common\Annotations\AnnotationException * @expectedException \Doctrine\Common\Annotations\AnnotationException
* @expectedExceptionMessage Expected namespace separator or identifier, got ')' at position 18 in method Doctrine\Tests\Common\Annotations\DummyClassMethodSyntaxError::foo(). * @expectedExceptionMessage Expected namespace separator or identifier, got ')' at position 18 in method Doctrine\Tests\Common\Annotations\DummyClassMethodSyntaxError::foo().
*/ */
public function testMethodSyntaxErrorContext() public function testMethodSyntaxErrorContext()
@ -215,7 +214,7 @@ abstract class AbstractReaderTest extends \PHPUnit_Framework_TestCase
} }
/** /**
* @expectedException Doctrine\Common\Annotations\AnnotationException * @expectedException \Doctrine\Common\Annotations\AnnotationException
* @expectedExceptionMessage Expected namespace separator or identifier, got ')' at position 18 in property Doctrine\Tests\Common\Annotations\DummyClassPropertySyntaxError::$foo. * @expectedExceptionMessage Expected namespace separator or identifier, got ')' at position 18 in property Doctrine\Tests\Common\Annotations\DummyClassPropertySyntaxError::$foo.
*/ */
public function testPropertySyntaxErrorContext() public function testPropertySyntaxErrorContext()
@ -268,7 +267,7 @@ abstract class AbstractReaderTest extends \PHPUnit_Framework_TestCase
} }
/** /**
* @expectedException Doctrine\Common\Annotations\AnnotationException * @expectedException \Doctrine\Common\Annotations\AnnotationException
* @expectedExceptionMessage The annotation "@NameFoo" in property Doctrine\Tests\Common\Annotations\TestAnnotationNotImportedClass::$field was never imported. * @expectedExceptionMessage The annotation "@NameFoo" in property Doctrine\Tests\Common\Annotations\TestAnnotationNotImportedClass::$field was never imported.
*/ */
public function testImportDetectsNotImportedAnnotation() public function testImportDetectsNotImportedAnnotation()
@ -278,7 +277,7 @@ abstract class AbstractReaderTest extends \PHPUnit_Framework_TestCase
} }
/** /**
* @expectedException Doctrine\Common\Annotations\AnnotationException * @expectedException \Doctrine\Common\Annotations\AnnotationException
* @expectedExceptionMessage The annotation "@Foo\Bar\Name" in property Doctrine\Tests\Common\Annotations\TestNonExistentAnnotationClass::$field was never imported. * @expectedExceptionMessage The annotation "@Foo\Bar\Name" in property Doctrine\Tests\Common\Annotations\TestNonExistentAnnotationClass::$field was never imported.
*/ */
public function testImportDetectsNonExistentAnnotation() public function testImportDetectsNonExistentAnnotation()
@ -305,7 +304,7 @@ abstract class AbstractReaderTest extends \PHPUnit_Framework_TestCase
} }
/** /**
* @expectedException Doctrine\Common\Annotations\AnnotationException * @expectedException \Doctrine\Common\Annotations\AnnotationException
* @expectedExceptionMessage The class "Doctrine\Tests\Common\Annotations\Fixtures\NoAnnotation" is not annotated with @Annotation. Are you sure this class can be used as annotation? If so, then you need to add @Annotation to the _class_ doc comment of "Doctrine\Tests\Common\Annotations\Fixtures\NoAnnotation". If it is indeed no annotation, then you need to add @IgnoreAnnotation("NoAnnotation") to the _class_ doc comment of class Doctrine\Tests\Common\Annotations\Fixtures\InvalidAnnotationUsageClass. * @expectedExceptionMessage The class "Doctrine\Tests\Common\Annotations\Fixtures\NoAnnotation" is not annotated with @Annotation. Are you sure this class can be used as annotation? If so, then you need to add @Annotation to the _class_ doc comment of "Doctrine\Tests\Common\Annotations\Fixtures\NoAnnotation". If it is indeed no annotation, then you need to add @IgnoreAnnotation("NoAnnotation") to the _class_ doc comment of class Doctrine\Tests\Common\Annotations\Fixtures\InvalidAnnotationUsageClass.
*/ */
public function testErrorWhenInvalidAnnotationIsUsed() public function testErrorWhenInvalidAnnotationIsUsed()
@ -462,15 +461,15 @@ class DummyClass2 {
} }
/** @Annotation */ /** @Annotation */
class DummyId extends \Doctrine\Common\Annotations\Annotation {} class DummyId extends Annotation {}
/** @Annotation */ /** @Annotation */
class DummyColumn extends \Doctrine\Common\Annotations\Annotation { class DummyColumn extends Annotation {
public $type; public $type;
} }
/** @Annotation */ /** @Annotation */
class DummyGeneratedValue extends \Doctrine\Common\Annotations\Annotation {} class DummyGeneratedValue extends Annotation {}
/** @Annotation */ /** @Annotation */
class DummyAnnotation extends \Doctrine\Common\Annotations\Annotation { class DummyAnnotation extends Annotation {
public $dummyValue; public $dummyValue;
} }
@ -478,22 +477,29 @@ class DummyAnnotation extends \Doctrine\Common\Annotations\Annotation {
* @api * @api
* @Annotation * @Annotation
*/ */
class DummyAnnotationWithIgnoredAnnotation extends \Doctrine\Common\Annotations\Annotation { class DummyAnnotationWithIgnoredAnnotation extends Annotation {
public $dummyValue; public $dummyValue;
} }
/** @Annotation */ /** @Annotation */
class DummyJoinColumn extends \Doctrine\Common\Annotations\Annotation { class DummyJoinColumn extends Annotation {
public $name; public $name;
public $referencedColumnName; public $referencedColumnName;
} }
/** @Annotation */ /** @Annotation */
class DummyJoinTable extends \Doctrine\Common\Annotations\Annotation { class DummyJoinTable extends Annotation {
public $name; public $name;
public $joinColumns; public $joinColumns;
public $inverseJoinColumns; public $inverseJoinColumns;
} }
/**
* @DummyAnnotation(dummyValue = "bar",)
*/
class DummyClassWithDanglingComma
{
}
/** /**
* @DummyAnnotation(@) * @DummyAnnotation(@)
*/ */

View File

@ -2,7 +2,6 @@
namespace Doctrine\Tests\Common\Annotations; namespace Doctrine\Tests\Common\Annotations;
use Doctrine\Common\Annotations\Annotation\IgnorePhpDoc;
use Doctrine\Common\Annotations\Annotation\IgnoreAnnotation; use Doctrine\Common\Annotations\Annotation\IgnoreAnnotation;
use Doctrine\Common\Annotations\DocParser; use Doctrine\Common\Annotations\DocParser;
use Doctrine\Common\Annotations\AnnotationRegistry; use Doctrine\Common\Annotations\AnnotationRegistry;
@ -321,7 +320,7 @@ DOCBLOCK;
$docComment = $class->getDocComment(); $docComment = $class->getDocComment();
$parser->setTarget(Target::TARGET_CLASS); $parser->setTarget(Target::TARGET_CLASS);
$parser->parse($class->getDocComment(),$context); $parser->parse($docComment, $context);
$this->fail(); $this->fail();
} catch (\Doctrine\Common\Annotations\AnnotationException $exc) { } catch (\Doctrine\Common\Annotations\AnnotationException $exc) {
@ -337,7 +336,7 @@ DOCBLOCK;
$context = 'method ' . $class->getName() . '::' . $method->getName() . '()'; $context = 'method ' . $class->getName() . '::' . $method->getName() . '()';
$parser->setTarget(Target::TARGET_METHOD); $parser->setTarget(Target::TARGET_METHOD);
$parser->parse($docComment,$context); $parser->parse($docComment, $context);
$this->fail(); $this->fail();
} catch (\Doctrine\Common\Annotations\AnnotationException $exc) { } catch (\Doctrine\Common\Annotations\AnnotationException $exc) {
@ -352,7 +351,7 @@ DOCBLOCK;
$context = 'property ' . $class->getName() . "::\$" . $property->getName(); $context = 'property ' . $class->getName() . "::\$" . $property->getName();
$parser->setTarget(Target::TARGET_PROPERTY); $parser->setTarget(Target::TARGET_PROPERTY);
$parser->parse($docComment,$context); $parser->parse($docComment, $context);
$this->fail(); $this->fail();
} catch (\Doctrine\Common\Annotations\AnnotationException $exc) { } catch (\Doctrine\Common\Annotations\AnnotationException $exc) {
@ -666,7 +665,7 @@ DOCBLOCK;
} }
/** /**
* @expectedException Doctrine\Common\Annotations\AnnotationException * @expectedException \Doctrine\Common\Annotations\AnnotationException
* @expectedExceptionMessage Attribute "value" of @Doctrine\Tests\Common\Annotations\Fixtures\AnnotationEnum declared on property SomeClassName::invalidProperty. accept only [ONE, TWO, THREE], but got FOUR. * @expectedExceptionMessage Attribute "value" of @Doctrine\Tests\Common\Annotations\Fixtures\AnnotationEnum declared on property SomeClassName::invalidProperty. accept only [ONE, TWO, THREE], but got FOUR.
*/ */
public function testAnnotationEnumeratorException() public function testAnnotationEnumeratorException()
@ -681,7 +680,7 @@ DOCBLOCK;
} }
/** /**
* @expectedException Doctrine\Common\Annotations\AnnotationException * @expectedException \Doctrine\Common\Annotations\AnnotationException
* @expectedExceptionMessage Attribute "value" of @Doctrine\Tests\Common\Annotations\Fixtures\AnnotationEnumLiteral declared on property SomeClassName::invalidProperty. accept only [AnnotationEnumLiteral::ONE, AnnotationEnumLiteral::TWO, AnnotationEnumLiteral::THREE], but got 4. * @expectedExceptionMessage Attribute "value" of @Doctrine\Tests\Common\Annotations\Fixtures\AnnotationEnumLiteral declared on property SomeClassName::invalidProperty. accept only [AnnotationEnumLiteral::ONE, AnnotationEnumLiteral::TWO, AnnotationEnumLiteral::THREE], but got 4.
*/ */
public function testAnnotationEnumeratorLiteralException() public function testAnnotationEnumeratorLiteralException()
@ -810,7 +809,7 @@ DOCBLOCK;
} }
/** /**
* @expectedException Doctrine\Common\Annotations\AnnotationException * @expectedException \Doctrine\Common\Annotations\AnnotationException
* @expectedExceptionMessage The annotation @SomeAnnotationClassNameWithoutConstructorAndProperties declared on does not accept any values, but got {"value":"Foo"}. * @expectedExceptionMessage The annotation @SomeAnnotationClassNameWithoutConstructorAndProperties declared on does not accept any values, but got {"value":"Foo"}.
*/ */
public function testWithoutConstructorWhenIsNotDefaultValue() public function testWithoutConstructorWhenIsNotDefaultValue()
@ -828,7 +827,7 @@ DOCBLOCK;
} }
/** /**
* @expectedException Doctrine\Common\Annotations\AnnotationException * @expectedException \Doctrine\Common\Annotations\AnnotationException
* @expectedExceptionMessage The annotation @SomeAnnotationClassNameWithoutConstructorAndProperties declared on does not accept any values, but got {"value":"Foo"}. * @expectedExceptionMessage The annotation @SomeAnnotationClassNameWithoutConstructorAndProperties declared on does not accept any values, but got {"value":"Foo"}.
*/ */
public function testWithoutConstructorWhenHasNoProperties() public function testWithoutConstructorWhenHasNoProperties()
@ -845,7 +844,7 @@ DOCBLOCK;
} }
/** /**
* @expectedException Doctrine\Common\Annotations\AnnotationException * @expectedException \Doctrine\Common\Annotations\AnnotationException
* @expectedExceptionMessage Expected namespace separator or identifier, got ')' at position 24 in class @Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithTargetSyntaxError. * @expectedExceptionMessage Expected namespace separator or identifier, got ')' at position 24 in class @Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithTargetSyntaxError.
*/ */
public function testAnnotationTargetSyntaxError() public function testAnnotationTargetSyntaxError()
@ -944,7 +943,7 @@ DOCBLOCK;
} }
/** /**
* @expectedException Doctrine\Common\Annotations\AnnotationException * @expectedException \Doctrine\Common\Annotations\AnnotationException
* @expectedExceptionMessage Expected PlainValue, got ''' at position 10. * @expectedExceptionMessage Expected PlainValue, got ''' at position 10.
*/ */
public function testAnnotationDontAcceptSingleQuotes() public function testAnnotationDontAcceptSingleQuotes()
@ -966,12 +965,12 @@ DOCBLOCK;
/** /**
* @group DCOM-41 * @group DCOM-41
* @expectedException Doctrine\Common\Annotations\AnnotationException * @expectedException \Doctrine\Common\Annotations\AnnotationException
*/ */
public function testAnnotationThrowsExceptionWhenAtSignIsNotFollowedByIdentifierInNestedAnnotation() public function testAnnotationThrowsExceptionWhenAtSignIsNotFollowedByIdentifierInNestedAnnotation()
{ {
$parser = new DocParser(); $parser = new DocParser();
$result = $parser->parse("@Doctrine\Tests\Common\Annotations\Name(@')"); $parser->parse("@Doctrine\Tests\Common\Annotations\Name(@')");
} }
/** /**
@ -1008,7 +1007,7 @@ DOCBLOCK;
/** /**
* @group DDC-78 * @group DDC-78
* @expectedException Doctrine\Common\Annotations\AnnotationException * @expectedException \Doctrine\Common\Annotations\AnnotationException
* @expectedExceptionMessage Expected PlainValue, got ''' at position 10 in class \Doctrine\Tests\Common\Annotations\Name * @expectedExceptionMessage Expected PlainValue, got ''' at position 10 in class \Doctrine\Tests\Common\Annotations\Name
*/ */
public function testSyntaxErrorWithContextDescription() public function testSyntaxErrorWithContextDescription()
@ -1036,8 +1035,8 @@ DOCBLOCK;
try { try {
$parser = $this->createTestParser(); $parser = $this->createTestParser();
$result = $parser->parse($docblock); $parser->parse($docblock);
} catch (Exception $e) { } catch (\Exception $e) {
$this->fail($e->getMessage()); $this->fail($e->getMessage());
} }
} }
@ -1057,8 +1056,8 @@ DOCBLOCK;
try { try {
$parser = $this->createTestParser(); $parser = $this->createTestParser();
$result = $parser->parse($docblock); $parser->parse($docblock);
} catch (Exception $e) { } catch (\Exception $e) {
$this->fail($e->getMessage()); $this->fail($e->getMessage());
} }
} }
@ -1135,7 +1134,7 @@ DOCBLOCK;
} }
/** /**
* @expectedException Doctrine\Common\Annotations\AnnotationException * @expectedException \Doctrine\Common\Annotations\AnnotationException
* @expectedExceptionMessage [Creation Error] The annotation @SomeAnnotationClassNameWithoutConstructor declared on some class does not have a property named "invalidaProperty". Available properties: data, name * @expectedExceptionMessage [Creation Error] The annotation @SomeAnnotationClassNameWithoutConstructor declared on some class does not have a property named "invalidaProperty". Available properties: data, name
*/ */
public function testSetValuesExeption() public function testSetValuesExeption()
@ -1150,7 +1149,7 @@ DOCBLOCK;
} }
/** /**
* @expectedException Doctrine\Common\Annotations\AnnotationException * @expectedException \Doctrine\Common\Annotations\AnnotationException
* @expectedExceptionMessage [Syntax Error] Expected Doctrine\Common\Annotations\DocLexer::T_IDENTIFIER or Doctrine\Common\Annotations\DocLexer::T_TRUE or Doctrine\Common\Annotations\DocLexer::T_FALSE or Doctrine\Common\Annotations\DocLexer::T_NULL, got '3.42' at position 5. * @expectedExceptionMessage [Syntax Error] Expected Doctrine\Common\Annotations\DocLexer::T_IDENTIFIER or Doctrine\Common\Annotations\DocLexer::T_TRUE or Doctrine\Common\Annotations\DocLexer::T_FALSE or Doctrine\Common\Annotations\DocLexer::T_NULL, got '3.42' at position 5.
*/ */
public function testInvalidIdentifierInAnnotation() public function testInvalidIdentifierInAnnotation()
@ -1190,7 +1189,7 @@ DOCBLOCK;
} }
/** /**
* @expectedException Doctrine\Common\Annotations\AnnotationException * @expectedException \Doctrine\Common\Annotations\AnnotationException
* @expectedExceptionMessage [Semantical Error] Couldn't find constant foo. * @expectedExceptionMessage [Semantical Error] Couldn't find constant foo.
*/ */
public function testInvalidContantName() public function testInvalidContantName()

View File

@ -33,7 +33,7 @@ class FileCacheReaderTest extends AbstractReaderTest
$this->assertFalse(is_dir($this->cacheDir)); $this->assertFalse(is_dir($this->cacheDir));
$cache = new FileCacheReader(new AnnotationReader(), $this->cacheDir); new FileCacheReader(new AnnotationReader(), $this->cacheDir);
$this->assertTrue(is_dir($this->cacheDir)); $this->assertTrue(is_dir($this->cacheDir));
} }

View File

@ -61,7 +61,7 @@ class SimpleAnnotationReaderTest extends AbstractReaderTest
} }
/** /**
* @expectedException Doctrine\Common\Annotations\AnnotationException * @expectedException \Doctrine\Common\Annotations\AnnotationException
*/ */
public function testInvalidAnnotationUsageButIgnoredClass() public function testInvalidAnnotationUsageButIgnoredClass()
{ {

View File

@ -3,6 +3,7 @@
namespace Doctrine\Tests\Common\Annotations\Ticket; namespace Doctrine\Tests\Common\Annotations\Ticket;
use Doctrine\Tests\Common\Annotations\Fixtures\Controller; use Doctrine\Tests\Common\Annotations\Fixtures\Controller;
use Doctrine\Common\Annotations\AnnotationReader;
/** /**
* @group * @group
@ -10,20 +11,20 @@ use Doctrine\Tests\Common\Annotations\Fixtures\Controller;
class DCOM55Test extends \PHPUnit_Framework_TestCase class DCOM55Test extends \PHPUnit_Framework_TestCase
{ {
/** /**
* @expectedException Doctrine\Common\Annotations\AnnotationException * @expectedException \Doctrine\Common\Annotations\AnnotationException
* @expectedExceptionMessage [Semantical Error] The class "Doctrine\Tests\Common\Annotations\Fixtures\Controller" is not annotated with @Annotation. Are you sure this class can be used as annotation? If so, then you need to add @Annotation to the _class_ doc comment of "Doctrine\Tests\Common\Annotations\Fixtures\Controller". If it is indeed no annotation, then you need to add @IgnoreAnnotation("Controller") to the _class_ doc comment of class Doctrine\Tests\Common\Annotations\Ticket\Dummy. * @expectedExceptionMessage [Semantical Error] The class "Doctrine\Tests\Common\Annotations\Fixtures\Controller" is not annotated with @Annotation. Are you sure this class can be used as annotation? If so, then you need to add @Annotation to the _class_ doc comment of "Doctrine\Tests\Common\Annotations\Fixtures\Controller". If it is indeed no annotation, then you need to add @IgnoreAnnotation("Controller") to the _class_ doc comment of class Doctrine\Tests\Common\Annotations\Ticket\Dummy.
*/ */
public function testIssue() public function testIssue()
{ {
$class = new \ReflectionClass(__NAMESPACE__ . '\\Dummy'); $class = new \ReflectionClass(__NAMESPACE__ . '\\Dummy');
$reader = new \Doctrine\Common\Annotations\AnnotationReader(); $reader = new AnnotationReader();
$reader->getClassAnnotations($class); $reader->getClassAnnotations($class);
} }
public function testAnnotation() public function testAnnotation()
{ {
$class = new \ReflectionClass(__NAMESPACE__ . '\\DCOM55Consumer'); $class = new \ReflectionClass(__NAMESPACE__ . '\\DCOM55Consumer');
$reader = new \Doctrine\Common\Annotations\AnnotationReader(); $reader = new AnnotationReader();
$annots = $reader->getClassAnnotations($class); $annots = $reader->getClassAnnotations($class);
$this->assertEquals(1, count($annots)); $this->assertEquals(1, count($annots));
@ -33,7 +34,7 @@ class DCOM55Test extends \PHPUnit_Framework_TestCase
public function testParseAnnotationDocblocks() public function testParseAnnotationDocblocks()
{ {
$class = new \ReflectionClass(__NAMESPACE__ . '\\DCOM55Annotation'); $class = new \ReflectionClass(__NAMESPACE__ . '\\DCOM55Annotation');
$reader = new \Doctrine\Common\Annotations\AnnotationReader(); $reader = new AnnotationReader();
$annots = $reader->getClassAnnotations($class); $annots = $reader->getClassAnnotations($class);
$this->assertEquals(0, count($annots)); $this->assertEquals(0, count($annots));

View File

@ -1,6 +1,10 @@
<?php <?php
namespace Doctrine\Tests\Common\Annotations\Ticket; namespace Doctrine\Tests\Common\Annotations\Ticket;
use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\Common\Annotations\DocParser;
use Doctrine\Common\Annotations\SimpleAnnotationReader;
//Some class named Entity in the global namespace //Some class named Entity in the global namespace
include __DIR__ .'/DCOM58Entity.php'; include __DIR__ .'/DCOM58Entity.php';
@ -11,7 +15,7 @@ class DCOM58Test extends \PHPUnit_Framework_TestCase
{ {
public function testIssue() public function testIssue()
{ {
$reader = new \Doctrine\Common\Annotations\AnnotationReader(); $reader = new AnnotationReader();
$result = $reader->getClassAnnotations(new \ReflectionClass(__NAMESPACE__."\MappedClass")); $result = $reader->getClassAnnotations(new \ReflectionClass(__NAMESPACE__."\MappedClass"));
foreach ($result as $annot) { foreach ($result as $annot) {
@ -24,7 +28,7 @@ class DCOM58Test extends \PHPUnit_Framework_TestCase
public function testIssueGlobalNamespace() public function testIssueGlobalNamespace()
{ {
$docblock = "@Entity"; $docblock = "@Entity";
$parser = new \Doctrine\Common\Annotations\DocParser(); $parser = new DocParser();
$parser->setImports(array( $parser->setImports(array(
"__NAMESPACE__" =>"Doctrine\Tests\Common\Annotations\Ticket\Doctrine\ORM\Mapping" "__NAMESPACE__" =>"Doctrine\Tests\Common\Annotations\Ticket\Doctrine\ORM\Mapping"
)); ));
@ -38,7 +42,7 @@ class DCOM58Test extends \PHPUnit_Framework_TestCase
public function testIssueNamespaces() public function testIssueNamespaces()
{ {
$docblock = "@Entity"; $docblock = "@Entity";
$parser = new \Doctrine\Common\Annotations\DocParser(); $parser = new DocParser();
$parser->addNamespace("Doctrine\Tests\Common\Annotations\Ticket\Doctrine\ORM"); $parser->addNamespace("Doctrine\Tests\Common\Annotations\Ticket\Doctrine\ORM");
$annots = $parser->parse($docblock); $annots = $parser->parse($docblock);
@ -50,7 +54,7 @@ class DCOM58Test extends \PHPUnit_Framework_TestCase
public function testIssueMultipleNamespaces() public function testIssueMultipleNamespaces()
{ {
$docblock = "@Entity"; $docblock = "@Entity";
$parser = new \Doctrine\Common\Annotations\DocParser(); $parser = new DocParser();
$parser->addNamespace("Doctrine\Tests\Common\Annotations\Ticket\Doctrine\ORM\Mapping"); $parser->addNamespace("Doctrine\Tests\Common\Annotations\Ticket\Doctrine\ORM\Mapping");
$parser->addNamespace("Doctrine\Tests\Common\Annotations\Ticket\Doctrine\ORM"); $parser->addNamespace("Doctrine\Tests\Common\Annotations\Ticket\Doctrine\ORM");
@ -63,7 +67,7 @@ class DCOM58Test extends \PHPUnit_Framework_TestCase
public function testIssueWithNamespacesOrImports() public function testIssueWithNamespacesOrImports()
{ {
$docblock = "@Entity"; $docblock = "@Entity";
$parser = new \Doctrine\Common\Annotations\DocParser(); $parser = new DocParser();
$annots = $parser->parse($docblock); $annots = $parser->parse($docblock);
$this->assertEquals(1, count($annots)); $this->assertEquals(1, count($annots));
@ -74,7 +78,7 @@ class DCOM58Test extends \PHPUnit_Framework_TestCase
public function testIssueSimpleAnnotationReader() public function testIssueSimpleAnnotationReader()
{ {
$reader = new \Doctrine\Common\Annotations\SimpleAnnotationReader(); $reader = new SimpleAnnotationReader();
$reader->addNamespace('Doctrine\Tests\Common\Annotations\Ticket\Doctrine\ORM\Mapping'); $reader->addNamespace('Doctrine\Tests\Common\Annotations\Ticket\Doctrine\ORM\Mapping');
$annots = $reader->getClassAnnotations(new \ReflectionClass(__NAMESPACE__."\MappedClass")); $annots = $reader->getClassAnnotations(new \ReflectionClass(__NAMESPACE__."\MappedClass"));