AnnotationReader may incorrectly throw exceptions
The AnnotationReader pre-parses classes' doc block with a PreParser that doesn't have import (use) informations.
Due to this, it can happen that an annotation resolves to a wrong class.
The parser will then attempt to validate the class and fail (no @Annotation, cannot be used on classes, etc).
Here is a test case: https://github.com/doctrine/common/pull/161
The ArrayObject annotation is resolved as \ArrayObject, which is not a valid annotation. This results in the following exception:
Doctrine\Common\Annotations\AnnotationException: [Semantical Error] The class "ArrayObject" 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 "ArrayObject". If it is indeed no annotation, then you need to add @IgnoreAnnotation("ArrayObject") to the _class_ doc comment of class Doctrine\Tests\Common\Annotations\Issue159\ParseMe.
could you create a pull request instead of pasting a diff ? It will be easier for us
@stof done
I have a similar error on a Symfony 2.1 project :
[Semantical Error] The class "Annotation" 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 "Annotation". If it is indeed no annotation, then you need to add @IgnoreAnnotation("Annotation") to the _class_ doc comment of class @Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter.
How can i fix it, get around ?
This issue was moved to doctrine/annotations#79