>> These side effects would be that the class loader loads files which can >> break things? > > > Yes. Reflecting over a codebase which contains even just polyfills > (duplicate classes) can already lead to unexpected crashes. Reflecting over > non-PSR-2 code can even lead to worse things such as starting a DB > connection and performing unwanted operations. >
My own use case avoids this problem. Instead of randomly scanning anything, you need to tell the annotation parser explicitly which namespace directory you want to scan. It is the caller's responsibility that all class files in this directory are nicely shaped, and can be safely autoloaded. In fact I did use a userland parser in the past, but then decided that native reflection is safe with the above assumption. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php