phpowermove / php-code-generator

PHP code generator library
https://php-code-generator.readthedocs.org
Apache License 2.0
147 stars 43 forks source link

Feature Request: ReflectionLoader #15

Closed gossi closed 8 years ago

gossi commented 8 years ago

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.

gossi commented 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.

gossi commented 8 years ago

It is now available via:

Files are parsed and not loaded through reflection, so it is not necessary to load required classes/interfaces/traits, etc.