Skip to content

Implement "support doc comments for internal classes and functions" #13266

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Feb 25, 2024

Conversation

kocsismate
Copy link
Member

@kocsismate kocsismate commented Jan 29, 2024

Fixes #13130

The biggest change of this PR (besides the internal structures of functions and classes) is how function entries are generated by gen_stub.php: so far the higher level macros were used (ZEND_ME , ZEND_FALIAS etc.), but since the variations we have has already started to skyrocket, I decided to go with the ZEND_RAW_FENTRY macro which is the lowest level... As we now have a decent framework for generating the arginfo.h file by taking into account older PHP versions as well, I think this change is less problematic... A random example:

#if (PHP_VERSION_ID >= 80400)
	ZEND_RAW_FENTRY("zend_test_zend_ini_parse_quantity", zif_zend_test_zend_ini_parse_quantity, arginfo_zend_test_zend_ini_parse_quantity, 0, NULL)
#else
	ZEND_RAW_FENTRY("zend_test_zend_ini_parse_quantity", zif_zend_test_zend_ini_parse_quantity, arginfo_zend_test_zend_ini_parse_quantity, 0)
#endif

(NULL stands for the doc_comment in the function entry generated for PHP 8.4+).

@kocsismate
Copy link
Member Author

@iluuu1994 I slightly refactored the behavior, and now ZEND_FE and ZEND_ME is also generated if possible. This also means that I got rid of generating ZEND_FRAMELESS_FEs because this use-case also deemed to be uncommon.

When implementing this, I added support for conditional frameless func info item generation based on the PHP version compatibility requirements. I didn't commit this fix separately because it needed the PHP version compatibility info which I had just added in this PR.

Copy link
Member

@TimWolla TimWolla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and ack for ext/random.

@devnexen
Copy link
Member

pgsql looks ok to me.

@kocsismate
Copy link
Member Author

Ilija, could you have another look please?

Copy link
Member

@iluuu1994 iluuu1994 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The C code LGTM! I didn't look closely at build/gen_stub.php.

Copy link
Member

@Girgias Girgias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, also didn't check gen_stub too closely

@kocsismate kocsismate merged commit f2e199e into php:master Feb 25, 2024
@kocsismate kocsismate deleted the stub-expose-phpdoc branch February 25, 2024 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

support doc comments for internal classes and functions
6 participants