-
Notifications
You must be signed in to change notification settings - Fork 236
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
Uncaught exception 'Doctrine\Common\Annotations\AnnotationException' #80
Comments
From @songokas on April 1, 2015 15:28 Is anyone dealing with this ? I have the same issue use Doctrine\Common\Annotations\DocParser;
require_once 'vendor/autoload.php';
/**
* @Annotation
* @Target({"METHOD"})
*/
class CacheMe {}
class FailMe {}
class ReadMe
{
/**
* @CacheMe
*/
public function testMe1()
{
echo "It works";
}
/**
* @MissMe
*/
public function testMe2()
{
echo "It works";
}
/**
* @FailMe
*/
public function testMe3()
{
echo "It works";
}
}
$parser = new DocParser();
$parser->setIgnoreNotImportedAnnotations(true);
$method1 = new ReflectionMethod('ReadMe', 'testMe1');
$method2 = new ReflectionMethod('ReadMe', 'testMe2');
$method3 = new ReflectionMethod('ReadMe', 'testMe3');
var_dump($parser->parse($method1->getDocComment()));
var_dump($parser->parse($method2->getDocComment()));
var_dump($parser->parse($method3->getDocComment())); Output: array(1) {
[0] =>
class CacheMe#11 (0) {
}
}
array(0) {
}
PHP Fatal error: Uncaught exception 'Doctrine\Common\Annotations\AnnotationException' with message '[Semantical Error] The class "FailMe" 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 "FailMe". If it is indeed no annotation, then you need to add @IgnoreAnnotation("FailMe") to the _class_ doc comment of .' in /workspace/vagrant/csms/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationException.php:54
Stack trace:
#0 /workspace/vagrant/csms/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php(727): Doctrine\Common\Annotations\AnnotationException::semanticalError('The class "Fail...')
#1 /workspace/vagrant/csms/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php(641): Doctrine\Common\Annotations\DocParser->Annotation()
#2 /workspace/vagrant/csms/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php(334): Doctrine\Common\Annotations\DocParser in /workspace/vagrant/csms/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationException.php on line 54 Expected behaviour: var_dump($parser->parse($method3->getDocComment())); should not throw exception and return empty list |
From @Ocramius on April 1, 2015 15:31 Convert it to a test case and it can be debugged/fixed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
From @cedrictailly on August 20, 2013 19:45
Hi,
I found a bug on a this call :
...were $em is the EntityManager and $classname a string, here is the error :
The context is too complex to reproduce but after a session of debugging, it seems there is a miss on a condition in class Doctrine\Common\Annotations\DocParser, in :
...replacing :
...by :
...should correct the problem.
Copied from original issue: doctrine/common#292
The text was updated successfully, but these errors were encountered: