Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:55512 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 78799 invoked from network); 19 Sep 2011 01:00:26 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Sep 2011 01:00:26 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@sugarcrm.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@sugarcrm.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain sugarcrm.com designates 67.192.241.113 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 67.192.241.113 smtp113.dfw.emailsrvr.com Linux 2.6 Received: from [67.192.241.113] ([67.192.241.113:34266] helo=smtp113.dfw.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 06/27-28880-024967E4 for ; Sun, 18 Sep 2011 21:00:25 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp21.relay.dfw1a.emailsrvr.com (SMTP Server) with ESMTP id 95BDF2405AA; Sun, 18 Sep 2011 21:00:09 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp21.relay.dfw1a.emailsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id 2C67F2405A9; Sun, 18 Sep 2011 21:00:09 -0400 (EDT) Message-ID: <4E769418.6040200@sugarcrm.com> Date: Sun, 18 Sep 2011 18:00:08 -0700 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:6.0.2) Gecko/20110902 Thunderbird/6.0.2 MIME-Version: 1.0 To: Pierre Joye CC: PHP internals References: <4E74E5A0.2030006@sugarcrm.com> <4E76320F.6010904@sugarcrm.com> <4E764137.9080507@sugarcrm.com> <4E7685DE.6010805@sugarcrm.com> <4E768C86.3030307@sugarcrm.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] __constructor parameter limitations. From: smalyshev@sugarcrm.com (Stas Malyshev) Hi! On 9/18/11 5:42 PM, Pierre Joye wrote: > But this exact example works, only the similar case using abstract > will fail, and it makes to fail here as an abstract method is only the It produces E_STRICT for regular functions, but for some reason not for ctors, but fatal error for abstract ctors. Quite weird. > declaration, the implementation being done in the child class (bar > extends foo). This is the concept of 'abstract', see it like the > declaration and implementation in C. The PHP documentation is also No, it's not at all like declaration and implementation in C. In C, declaration and implementation relate to the SAME entity. In PHP, abstract method and its (multiple, inependent) implementations are different entities. Moreover, this is prohibited too: abstract class BaseClass { abstract public function foo(Type1 $foo, Type2 $bar); } class ExtendedClass extends BaseClass { public function foo(Type1 $foo, Type2 $bar) {} } class MoreExtendedClass extends ExtendedClass { public function foo() { } } even though it is clear that ExtendedClass::foo() and MoreExtendedClass::foo() are two different concrete functions, so your "abstract is declaration only" argument does not work either. This makes absolutely no sense, as there's no reason why MoreExtendedClass can't extend domain of ExtendedClass. However, for some reason it is prohibited. The example without abstract works, but produces E_STRICT which is useless too. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227