Edit report at http://bugs.php.net/bug.php?id=52730&edit=1

 ID:                 52730
 User updated by:    wrzasq at gmail dot com
 Reported by:        wrzasq at gmail dot com
 Summary:            Impossible to implement Interfaces with same method
                     names
 Status:             Open
 Type:               Bug
 Package:            Scripting Engine problem
 Operating System:   Debian
 PHP Version:        5.3.3
 Block user comment: N

 New Comment:

Sorry, a little misstake - of course classes B in case two and three
extend classes A.


Previous Comments:
------------------------------------------------------------------------
[2010-08-29 13:02:13] wrzasq at gmail dot com

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


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=52730&edit=1

Reply via email to