Re: [PHP-GTK-DEV] Reflection woes
[email protected] (Andrei Zmievski)
| Newsgroups | php.gtk.dev |
|---|---|
| Message-ID | <[email protected]> |
Frédéric G. MARAND wrote: > 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. Sounds good. > 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 Yeah, this needs to be fixed. > (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. It's not a bug, but more of a mismatch between languages. Trying to redefine "foreach" methods is kind of useless right now, because they will not be called by anything, but with the upcoming virtual method support, they will be. So we probably should think about migrating these to a new name, possibly "for_each". > (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 Hmm, I thought Christian put in a bunch of prototype descriptors in.. I'll take a look. -Andrei