scorninpc / php-gtk3

GTK3 extension for PHP
https://andor.com.br/
GNU Lesser General Public License v3.0
111 stars 9 forks source link

Create PHP skeletons/stubs to feed IDEs to support programmers #90

Open SantosSi opened 2 months ago

SantosSi commented 2 months ago

Useful for code completion, static code analysis, etc. It had been created for php-gtk with the Gtk_Dumper.php script. Because that did not work with PHP-GTK3 and could not be easily adapted to it, I tried myself by creating a script to replicate that behavior, but ReflectionMethod::getParameters() does not return any of php-gtk3's method parameters (besides missing interfaces). Does PHP-CPP have that functionality?

scorninpc commented 2 months ago

I think this is not a extension function, but php internals. but, i think you ask it on php-cpp repo

scorninpc commented 2 months ago

I think php-cpp works fine with reflections

image

SantosSi commented 2 months ago

The main purpose was to have PHP skeletons. Do you plan to somehow create it with or without the support from PHP-CPP? My side note for PHP-CPP was to know if it supports the creation of such a skeleton, optimally directly from the C++ code. Apparently it does not.

But, since you answered, that the documentation claims to theoretically support reflection, I tried to prove that in practice with the following unsuccessful minimized example:

<?php
$m = new ReflectionMethod('GtkButton', 'set_label');
var_dump($m->getParameters());

result:

array(0) {
}
SantosSi commented 2 months ago

Update: ReflectionMethod does not support getReturnType(), too. But getName() works as expected.

scorninpc commented 2 months ago

Sorry, I don't think it's possible to do it like that

I don't understand what you're doing and I don't understand much about reflections, but anyway, the class name, methods, returns and arguments (with type) are all stored in the internal table, so I really don't know why this is not showing or if this has a correlation

ps: my main problem today to automate all bind code is finding consistent def files for gtk methods and arguments. So you maybe do this by hardcode faster than find a solution (as i done in php-gtk3)