Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:96576 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 14390 invoked from network); 24 Oct 2016 05:38:53 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Oct 2016 05:38:53 -0000 Authentication-Results: pb1.pair.com header.from=php-lists@koalephant.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=php-lists@koalephant.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain koalephant.com designates 206.123.115.54 as permitted sender) X-PHP-List-Original-Sender: php-lists@koalephant.com X-Host-Fingerprint: 206.123.115.54 mail1.25mail.st Received: from [206.123.115.54] ([206.123.115.54:44801] helo=mail1.25mail.st) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A6/17-28528-C6E9D085 for ; Mon, 24 Oct 2016 01:38:52 -0400 Received: from [10.0.1.23] (unknown [183.89.42.34]) by mail1.25mail.st (Postfix) with ESMTPSA id 452F660339; Mon, 24 Oct 2016 05:38:40 +0000 (UTC) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) In-Reply-To: <6b490ba3-ad2d-2a2b-9117-de53ce7fea7f@gmail.com> Date: Mon, 24 Oct 2016 12:38:34 +0700 Cc: =?utf-8?Q?Micha=C5=82_Brzuchalski?= , PHP Internals List Content-Transfer-Encoding: quoted-printable Message-ID: References: <1e7da1db-9fc6-a3ce-9cba-b219af2dd7d4@gmail.com> <7F1CFE1E-48A4-450E-BFD5-645100A16AE9@koalephant.com> <6b490ba3-ad2d-2a2b-9117-de53ce7fea7f@gmail.com> To: Stanislav Malyshev X-Mailer: Apple Mail (2.3124) Subject: Re: [PHP-DEV] [RFC][DISCUSSION] Object type hint From: php-lists@koalephant.com (Stephen Reay) No, I don=92t expect all objects to have the same properties. So, today I learned that `$foo =3D 1; isset($foo->bar);` doesn=92t throw = an error about a non-object. However, property_exists *does* throw = errors in that situation, as does get_object_vars() - two situations = where you *can* pass any object, so long as it is an object. Like I said, the functionality is possible without it. But what = functionality was impossible without int/float/string type hints? They = just make it much clearer, with less repeated boiler plate, what = arguments you can actually accept. Cheers Stephen > On 24 Oct 2016, at 12:05, Stanislav Malyshev = wrote: >=20 > Hi! >=20 >> In the same way that Iterable type hint allows you to safely do a >> foreach on an argument, object allows you to safely use property >> accessor syntax (i.e. ->). For me it would be most useful in lower >> level utility classes. >=20 > Not sure I get this point. How you can safely use -> if you have no = idea > what object you've got? You certainly don't expect every object to = have > the same properties? >=20 > --=20 > Stas Malyshev > smalyshev@gmail.com >=20