Re: Apply strict_types to internal functions
| From: | Lynn | Date: | Tue, 29 Aug 2023 07:41:34 +0000 |
| Subject: | Re: Apply strict_types to internal functions | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-120941@lists.php.net to get a copy of this message | ||
On Tue, Aug 29, 2023 at 2:46 AM Saki Takamachi <saki@sakiot.com> wrote:
> 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
>
Heya!
I was not aware that strict types didn't work here. While I'm 100% behind
the idea, I am afraid that changing this will break code in currently
strict files where the assumption was made that it already worked like
that. It would probably have to give deprecation notices first, and then
possibly a warning or removal in the next major to be feasible.