On Mon, July 7, 2025 at 11:03 Niels Dossche wrote:

>>> There are a few things I will vote no for:
>>>
>>> [...]
>>>
>>> * Deprecate using values of type null and bool as array offsets and when 
>>> calling array_key_exists()
>>> Deprecating this would make the language more inconsistent by allowing this 
>>> on array offsets but not on the function.
>>
>> I am slightly confused by what you mean by "allowing this on array offsets 
>> but not on the function".
>> However, null is not accepted by functions that accept scalar types, and 
>> bool would neither if my other RFC is approved.
>> Moreover, a type declaration of int|string accepted Stringable objects, 
>> however array offsets do not accept objects at all.
>
> I'll clarify:
> You're allowed to do $array[null], $array[3.14], etc... and the key will 
> coerce.
> I expect array_key_exists() to behave the same way as keys on array accesses 
> do.

I'm confused what you mean as well. The deprecation is for both array offsets 
and when calling array_key_exists().
So $array[null] should output a deprecation just like the function, and there 
isn't any inconsistency.

Regards,
Theodore Brown

Reply via email to