Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:57004 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95243 invoked from network); 22 Dec 2011 15:18:24 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Dec 2011 15:18:24 -0000 Authentication-Results: pb1.pair.com header.from=chortos@inbox.lv; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=chortos@inbox.lv; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain inbox.lv designates 89.111.3.84 as permitted sender) X-PHP-List-Original-Sender: chortos@inbox.lv X-Host-Fingerprint: 89.111.3.84 shark4.inbox.lv Received: from [89.111.3.84] ([89.111.3.84:38438] helo=shark4.inbox.lv) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AC/63-12618-C3A43FE4 for ; Thu, 22 Dec 2011 10:18:22 -0500 Received: from mail.inbox.lv (pop [10.0.1.110]) by shark4-plain.inbox.lv (Postfix) with ESMTP id A9FE4231FB; Thu, 22 Dec 2011 17:18:16 +0200 (EET) Received: from [192.168.1.139] (unknown [77.38.233.95]) (Authenticated sender: chortos@inbox.lv) by mail.inbox.lv (Postfix) with ESMTPSA id 83A0514ED0; Thu, 22 Dec 2011 17:18:15 +0200 (EET) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii In-Reply-To: <006801ccc0bc$04e876b0$0eb96410$@alliantinternet.com> Date: Thu, 22 Dec 2011 17:18:14 +0200 Cc: "'Nikita Popov'" , "'Alain Williams'" , Content-Transfer-Encoding: quoted-printable Message-ID: <792BD425-1447-4FF3-8ED1-8C8701662432@inbox.lv> References: <2095305E-D4E3-4D7E-8218-32EE99688E0C@GMAIL.COM> <2C90FB94-38C4-4270-8C6A-B89304BA8ED8@gmail.com> <159A7CA2-8561-40DA-9434-CAAE12304DDB@gmail.com> <005701ccc0b3$58c8dee0$0a5a9ca0$@alliantinternet.com> <20111222145159.GY25857@alliantinternet.com> <006101ccc0ba$46b81160$d4283420$@alliantinternet.com> <006801ccc0bc$04e876b0$0eb96410$@alliantinternet.com> To: "Dmitri Snytkine" X-Mailer: Apple Mail (2.1084) X-Virus-Scanned: OK Subject: Re: [PHP-DEV] Return Type Hinting for Methods RFC From: chortos@inbox.lv (Oleg Oshmyan) > public function \Customer getCustomer(){ > return $this->customer; > } >=20 > If the $customer instance variable is not declared with the type = Customer > then first of all IDE will not be able to spot an error, second = compiler may > have a slighly harder time of detecting a mismatch. The compiler does not even try to detect a mismatch; type hinting is taken into account at run-time only. So whenever this function executes, if it tries to return a value that is not a \Customer, a run-time error will be reported. --=20 Oleg=