On Tue, 18 Jun 2019 at 16:10, Nikita Popov <nikita....@gmail.com> wrote:
> Rather than writing this out by hand, I would like arginfo structures to be > generated from PHP stub files that contain definitions like this: > > What do you think about providing this mechanism? Sounds good. But also, it's really a shame we don't have the union types RFC passed yet, as it means that the return type for a significant number of functions will be either incomplete or misleading. strpos(string $haystack, $needle, int $offset = 0) This is incomplete as the return isn't specified. strpos(string $haystack, $needle, int $offset = 0) : int This is misleading as it can return false; strpos(string $haystack, $needle, int $offset = 0): int|false Yay!, tools like PhpStan or Psalm can use this info, and don't need to maintain their own info for internal functions. Having the 'mixed' type would also be useful here, as there will almost always be some things that can't be expressed in a type system, and being able to use mixed shows that the type wasn't forgotten about, it just can be expressed currently. cheers Dan Ack https://wiki.php.net/rfc/union_types https://wiki.php.net/rfc/mixed-typehint -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php