Reflection woes
[email protected] ("Frédéric G. MARAND")
| Newsgroups | php.gtk.dev |
|---|---|
| Message-ID | <[email protected]> |
Hello,
I've been using the Reflection API to automatically build a PHP skeleton
file of all PHP-GTK elements, in order to enable code completion for
PHP-GTK in Eclipse PDT, and probably any other PHP IDE since it would
look like just any ordinary PHP file.
However, in doing so, I've encountered what seem to be a few anomalies:
(a) PHP-GTK classes return empty results on the
getExtension()/getExtensionName() methods, unlike those in other extensions
(b) some methods bear names which are reserved PHP words, and cannot
therefore be declared as such. These reserved words are
- "foreach"
- PhpGtkCustomTreeModel
- GtkListStore
- GtkTextTagTable
- GtkTreeModelFilter
- GtkTreeModelSort
- GtkTreeStore
- GtkSourceTagTableand
- "unset"
- GtkPrintSettings
These do not cause errors or even warnings on runtime, and indeed
discussion on #php suggests it may be legit for an extension to define
methods bearing the names of reserved words of the language, but it is
unadvised.
However, it prevents extending these classes in PHP by inheriting and
redefining these methods, since defining such extensions results in a
compile error. Since these methods are not marked with the "final"
modifier, they should be inheritable, so this seems to be a bug indeed.
(c) none of the methods supports the getPrototype() method, which causes
an exception upon invokation. I'm not sure of the status of this
methods, since it is listed in the PHP classbrowser:
http://www.php.net/~helly/classbrowser/class.php?class=ReflectionMethod&extension=Reflection
but not on the normal Reflection page:
http://www.php.net/manual/en/language.oop5.reflection.php#language.oop5.reflection.reflectionmethod
Frederic G. MARAND
http://php-gtk.eu/