Re: Apply strict_types to internal functions
| From: | Claude Pache | Date: | Tue, 29 Aug 2023 12:16:49 +0000 |
| Subject: | Re: Apply strict_types to internal functions | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-120942@lists.php.net to get a copy of this message | ||
> Le 29 août 2023 à 02:46, Saki Takamachi <saki@sakiot.com> a écrit :
>
> Hello.
>
> I’m Saki Takamachi.
>
> Inspired by the issue below, I'm thinking of proposing this RFC.
> https://github.com/php/php-src/issues/12055
>
> As the documentation below states, PHP's internal functions currently ignore strict_types.
>
> https://www.php.net/manual/en/language.types.declarations.php#language.types.declarations.strict
>
> I think the current spec is not intuitive,
> so I propose changing the behavior of the macro ZEND_ARG_USES_STRICT_TYPES() to allow internal
> functions to accept strict_types.
>
> I plan to make changes in zend_compile.h and zend_compile.c and do the changes myself, I
> haven't written any tests yet, but I'm thinking about making changes like this.
> https://github.com/SakiTakamachi/php-src/pull/1
>
> As per How To Create an RFC, I will first try to gauge response to this proposal on the mailing
> list.
>
> Thank you
>
> Saki Takamachi
Hi,
The larger issue is that higher-order functions do not inherit the
strict_types mode
from its calling code, and this is not specific to internal functions.
If you intend to change that for internal functions (with proper deprecation period, of course), you
might consider making such a behaviour also possible for userland functions (probably using some
opt-in); so that future higher-order internal functions do not become impossible to polyfill.
—Claude