Re: [PHP-DEV] [RFC][Discussion] Objects can be declared falsifiable

2022-11-02 Thread Josh Bruce
Thank you all for the engagement so far. (Note: All scalar types and one compound type can be cast as true or false natively - of the scalar and compound types, callable and object are the only two with no, native false representation.) > Have you tried not initializing invalid objects? This

Re: [PHP-DEV] ReflectionType for iterable / PHP 8.2

2022-11-02 Thread Levi Morrison via internals
FYI, it is also noted in the [UPGRADING][1] file: > - Core: > . The iterable type is now a built-in compile time alias for > array|Traversable. >Error messages relating to iterable will therefore now use > array|Traversable. >Type Reflection is preserved for single iterable (and

Re: [PHP-DEV] ReflectionType for iterable / PHP 8.2

2022-11-02 Thread Benjamin Morel
> > > That's a intentional behaviour change and related to this accepted PHP > 8.2 RFC: https://wiki.php.net/rfc/iterator_xyz_accept_array > > > > Smile, > > Juliette > > It is rather related the following RFC: > > https://wiki.php.net/rfc/dnf_types > > The change was discussed in this thread: > >

Re: [PHP-DEV] [RFC][Discussion] Objects can be declared falsifiable

2022-11-02 Thread Jordan LeDoux
On Wed, Nov 2, 2022 at 1:12 AM Michał Marcin Brzuchalski < michal.brzuchal...@gmail.com> wrote: > Hi Josh, > > Have you tried not initializing invalid objects? This could help you. > Also that sounds more logical to me as I don't see any reasons to > initialize invalid objects if it's a matter of

Re: [PHP-DEV] ReflectionType for iterable / PHP 8.2

2022-11-02 Thread Claude Pache
> Le 2 nov. 2022 à 19:54, Juliette Reinders Folmer > a écrit : > > On 2-11-2022 18:46, Benjamin Morel wrote: >> Hi internals, >> >> It just came to my attention that there is a change of behaviour between >> PHP 8.1 and 8.2 in the way iterable is decomposed, or not, into >>

Re: [PHP-DEV] ReflectionType for iterable / PHP 8.2

2022-11-02 Thread Juliette Reinders Folmer
On 2-11-2022 18:46, Benjamin Morel wrote: Hi internals, It just came to my attention that there is a change of behaviour between PHP 8.1 and 8.2 in the way iterable is decomposed, or not, into Traversable|array when reflected: ``` function foo(): iterable {} function bar(): stdClass|iterable

Re: [PHP-DEV] [RFC][Discussion] Objects can be declared falsifiable

2022-11-02 Thread Marco Pivetta
On Wed, 2 Nov 2022 at 18:51, Claude Pache wrote: > > > > Le 2 nov. 2022 à 09:12, Michał Marcin Brzuchalski < > michal.brzuchal...@gmail.com> a écrit : > > > > P.S. I don't see it feasible to have objects that evaluate false in > > logical expressions. > > For better or for worse (IMHO, for

Re: [PHP-DEV] [RFC][Discussion] Objects can be declared falsifiable

2022-11-02 Thread Claude Pache
> Le 2 nov. 2022 à 09:12, Michał Marcin Brzuchalski > a écrit : > > P.S. I don't see it feasible to have objects that evaluate false in > logical expressions. For better or for worse (IMHO, for worse), `SimpleXMLElement` instances representing attributeless empty elements are already falsy,

[PHP-DEV] ReflectionType for iterable / PHP 8.2

2022-11-02 Thread Benjamin Morel
Hi internals, It just came to my attention that there is a change of behaviour between PHP 8.1 and 8.2 in the way iterable is decomposed, or not, into Traversable|array when reflected: ``` function foo(): iterable {} function bar(): stdClass|iterable {} echo (new

Re: [PHP-DEV] [RFC][Discussion] Objects can be declared falsifiable

2022-11-02 Thread Michał Marcin Brzuchalski
Hi Josh, pon., 31 paź 2022 o 20:38 Josh Bruce napisał(a): > Hello Interntals, > > Someone reached out to me outside of internals regarding the RFC I > submitted on being able to declare objects falsifiable, so, I decided to > update and re-enter the fray. > > I’ve updated the references section