Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:66975 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 67993 invoked from network); 5 Apr 2013 11:10:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Apr 2013 11:10:02 -0000 X-Host-Fingerprint: 86.14.252.140 cpc3-asfd3-2-0-cust139.1-2.cable.virginmedia.com Received: from [86.14.252.140] ([86.14.252.140:26427] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F9/D1-57919-801BE515 for ; Fri, 05 Apr 2013 06:10:01 -0500 To: internals@lists.php.net,Madara Uchiha Message-ID: <515EB105.4090505@php.net> Date: Fri, 05 Apr 2013 12:09:57 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130311 Thunderbird/17.0.4 MIME-Version: 1.0 References: <515EABF4.8070401@php.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 86.14.252.140 Subject: Re: Inconsistency in class definition/usage order From: krakjoe@php.net (Joe Watkins) On 04/05/2013 12:01 PM, Madara Uchiha wrote: > That's not the problem, the problem is when you extend a class with a > (defined) interface, you can't use the class before it is defined (the > class, not the interface). See the examples on the linked question. > > > On Fri, Apr 5, 2013 at 1:48 PM, Joe Watkins wrote: >> On 04/05/2013 11:39 AM, Madara Uchiha wrote: >>> >>> After I saw this question on Stack Overflow: >>> >>> http://stackoverflow.com/questions/15688642/how-does-a-class-extension-or-interface-work, >>> I realized that the guy was right. >>> >>> Is there an explanation for this, or is it just one of those things >>> that got overlooked? >>> >>> Should something be done? (i.e. enforcing class usage only after >>> definition?) >>> >> Interfaces must be declared before being referenced. >> >> Joe It is a logical extension, you declare a class to implement an interface it is subject to the same rules as declaring an interface - ... it must be declared before it is used.