|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-08-29 15:43 UTC] wrzasq at gmail dot com
[2010-08-29 17:19 UTC] felipe@php.net
-Status: Open
+Status: Bogus
[2010-08-29 17:19 UTC] felipe@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Dec 12 14:00:02 2025 UTC |
Description: ------------ It's impossible to implement interfaces with same method names. Whath's the most strange is, that you can simply "hack" this by implementing each interface at different inheritance level. (it's in fact PHP 5.3.2 issue, but I didn't see it fixed in PHP 5.3.3) Test script: --------------- first case: -- interface Foo { public function getID(); } interface Bar { public function getID(); } class A implements Foo, Bar { public function getID() { return 1; } } second case: -- interface Foo { public function getID(); } interface Bar { public function getID(); } class A implements Foo { public function getID() { return 1; } } class B implements Bar { } third case: -- interface Foo { public function getID(); } interface Bar { public function getID(); } class A implements Foo { public function getID() { return 1; } } class B implements Bar { public function getID() { return parent::getID(); } } Expected result: ---------------- Nothing at output, but all of them compile. Actual result: -------------- first case: Fatal error: Can't inherit abstract function Bar::getID() (previously declared abstract in Foo) in Command line code on line 1 second case: Fatal error: Can't inherit abstract function Bar::getID() (previously declared abstract in Foo) in Command line code on line 1 third case: worked fine