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

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



Previous Comments:
------------------------------------------------------------------------
[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