Re: Generating arginfo from stub files
| From: | Nikita Popov | Date: | Tue, 18 Jun 2019 17:53:48 +0000 |
| Subject: | Re: Generating arginfo from stub files | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-105974@lists.php.net to get a copy of this message | ||
On Tue, Jun 18, 2019 at 7:38 PM Rowan Collins <rowan.collins@gmail.com>
wrote:
> Hi Nikita,
>
> On Tue, 18 Jun 2019 at 16:10, Nikita Popov <nikita.ppv@gmail.com> wrote:
>
>> I've created a proof of concept implementation for this at
>> https://github.com/php/php-src/pull/4284. Function
>> signatures are
>> specified
>> in a xyz.stub.php file from which xyz_arginfo.h is generated. This file
>> can
>> then be included in the implementation. Nothing about the arginfo
>> implementation itself changes.
>>
>
>
> I notice on the PR there was discussion of stubs elsewhere (e.g.
> https://github.com/JetBrains/phpstorm-stubs) still being
> necessary
> because they contain additional documentation. However, has the opposite
> been considered: process an existing set of stubs to remove unsupported or
> irrelevant annotations, and import into php-src with this tool? That way,
> the manual effort for existing functions would be virtually zero.
>
This is not really possible, because we need completely accurate type
information. phpstorm-stubs is a good approximation especially when it
comes to "useful" return types, but it doesn't model things like possible
"false" return values with sufficient accuracy. Any type information we add
in php-src needs a careful review against the implementation.
Nikita