Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:9407 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 5066 invoked by uid 1010); 20 Apr 2004 01:32:04 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 4966 invoked from network); 20 Apr 2004 01:32:03 -0000 Received: from unknown (HELO alanathome.ossc.com.hk) (202.81.246.113) by pb1.pair.com with SMTP; 20 Apr 2004 01:32:03 -0000 Received: from [192.168.0.40] (helo=akbkhome.com ident=alan) by alanathome.ossc.com.hk with esmtp (Exim 4.24) id 1BFkCv-0000i9-Af; Tue, 20 Apr 2004 09:37:53 +0800 Message-ID: <40847E0C.8030604@akbkhome.com> Date: Tue, 20 Apr 2004 09:34:04 +0800 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6a) Gecko/20031002 X-Accept-Language: en-us, en MIME-Version: 1.0 To: zeev@zend.com, internals@lists.php.net References: <5.1.0.14.2.20040419112627.03efaa00@localhost> In-Reply-To: <5.1.0.14.2.20040419112627.03efaa00@localhost> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Interface inheritance From: alan@akbkhome.com (Alan Knowles) I would prefer an ini option, while on a development or testing server interfaces are great, I would love to be able to reduce this to a E_NOTICE on a live server, and stuff it in an error log... Regards Alan Zeev Suraski wrote: > All, > > Yesterday, someone complained that classes that implement interfaces > succeed in doing so even when they don't satisfy the prototypes. While > this does cause an E_STRICT message to be emitted, it would go unnoticed > in most cases, as E_STRICT is off by default, in some cases - even when > people think it's on. > > I believe that this behavior is wrong. I believe that classes should > not be allowed to say they implement an interface X, unless they > actually implement all of the methods in that interface with methods > that are compatible with its prototypes. > > Reasoning: > - Interfaces (and for that matter, abstract classes) are a new feature > in PHP 5, used solely to enforce implementing classes to abide to the > prototypes. There's no issue of downwards compatibility, and there's no > other use case. > - Without this, the whole mechanism of class type hints is rendered > useless. With it, it gives users the full power of class type hints > (and instanceof, for that matter) - because they always have the option > of adding an interface for their base classes. > > Suggested behavior: > Any method that implements (directly or indirectly) an interface method > or an abstract method, will have implementation checks fully enforced, > with an E_COMPILE_ERROR emitted in case of an error. > Behavior for methods that override regular parent methods, that do not > have interface/abstract prototypes, will not change (E_STRICT message). > > Comments welcome - we'd like to sort this out before RC2... > > Zeev > -- Can you help out? Need Consulting Services or Know of a Job? http://www.akbkhome.com