|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-10-31 23:02 UTC] gron@php.net
-Status: Open
+Status: Assigned
-Assigned To:
+Assigned To: gron
[2011-11-01 00:39 UTC] gron@php.net
[2011-11-01 00:40 UTC] gron@php.net
-Status: Assigned
+Status: Closed
[2011-11-01 00:40 UTC] gron@php.net
[2012-04-18 09:48 UTC] laruence@php.net
[2012-07-24 23:39 UTC] rasmus@php.net
[2013-11-17 09:35 UTC] laruence@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 16 19:00:01 2025 UTC |
Description: ------------ The code in the test script contains one trait and an interface, that uses this trait ("use TestTrait"). What I was trying to do here is to see how PHP behaves if i include "use" statement inside interface definition. Suprisingly, test script produces very interesting result - I get a fatal error with the following text: "Class TestInterface contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (TestInterface::b)". It looks like PHP's compiler messes up when I mix interfaces together with "use" statement and somehow treats "TestInterface" as an abstract class. I didn't go deeper to look into the problem as it's pretty clear that something is wrong here. In my opinion, PHP should not allow usage of "use" statment inside interface defitions. Test script: --------------- trait TestTrait { } interface TestInterface { use TestTrait; public function b(); } Expected result: ---------------- PHP Fatal error: use of "use" statement in interfaces is not allowed. Actual result: -------------- PHP Fatal error: Class TestInterface contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (TestInterface::b).