> Le 9 juil. 2025 à 14:21, Gina P. Banyard <[email protected]> a écrit :
>
> On Wednesday, 9 July 2025 at 08:17, Daikaras <[email protected]> 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