|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2012-01-28 05:23 UTC] davey@php.net
Description:
------------
While I know it should not be possible to have a trait extend another trait, the
error message is confusing, stating that you are trying to extend a class.
I understand that "use" is the correct answer to the problem the script is trying
to solve.
Test script:
---------------
<?php
trait Foo { }
trait Bar extends Foo { }
Expected result:
----------------
Fatal error: A trait (Bar) cannot extend a trait (Foo) in ...
Better yet:
Fatal error: A trait (Bar) cannot extend a trait (Foo), use "use" instead in ...
or some such.
Actual result:
--------------
Fatal error: A trait (Bar) cannot extend a class in ...
Patchesextend-error-msg.patch (last revision 2012-01-31 10:01 UTC by gron@php.net)Pull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 07:00:01 2025 UTC |
actually this is difficult to achieve, think about: a.php <?php trait Foo { } ?> index.php <?php require "a.php"; trait Bar extends Foo { } ?> then you can not get any info of Foo while parsing index.php