Work on reflection API
| From: | Timm Friebe | Date: | Tue, 01 Jul 2003 18:27:28 +0000 |
| Subject: | Work on reflection API | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-3093@lists.php.net to get a copy of this message | ||
Hello,
I went ahead and spent some time on the new reflection API. A patch (778
lines:)) and a demo script are attached.
What has changed:
---------------------------------------------------------------------
- Added documentation for each and every function (using the style
used in ext/*/*.c), e.g.:
/* {{{ proto Reflection_Class[] Reflection_Class::getInterfaces()
Returns an array of interfaces this class implements */
- Replaced duplicated code with macros or functions
- Added protection against static calls to the Reflection_* classes'
functions (resulting in fatal errors if you try to do so).
- Made Reflection_Class::getInterfaces return an empty array instead
of FALSE in case the class does not implement any interfaces
- Made Reflection_Function::getStaticVariables return an empty array
instead of FALSE in case the function does not have any static
variables.
- Made use of the ZEND_DO_THROW macro in the constructors (see
previous mail to engine2@ including a patch to zend_API.h)
- Added Reflection_Class::isFinal
- Added Reflection_Class::isAbstract
- Added Reflection_Class::newInstance. This method takes a variable
amount of arguments and passes them to the object's constructor
if there is one.
- Added Reflection_Class::isInstance
---------------------------------------------------------------------
I couldn't figure out how to remove the following memleaks which
occur when the reflection_class_factory is called:
/usr/home/thekid/devel/php/php/Zend/zend_reflection_api.c(296) :
Freeing 0x08371D24 (7 bytes), script=reflection.php
Last leak repeated 1 time
/usr/home/thekid/devel/php/php/Zend/zend_reflection_api.c(295) :
Freeing 0x08371CE4 (16 bytes), script=reflection.php
Last leak repeated 1 time
--
Timm
Attachment: [text/x-patch] zend_reflection_api.c.diff
Attachment: [application/x-php] reflection.php
Attachment: [text/x-patch] zend_reflection_api.c.diff
Attachment: [application/x-php] reflection.php