Re: [RFC] Deprecations for PHP 8.5
| From: | Claude Pache | Date: | Wed, 09 Jul 2025 21:23:04 +0000 |
| Subject: | Re: [RFC] Deprecations for PHP 8.5 | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-127981@lists.php.net to get a copy of this message | ||
> Le 9 juil. 2025 à 14:21, Gina P. Banyard <internals@gpb.moe> a écrit :
>
> On Wednesday, 9 July 2025 at 08:17, Daikaras <webmaster@daikaras.lt> wrote:
>>
>>> We propose to deprecate the following non-standard cast names:
>>>
>>> (integer)
>>> (boolean)
>>> (double)
>>> (binary)
>> Hello,
>>
>> Just wondering is this going to affect
settype() function?
>> There is already some disparity in that settype() supports
>> integer/boolean/double but not
>> binary type (and additionally supports
>> null type).
>>
> I wasn't aware of the discrepencies with settype() so I added the deprecation of
> non-canonical type names to settype() as its own deprecation entry in the ext/standard section.
> Thanks for bringing this to my attention!
>
> Best regards,
>
> Gina P. Banyard
Hi,
A possible reason for wanting to use the non-canonical names in settype(), is that those names are
returned by gettype(). Fictional example (not intended to be reasonable, only illustrative):
```php
function settype_from(&$a, &b) {
return settype($a, gettype($b));
}
```
Personally, I have used "integer", etc. instead of "int", etc., in settype() in
the past, because those were the “canonical” (as I perceived) forms returned by gettype(). I
have slowly fallen out of that habit in the years after I began to use scalar type declarations
(introduced in PHP 7).
—Claude