On Tue, Feb 25, 2020 at 4:33 PM Nikita Popov <nikita....@gmail.com> wrote:

> Hi internals,
>
> I've put up https://github.com/php/php-src/pull/5209 to deprecate the
> following reflection methods:
>
>  * ReflectionParameter::isArray()
>  * ReflectionParameter::isCallable()
>  * ReflectionParameter::getClass()
>
> These APIs have been superseded by ReflectionParameter::getType() since
> PHP 7.0. Types introduced since that time are not available through the old
> APIs. The behavior of these methods becomes increasingly confusing with
> additional type system extensions. With the addition of union types in PHP
> 8:
>
>  * isArray() will return true if the type is array or ?array, but not any
> other union type.
>  * getClass() will return a ReflectionClass for T|int etc, as long as the
> union only contains a single type. T1|T2 will return null.
>
> There is really no reasonable behavior for these methods in the presence
> of union types; we should start phasing them out.
>
> One point I'm not sure about is whether we want to deprecate
> ReflectionParameter::allowsNull() as well. Logically this method belongs on
> ReflectionType (and does in fact exist there), but the way it is formulated
> is still compatible with union types, so leaving it alone is a possibility.
>
> Regards,
> Nikita
>

Any more feedback on this?

Nikita

Reply via email to