Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:106562 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 8537 invoked from network); 12 Aug 2019 21:30:51 -0000 Received: from unknown (HELO lb3-smtp-cloud7.xs4all.net) (194.109.24.31) by pb1.pair.com with SMTP; 12 Aug 2019 21:30:51 -0000 Received: from [IPv6:2001:983:6fc5:1:91de:d308:49ef:5212] ([IPv6:2001:983:6fc5:1:91de:d308:49ef:5212]) by smtp-cloud7.xs4all.net with ESMTPA id xFX3hT100ur8TxFX4hjKPC; Mon, 12 Aug 2019 20:59:03 +0200 To: Nikita Popov , PHP internals References: Message-ID: <1cd60e52-8b45-8a5e-81a8-db37526319d4@xs4all.nl> Date: Mon, 12 Aug 2019 20:59:00 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: nl Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4wfMIyvegmcBbbdsin61Jbl3lFW2ql4sCRyBdYMp8IZYMOK664d9JF+zhnVuyDxx6TyFW0nDHW6SGltSqViwv57NAJ9ubr5/8+GKB1wQSg1X5dUaYsC0Th 1olwVPJumZRgZnZ8hZJPg8cUsE5oER+g4EFJDrK4y4apNsJm/kPi/gqY7bhw/pywo4zBZH28JWZ/KioeB2i9FuWeX7URE523RLq6EvcCb557HevSPpIyS7x3 nrHkW+I/+9mWe88ln5/26iTLDQGvGM/RzcBkCnePncNZiorYHBle/E2NuyRJ1NY+Q96DQvkbWhAFlVD3ua1zww== Subject: Re: [PHP-DEV] Call for participation: Annotating internal function argument and return types From: d.takken@xs4all.nl (Dik Takken) Hi, I'd be happy to donate some time to this effort as well. If you just assign me a file or directory (not too much at once please) I can create a PR that covers that part of the code base. Would that work for you? Regards, Dik On 10-08-19 12:56, Nikita Popov wrote: > Hi, > > Lack of type information for internal functions in Reflection is a > long-standing issue. In PHP 8 we finally have all the necessary technical > groundwork done to support argument and return type annotations on internal > functions at scale. > > The only thing left is to actually add those type annotations ... to many > hundreds of functions. This is something everyone can help with, as it does > not need expertise in C. > > I've opened a sample PR to show the process: > https://github.com/php/php-src/pull/4499 > > Here, we take some existing arginfo structures in basic_functions.c and > convert them into stubs in basic_functions.stub.php. We can take the > argument names from the existing arginfo. To figure out the types, we need > to look at the implementation (the php.net documentation tends to lie about > details). > > For example, the first function, set_time_limit is defined in > https://github.com/php/php-src/blob/172c71980df0fe4c9d62c3365f0a2cdb139e3e86/main/main.c#L1501. > We see that it accepts an "l" parameter, which is an int. We see that it > uses RETVAL_TRUE and RETVAL_FALSE, which means the return value is a bool. > > Once this is done, we need to auto-generate new arginfo data. If you have a > development setup, this is done automatically when running "make". > Otherwise, it's possible to manually run "php scripts/dev/gen_stub.php > ext/standard/basic_functions.stub.php". > > Any help would be appreciated :) > > Regards, > Nikita >