|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2020-09-04 07:28 UTC] nikic@php.net
-Status: Open
+Status: Verified
[2020-09-04 07:28 UTC] nikic@php.net
[2020-10-15 12:24 UTC] nikic@php.net
[2020-10-15 12:24 UTC] nikic@php.net
-Status: Verified
+Status: Closed
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 03:00:02 2025 UTC |
Description: ------------ If a concrete method implemented by a trait is declared as returning "self", it is considered incompatible with an abstract declaration of that method in another trait. Test script: --------------- trait AbstractTrait { abstract public function selfReturner() : self; } trait ConcreteTrait { public function selfReturner() : self { return $this; } } class Test { use AbstractTrait; use ConcreteTrait; } Expected result: ---------------- The AbstractTrait trait should be satisfied by the implementation provided by ConcreteTrait. Actual result: -------------- Fatal error: Declaration of ConcreteTrait::selfReturner(): ConcreteTrait must be compatible with AbstractTrait::selfReturner(): AbstractTrait