Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93580 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 83099 invoked from network); 26 May 2016 17:27:14 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 May 2016 17:27:14 -0000 Authentication-Results: pb1.pair.com header.from=php@fleshgrinder.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=php@fleshgrinder.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fleshgrinder.com from 77.244.243.84 cause and error) X-PHP-List-Original-Sender: php@fleshgrinder.com X-Host-Fingerprint: 77.244.243.84 mx103.easyname.com Received: from [77.244.243.84] ([77.244.243.84:56903] helo=mx202.easyname.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3C/9C-17600-1F137475 for ; Thu, 26 May 2016 13:27:14 -0400 Received: from cable-81-173-133-15.netcologne.de ([81.173.133.15] helo=[192.168.178.20]) by mx.easyname.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1b5z3u-0000IN-2u; Thu, 26 May 2016 17:27:10 +0000 Reply-To: internals@lists.php.net References: <20160525215208.034FC1A801B3@dd1730.kasserver.com> <5fd54aa0-4fdf-c1e7-eae8-765aa89c8498@fleshgrinder.com> <08963b03-8394-6d62-4e5b-393f3fcb5647@fleshgrinder.com> <9e9db70d-d72d-d93e-0c81-18c2aa228618@gmail.com> To: Rowan Collins , internals@lists.php.net Message-ID: <409002d8-b5e3-5990-7358-246adc7e3cab@fleshgrinder.com> Date: Thu, 26 May 2016 19:26:56 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: <9e9db70d-d72d-d93e-0c81-18c2aa228618@gmail.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="5EAjEm2idcUAEOOeGLp05RN3qSJ7g20Qm" X-ACL-Warn: X-DNSBL-BARRACUDACENTRAL Subject: Re: [PHP-DEV] [RFC][Vote] Typed Properties From: php@fleshgrinder.com (Fleshgrinder) --5EAjEm2idcUAEOOeGLp05RN3qSJ7g20Qm Content-Type: multipart/mixed; boundary="WMLK8WsnnK7QtbPv8jgDR02CK0tjJXOCI" From: Fleshgrinder Reply-To: internals@lists.php.net To: Rowan Collins , internals@lists.php.net Message-ID: <409002d8-b5e3-5990-7358-246adc7e3cab@fleshgrinder.com> Subject: Re: [PHP-DEV] [RFC][Vote] Typed Properties References: <20160525215208.034FC1A801B3@dd1730.kasserver.com> <5fd54aa0-4fdf-c1e7-eae8-765aa89c8498@fleshgrinder.com> <08963b03-8394-6d62-4e5b-393f3fcb5647@fleshgrinder.com> <9e9db70d-d72d-d93e-0c81-18c2aa228618@gmail.com> In-Reply-To: <9e9db70d-d72d-d93e-0c81-18c2aa228618@gmail.com> --WMLK8WsnnK7QtbPv8jgDR02CK0tjJXOCI Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 5/26/2016 7:20 PM, Rowan Collins wrote: > I think the difference is the emphasis of whose responsibility it is to= > fix it: a TypeError confirms that the error is in the O class for > exposing an incorrectly typed property; a NullPointerException, as you > put it, makes it my fault for trusting the class. >=20 > Or to put it a different way, is the error in the first arrow (accessin= g > "->d") or the second one (de-referencing "d->"). >=20 >=20 > At the end of the day, all the type notations being added to PHP are > just assertions anyway. So the same could be said of this: >=20 > function foo(\DateTime $d) { > echo $d->format('Y-m-d H:i:s'); > } > foo(null); >=20 > If this didn't throw an error at "foo(null)", it would throw an error a= t > "$d->format". >=20 Yes, they are just assertions and design by contract and you make a very good point here for an actual error. I am convinced. ;) However, it should not throw an error for isset() and empty() to allow more special constructs. As we already have it in place everywhere with the two. --=20 Richard "Fleshgrinder" Fussenegger --WMLK8WsnnK7QtbPv8jgDR02CK0tjJXOCI-- --5EAjEm2idcUAEOOeGLp05RN3qSJ7g20Qm Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXRzHkAAoJEOKkKcqFPVVrfn8P/0+Hx/GkoPHKioTOk8K4QMwZ eEPyKX9hcubz1e9dn/TuFog5vB0dkP/sIwAyD8u72rHPFO0MCw8OA0RWfctz4vju X5p3lyyl+Itt6fKoIJWR52/FxpYkbozMOP9k/Ohk8nmVrT//5lPx0zFrzdqKlTxs fIGOFL0IZZteZ0rUtMWAvEEhY8xmpjtdyzyHkrXJtpHNJEugeVLX0Cf3JNP9w9iW 5umLWFXWyPAmYKLVlIbvZNdARBHcS4QscIF7M4mAzZchfeDe++lP5vc3rQL6p6XR wpqbz0dHzYPNEPPyCdOB3lCebG7hlDh15YzE3hFY/h4n7r8TXotWFv4ZTOSK3ZVW 52CaRUTza7N90Cede5h782Ca+sJ/KZErBTiqbOKt/d4DZLZMLkw5GnTT7XXK8t6P wV6uQirnVzAdelQWO+9nDr6DCZjekgM3pChkifYxVQNssjNzCSM6/XQvgrm2T0Va +E1xJzzz+D3fxdVvG9mR3r+B1J4upxprt5oB7J4B/ID85/SdLdBJibyYcifCcnY4 +qRuEcOhR9q4pe/5VX84E5+mnwCQwX9NEWWLaxknA7yK+dxmpc25Qc2NW16E4lpo jZxJ/CA6CwcqWVLx62oW9OTIGtN7fI1nhyAHaqkiFZTrRNfQ/mkltBDokubTC9Xy syYO+zNQmINjHims/c61 =QurW -----END PGP SIGNATURE----- --5EAjEm2idcUAEOOeGLp05RN3qSJ7g20Qm--