Hi
Am 2025-08-27 17:45, schrieb Marco Pivetta:
I know this isn't very used in internals, but does it make sense to
write
generics for the generated stubs of this function?
The stub generator makes use of the types provided in the PHPDoc comment
to generate optimizer information. The stub generator has no support for
generic types (or things like array shapes), which makes this risky. The
information is not used, it is not tested and it might confuse the stub
generator.
See https://github.com/php/php-src/pull/19546 as an example.
If there is an interest in having generics in the stubs, the stub
generator should first be extended to handle them, even if it does not
(yet) use the information and then it should be consistently applied to
the entirety of PHP's stdlib.
Best regards
Tim Düsterhus