Re: Apply strict_types to internal functions
| From: | Saki Takamachi | Date: | Tue, 29 Aug 2023 13:19:40 +0000 |
| Subject: | Re: Apply strict_types to internal functions | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-120944@lists.php.net to get a copy of this message | ||
> 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
Hi, thank you for confirming.
If you simply put the problem you pointed out in the code, would it be something like this?
https://gist.github.com/SakiTakamachi/8292dbfe92a2029a6c7b506b12296b7d
Admittedly, I don't think this is intuitive either.
However, if you always inherit the strict_types of the PHP file that is the starting point of
processing, in most frameworks the settings in “index.php" will affect everything.
When considering the inheritance of strict_types, I think that it should be an attribute that can be
set in “php.ini" instead of being specified for each file.
What do you think?
saki