[PHP-DEV] Re: Inconsistency in class definition/usage order
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. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Re: Inconsistency in class definition/usage order
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 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Re: Inconsistency in class definition/usage order
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 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php