Edit report at https://bugs.php.net/bug.php?id=55524&edit=1

 ID:                 55524
 Comment by:         good821 at 126 dot com
 Reported by:        g...@php.net
 Summary:            Traits should not be able to extend a class
 Status:             Assigned
 Type:               Bug
 Package:            Scripting Engine problem
 PHP Version:        5.4.0alpha3
 Assigned To:        gron
 Block user comment: N
 Private report:     N

 New Comment:

http://www.officialpackersjerseyshop.com/green-bay-packers-jerseys-paul-hornung-jersey-c-11_25.html
     Paul Hornung Jersey
http://www.officialpackersjerseyshop.com/green-bay-packers-jerseys-ray-nitschke-jersey-c-11_27.html
     Ray Nitschke Jersey
http://www.officialpackersjerseyshop.com/green-bay-packers-jerseys-reggie-white-jersey-c-11_24.html
     Reggie White Jersey


Previous Comments:
------------------------------------------------------------------------
[2011-08-29 05:13:33] g...@php.net

Checking for interface is already done. As well as checking that classes do not 
extend traits. I only missed checking that traits do not extend classes, as far 
as 
I can tell. Plan to fix it later this week.

------------------------------------------------------------------------
[2011-08-29 01:03:01] ka...@php.net

Might also be worth checking the implements keyword if a user tries to 
implement an interface (or multiple)

------------------------------------------------------------------------
[2011-08-28 08:05:04] g...@php.net

Description:
------------
Spotted by this post: http://zuttonet.com/articles/php-class-traits/

Traits build their own hierarchy of uses, but there is no useful semantics for 
extending classes.

For instance:


trait Foo extends Base {
    function bar() {}
}


The semantics for that is not defined (and actually at least broken for 
abstract 
methods).


This should give a fatal error as would the other way around (Base extends Foo).


Test script:
---------------
trait Foo extends Base {
    function bar() {}
}

Expected result:
----------------
Fatal error: A trait (Foo) cannot extend a class (Base) in %s on line %d



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=55524&edit=1

Reply via email to