Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:105359 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 13701 invoked from network); 23 Apr 2019 16:52:43 -0000 Received: from unknown (HELO mail1.25mail.st) (206.123.115.54) by pb1.pair.com with SMTP; 23 Apr 2019 16:52:43 -0000 Received: from [10.0.1.79] (unknown [49.48.243.98]) by mail1.25mail.st (Postfix) with ESMTPSA id 3C9656046A; Tue, 23 Apr 2019 13:52:51 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.8\)) In-Reply-To: Date: Tue, 23 Apr 2019 20:52:47 +0700 Cc: Andrey Hristov , Nikita Popov , Dan Ackroyd , azjezz , PHP Internals Content-Transfer-Encoding: quoted-printable Message-ID: <71E9312E-C4A6-44EB-AB1C-D8E063EB946A@koalephant.com> References: <9fee0f79-a77d-c0f1-ec24-efa4dd587f91@hristov.com> To: Benjamin Morel X-Mailer: Apple Mail (2.3445.104.8) Subject: Re: [PHP-DEV] Object Type Casting Reloaded From: php-lists@koalephant.com (Stephen Reay) > On 23 Apr 2019, at 19:32, Benjamin Morel = wrote: >=20 > 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. >=20 And as I said before, I can=E2=80=99t 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(=E2=80=A6); } At least with the above, it=E2=80=99s obvious what is happening.