Bug #55524 [Opn->Asn]: Traits should not be able to extend a class
| From: | gron@php.net | Date: | Sun, 28 Aug 2011 08:05:24 +0000 |
| Subject: | Bug #55524 [Opn->Asn]: Traits should not be able to extend a class | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-162979@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=55524&edit=1
ID: 55524
Updated by: gron@php.net
Reported by: gron@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] gron@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