Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:17584 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 14756 invoked by uid 1010); 8 Aug 2005 10:25:56 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 14739 invoked from network); 8 Aug 2005 10:25:55 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Aug 2005 10:25:55 -0000 X-Host-Fingerprint: 80.237.132.12 wp005.webpack.hosteurope.de Linux 2.5 (sometimes 2.4) (4) Received: from ([80.237.132.12:48470] helo=wp005.webpack.hosteurope.de) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 6D/80-04646-23337F24 for ; Mon, 08 Aug 2005 06:25:55 -0400 Message-ID: <6D.80.04646.23337F24@pb1.pair.com> Received: by wp005.webpack.hosteurope.de running Exim 4.43 using esmtpa from dsl-084-057-012-136.arcor-ip.net ([84.57.12.136] helo=WOMBERT) id 1E24pL-0000JI-8i; Mon, 08 Aug 2005 12:25:51 +0200 To: "'PHP Developers Mailing List'" Date: Mon, 8 Aug 2005 12:25:46 +0200 Organization: bitXtender GbR MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.6353 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Thread-Index: AcWb/rbAhYEJ8ds/SD6uLDNBMvrNvQABMsSQ In-Reply-To: Subject: RE: [PHP-DEV] type hinting throwing a fatal error From: dz@bitxtender.com (=?iso-8859-1?Q?David_Z=FClke?=) References: +1 > -----Original Message----- > From: Derick Rethans [mailto:derick@php.net] > Sent: Monday, August 08, 2005 11:50 AM > To: PHP Developers Mailing List > Subject: [PHP-DEV] type hinting throwing a fatal error > > Hei, > > currently if you pass a wrong object's type to a typehinted parameter: > > derick@kossu:~$ cat /tmp/foo.php > class foo { > function bar(foo $a) > { > } > } > > $a = new foo; > $a->bar(new stdClass); > ?> > derick@kossu:~$ php /tmp/foo.php > > Fatal error: Argument 1 must be an instance of foo in /tmp/foo.php > on > line 3 > > As type hinting is a new OO thing, it might perhaps make some sense to > make this an exception instead - as this error might also happen for > dynamic things by people who use the classes you designed. In that case > having this fatal error to stop the whole application can be annoying. > Opinions? > > Derick > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >