krakjoe / uopz

User Operations for Zend

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add Reflection information for global functions?

TysonAndre opened this issue · comments

Currently, NULL is passed instead of an arginfo structure, so ReflectionFunction has no information for param names, types, or return types.
This makes it difficult for tooling using Reflection to check what options are available (e.g. future optional flags) in a given uopz version, or for type checkers to check types or param counts.

For https://www.php.net/uopz_set_return , I'd expect string $function_or_class, $value_or_function, ....)

php > var_export((new ReflectionFunction('uopz_set_return'))->getParameters());
array (
)
#define UOPZ_FE(f) PHP_FE(f, NULL)
static const zend_function_entry uopz_functions[] = {
	UOPZ_FE(uopz_set_return)
	UOPZ_FE(uopz_get_return)
	UOPZ_FE(uopz_unset_return)
// ...

It might make sense to use a stub file and gen_stub.php for this; see https://news-web.php.net/php.pecl.dev/16708.

Because of the way the API is built, it's not really possible to add useful arginfo.

I prefer to keep the API stable.