Edit report at https://bugs.php.net/bug.php?id=60145&edit=1
ID: 60145 Updated by: g...@php.net Reported by: ninzya at inbox dot lv Summary: interface + use trait yields error for the abstract class? -Status: Open +Status: Assigned Type: Bug Package: Scripting Engine problem Operating System: Any PHP Version: 5.4.0beta2 -Assigned To: +Assigned To: gron Block user comment: N Private report: N Previous Comments: ------------------------------------------------------------------------ [2011-10-26 20:28:38] ninzya at inbox dot lv 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). ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=60145&edit=1