Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Autoloading annotation classes #103
Why aren't annotation classes loaded by currently configured PHP autoload mechanisms?
It is called neither in https://github.com/doctrine/annotations/blob/master/lib/Doctrine/Common/Annotations/AnnotationRegistry.php#L123
It leads to this weird behavior:
My suggestion would be to let the DocParser try to autoload the class.
P.S. I know that I can bypass it by adding custom loader to AnnotationRegistry that just executes class_exists(), but isn't it unnecessary (and non-intuitive)?
they can be, with a simple trick:
This works fine as long as your autoloaders are not breaking
The AnnotationRegistry system exists precisely because several big frameworks were failing this requirement in their autoloader at the time Doctrine Common 2.1 was written (including Doctrine Common itself and Zend Framework 1).
@stof Yes as I explained in P.S., I figured out this solution too. It works, but is one of potentially many things you have to figure out why they aren't working by default when experimenting with low-level configuration.