Closed gossi closed 8 years ago
Also if the loaded file/class contains error (e.g. an old API used, where the parent class doesn't exist anymore) the loading (e.g. include/require) would fail.
It is now available via:
PhpClass::fromFile($filename)
PhpInterface::fromFile($filename)
PhpTrait::fromFile($filename)
Files are parsed and not loaded through reflection, so it is not necessary to load required classes/interfaces/traits, etc.
Loading php structs through reflection can be tricky, because every dependency that a struct needs must be in classpath, too anyway php wil throw an error. A ReflectionLoader may be useful here, to support this. It would scan the desired file, parse all dependencies, sees which of them are already in classpath and returns a list of those who aren't. At best, it would also load them by itself, if possible.