Deprecate AnnotationRegistry in favor of class_exists()#61
Deprecate AnnotationRegistry in favor of class_exists()#61kingcrunch wants to merge 1 commit intodoctrine:masterfrom kingcrunch:class-exists
Conversation
|
a big +1 for this! in each lib from me i have to add \Doctrine\Common\Annotations\AnnotationRegistry::registerLoader('class_exists');or i need to document it. |
|
I think this can be applied once http://www.doctrine-project.org/jira/browse/DCOM-295 is done. |
|
Personally fully agree with the patch. As per discussions with internals, the autoloader was mainly meant for:
I don't think non-silent autoloaders are a thing anymore, since @stof pretty much helped in killing them gradually. As for the "ignoring" functionality, if DCOM-295 lands, then there is no need for such features, as the imports decide what annotations should be loaded or not. Still needs some discussion with the others at @doctrine/team-doctrine2 |
Most of the work has been done by the composer adoption here actually: the composer autoloader is silent when it cannot find the class, and most projects are now using it. |
|
Yup, but also other autoloaders (including ours) were simply "fixed" |
|
Just wanted to say that this doesn't work if you use this in a ZF1 project because its autoloader doesn't fail silently. I've resolved this by using this instead: AnnotationRegistry::registerLoader(function($fqcn) {
return @class_exists($fqcn);
}); |
|
@Jalle19 an autoloader breaking |
|
Fully agree: the ZF1 class loader should be fixed instead. Note that you may also just use the composer class loader also for ZF1 projects. |
|
I don't really care, I wouldn't touch ZF1 unless I had to (working on a legacy application). Any solution that means people don't have to register a loader manually anymore is good in my book. |
|
@Jalle19 for new projects, you wouldn't pick something like ZF1 anyway. This is why we're discussing about deprecation and removal in next major versions. |
|
👍 |
|
@kingcrunch Hi, I reapplied your changes onto current master as part of #205, let's make this happen. 😎 |
Replacement for #29. See over there for discussion
I've removed the fork and therefore the PR got unlinked and unmanageable somehow. The previous PR had merge conflicts, but I wanted to keep it, so I've re-created it.