Re: [PHP-DEV] Unified ReflectionType methods

2021-10-02 Thread Andreas Hennings
Another challenge would be array types like array or C[], or array{i: int, s: string}. And template/generic types like \Iterator. Following the normalization idea, we could add a method getArrayTypes(). But I am not sure how far we get with this, I think there will be a wall somewhere. On Sun, 3

Re: [PHP-DEV] Unified ReflectionType methods

2021-10-02 Thread Andreas Hennings
On Sun, 3 Oct 2021 at 07:40, Sebastian Bergmann wrote: > > Am 02.10.2021 um 16:37 schrieb tyson andre: > > `ReflectionType->allowsValue(mixed $value, bool $strict = true): bool` > > Not having to implement and maintain that functionality in userland would > be brilliant and much appreciated. Right

Re: [PHP-DEV] Unified ReflectionType methods

2021-10-02 Thread Andreas Hennings
On Sat, 2 Oct 2021 at 16:37, tyson andre wrote: > > Hi Andreas, > > > Hello list, > > I would like to propose new methods for ReflectionType, that would > > allow treating ReflectionNamedType and ReflectionUnionType in a > > unified way. > > This would eliminate the need for if (.. instanceof) in

Re: [PHP-DEV] Unified ReflectionType methods

2021-10-02 Thread Sebastian Bergmann
Am 02.10.2021 um 16:37 schrieb tyson andre: `ReflectionType->allowsValue(mixed $value, bool $strict = true): bool` Not having to implement and maintain that functionality in userland would be brilliant and much appreciated. Right now we have https://github.com/sebastianbergmann/type for this

[PHP-DEV] [RFC] Allow null as standalone type

2021-10-02 Thread G. P. B.
Hello internals, I'm proposing a new RFC to make 'null' usable as a standalone type. RFC: https://wiki.php.net/rfc/null-standalone-type GitHub PR: https://github.com/php/php-src/pull/7546 Best regards, George P. Banyard

Re: [PHP-DEV] Unified ReflectionType methods

2021-10-02 Thread tyson andre
Hi Andreas, > Hello list, > I would like to propose new methods for ReflectionType, that would > allow treating ReflectionNamedType and ReflectionUnionType in a > unified way. > This would eliminate the need for if (.. instanceof) in many use cases. > > Some details can still be discussed, e.g. w