Skip to content

Loading…

DCOM-151 #18

Merged
merged 3 commits into from

2 participants

@Ocramius
Doctrine member

Replaces doctrine/common#233 ( DCOM-151 - http://www.doctrine-project.org/jira/browse/DCOM-151)

DocParser should not attempt autoloading excluded annotations

@guilhermeblanco guilhermeblanco merged commit 459d8d8 into doctrine:master

1 check passed

Details default The Travis CI build passed
@Ocramius Ocramius deleted the Ocramius:DCOM-151 branch
@Ocramius Ocramius added this to the v1.2.0 milestone
@Ocramius Ocramius self-assigned this
@Ocramius Ocramius removed their assignment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
View
7 lib/Doctrine/Common/Annotations/DocParser.php
@@ -618,10 +618,13 @@ private function Annotation()
$name = $this->imports[$loweredAlias];
}
$found = true;
- } elseif (isset($this->imports['__NAMESPACE__']) && $this->classExists($this->imports['__NAMESPACE__'].'\\'.$name)) {
+ } elseif (! isset($this->ignoredAnnotationNames[$name])
+ && isset($this->imports['__NAMESPACE__'])
+ && $this->classExists($this->imports['__NAMESPACE__'] . '\\' . $name)
+ ) {
$name = $this->imports['__NAMESPACE__'].'\\'.$name;
$found = true;
- } elseif ($this->classExists($name)) {
+ } elseif (! isset($this->ignoredAnnotationNames[$name]) && $this->classExists($name)) {
$found = true;
}
View
9 tests/Doctrine/Tests/Common/Annotations/AbstractReaderTest.php
@@ -4,6 +4,7 @@
use Doctrine\Common\Annotations\Annotation\IgnoreAnnotation;
use Doctrine\Common\Annotations\Annotation;
+use Doctrine\Common\Annotations\Reader;
use ReflectionClass, Doctrine\Common\Annotations\AnnotationReader;
require_once __DIR__ . '/TopLevelAnnotation.php';
@@ -241,6 +242,14 @@ public function testNonAnnotationProblem()
$this->assertInstanceOf($name, $annot);
}
+ public function testIncludeIgnoreAnnotation()
+ {
+ $reader = $this->getReader();
+
+ $reader->getPropertyAnnotations(new \ReflectionProperty('Doctrine\Tests\Common\Annotations\Fixtures\ClassWithIgnoreAnnotation', 'foo'));
+ $this->assertFalse(class_exists('Doctrine\Tests\Common\Annotations\Fixtures\IgnoreAnnotationClass', false));
+ }
+
public function testImportWithConcreteAnnotation()
{
$reader = $this->getReader();
View
14 tests/Doctrine/Tests/Common/Annotations/Fixtures/ClassWithIgnoreAnnotation.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Doctrine\Tests\Common\Annotations\Fixtures;
+
+/**
+ * @ignoreAnnotation("IgnoreAnnotationClass")
+ */
+class ClassWithIgnoreAnnotation
+{
+ /**
+ * @IgnoreAnnotationClass
+ */
+ public $foo;
+}
View
7 tests/Doctrine/Tests/Common/Annotations/Fixtures/IgnoreAnnotationClass.php
@@ -0,0 +1,7 @@
+<?php
+
+namespace Doctrine\Tests\Common\Annotations\Fixtures;
+
+class IgnoreAnnotationClass
+{
+}
View
5 tests/Doctrine/Tests/Common/Annotations/SimpleAnnotationReaderTest.php
@@ -68,6 +68,11 @@ public function testInvalidAnnotationUsageButIgnoredClass()
parent::testInvalidAnnotationUsageButIgnoredClass();
}
+ public function testIncludeIgnoreAnnotation()
+ {
+ $this->markTestSkipped('The simplified annotation reader would always autoload annotations');
+ }
+
/**
* @group DDC-1660
* @group regression
Something went wrong with that request. Please try again.