Re: Object Type Casting Reloaded

From: Date: Tue, 23 Apr 2019 13:52:47 +0000
Subject: Re: Object Type Casting Reloaded
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-105359@lists.php.net to get a copy of this message
> On 23 Apr 2019, at 19:32, Benjamin Morel <benjamin.morel@gmail.com> wrote: > > I'm sorry, I still don't understand what the issue with foreach is? As I said before, > the proposed syntax does not aim to be used inside the foreach () parentheses, but rather as an > explicit declaration inside the foreach {} block. > And as I said before, I can’t understand how that is supposed to be better than just doing what works now, using instanceof to check the type inside the block: if (! $foo instanceof Foo) { throw new TypeError(…); } At least with the above, it’s obvious what is happening.

« previous php.internals (#105359) next »