CopernicaMarketingSoftware / PHP-CPP

Library to build PHP extensions with C++
http://www.php-cpp.com/
Apache License 2.0
1.42k stars 333 forks source link

PHP-Gtk3 does not provide parameters on ReflectionMethod::getParameters() #521

Closed SantosSi closed 5 months ago

SantosSi commented 5 months ago

This report is mainly about a blocker to be able to do that from PHP: PHP-Gtk3 does not provide parameters on ReflectionMethod::getParameters(). The main developer asked to report here: https://github.com/scorninpc/php-gtk3/issues/90#issuecomment-2045739074 The purpose was to create a PHP skeleton/stub for the php-gtk3 extension to integrate in IDEs to support programmers, e.g. with code completion, static code analysis. (See also: https://github.com/CopernicaMarketingSoftware/PHP-CPP/issues/520)

EmielBruijntjes commented 5 months ago

I have absolutely no idea what you are talking about. This seems to be not PHP-CPP related.

SantosSi commented 5 months ago

I think it is related, because Reflection works on the class and method levels, but stops working on the parameter level. Since that information is required to make the C code available to PHP in the extension, the requirement here is simply to make that also available for Reflection. 2 method example: GtkFixed, defined for PHP-CPP here. The information I can extract through Reflection:

class GtkFixed extends GtkContainer
{
    const TYPE_INVALID = 0;
    const TYPE_NONE = 4;
    const TYPE_INTERFACE = 8;
    const TYPE_CHAR = 12;
    const TYPE_UCHAR = 16;
    const TYPE_BOOLEAN = 20;
    const TYPE_INT = 24;
    const TYPE_UINT = 28;
    const TYPE_LONG = 32;
    const TYPE_ULONG = 36;
    const TYPE_INT64 = 40;
    const TYPE_UINT64 = 44;
    const TYPE_ENUM = 48;
    const TYPE_FLAGS = 52;
    const TYPE_FLOAT = 56;
    const TYPE_DOUBLE = 60;
    const TYPE_STRING = 64;
    const TYPE_PIXBUF = -1556332720;
    const TYPE_POINTER = 68;
    const TYPE_BOXED = 72;
    const TYPE_PARAM = 76;
    const TYPE_OBJECT = 80;
    const TYPE_GTYPE = -1556356592;
    const TYPE_VARIANT = 84;
    const TYPE_CHECKSUM = -1556330896;
    public function __construct() {}
    public function put(): void {}
    public function move(): void {}
}

But the information needed would be:

class GtkFixed extends GtkContainer
{
    [skipped many constants]
    public function __construct() {}
    public function put(GtkWidget $widget, int $x, int $y): void {}
    public function move(GtkWidget $widget, int $x, int $y): void {}
}
SantosSi commented 5 months ago

Is not understanding a request a reason for closing an issue? Please reopen.

apss-pohl commented 5 months ago

i would also appreciate to be able to generate stubs including parameters