Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:130600 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by lists.php.net (Postfix) with ESMTPS id F22211A00BC for ; Fri, 10 Apr 2026 10:54:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1775818457; bh=e4sJ7aoAFQx31k2IeZPPnNP8E819JomCKROScioBaPI=; h=Date:To:From:Cc:Subject:In-Reply-To:References:From; b=L0DV9ivBK0ObJH+OIjsIrX54har1Q1Z639ul+Vj80IJoUyee/zxoOJU7Mwksk90OJ jaktwrccNEuk3AHuFmm0l3irPh10QpsyKIa/G1UYVmN3kwOuw5VBBbx63DZsl/sOsl QUtqQ7wMgRyJayjXG/+zfgZcl6+GpXvZZDhO/6sDfO9KP0FAMEI8s68v/IGi8xbVjI j1IocNaBtNX8NfL+SaWDd8d/T+IyC4XgqkiqGxvmMR+pRpXWtb6ZybXoM5RE4vSYEq 4lzbSVTGqMYAU4yCu4qRoyV4rx9+FPPtdSRjZ9JTzDG47M5W+eG58PJdMnlLi3UOMH jVHf0n+xLHuBw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B27B3180069 for ; Fri, 10 Apr 2026 10:54:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail-4323.protonmail.ch (mail-4323.protonmail.ch [185.70.43.23]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 10 Apr 2026 10:54:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gpb.moe; s=protonmail2; t=1775818448; x=1776077648; bh=e4sJ7aoAFQx31k2IeZPPnNP8E819JomCKROScioBaPI=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=med/GkfmwsDGyZGWDIfkZkH+Bgt+pjy6W/kL/SLGPG1vcP/vw8gIRncYu7XZdhCPO VDdbfKRg4jRonhcgfvOWOsmkZ4tvxSNzzW+lAZCUQblN+u1CC/iPG7PlhU3RekIOH2 XSTUq1+DaVqgLqki75Ub05tceopLPnK6a+OXRssMiIoKEZEdrOXgARinO2lqajLm5i hgQ5dZmyomdEGnDCsMA5vBv5djbfrRH7TZvE2HygV3GzpUDAdhzKoM+5SyZWPgJDsg nqVcTCorNwsfWFz81A9uRjYEKWSRiLI9rvT0OgpDO16C4zi2goZ9ecsEgDIoWPvnAP UECJ/kuJTdO7g== Date: Fri, 10 Apr 2026 10:54:03 +0000 To: Christian Schneider Cc: PHP internals list Subject: Re: [PHP-DEV] DocComments for internal functions Message-ID: <2FGg02j2pKAcV7nu_mLBtetGMhhax9Ernyly_rH2jDaWzNUSlWMk7pYf4mEq9QIbuBj4tgxA9xLlTEnwPVqmxSTw558yTPNrEsk53G63xtQ=@gpb.moe> In-Reply-To: References: Feedback-ID: 96993444:user:proton X-Pm-Message-ID: db80b17134359324f424df7908c1b16bc0d7874e Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: internals@gpb.moe ("Gina P. Banyard") On Thursday, 9 April 2026 at 14:33, Christian Schneider wrote: > As a follow-up to the now-merged DocComments for function parameters I wo= uld like to propose annotating internal functions with DocComments automati= cally generated from the documentation. >=20 > This would benefit e.g. LSPs and static analysers written in PHP to use r= eflection to show (a minimal) documentation for internal (e.g. strlen), bas= ic (e.g. str_replace) and bundled extension functions (e.g. grapheme_strlen= ). >=20 > To this end I > 1) extended zend_internal_arg_info and zend_internal_function_info > 2) added macros like ZEND_ARG_INFO_DOCCOMMENT to zend_API.h > 3) added a script build/add_doccomments.php to extract the documentation = from a doc-en (or other language) checkout > 4) extended build/gen_stub.php to generate the new ZEND_ARG_INFO_*_DOCCOM= MENT macros for @genstubs-expose-comment-block >=20 > With this in place one can generate the internal doc comments with > =09./build/add_doccomments.php > =09./build/gen_stub.php --force >=20 > The implementation can be examined at > =09https://github.com/php/php-src/compare/master...chschneider:php-src:in= ternal-functions-doccomments >=20 > Questions: > - Is there interest in adding this feature? > - How should it be integrated into the build process? A simple version wo= uld be to run the two scripts (with doc-en) before generating a release, a = more complicated version could add a configure option to also be able to ch= ose a local documentation checkout (e.g. for a different language) > - Does this require an RFC or should this be discussed here and (in case = there is interest) in a PR I would create? >=20 > Regards, > - Chris >=20 I am not *fully* convinced that we should add DocComments for internal para= meters/functions/classes/constants, as this feels like a lot of complexity. However, I've been working for the last 2ish years on some tooling [1] to i= mprove the syncing of the manual from the stubs, and in the long run being = able to semi-automatically create the migration guide. Considering that a large part of it is parsing the documentation and the st= ubs into a common representation to be able to do diffs on them, this might= be useful if we somehow want to "augment" the stubs. Best regards, Gina P. Banyard [1] https://github.com/Girgias/stub-to-docbook