ID:               45601
 Comment by:       david at grudl dot com
 Reported By:      david at grudl dot com
 Status:           Open
 Bug Type:         Feature/Change Request
 Operating System: irrelevant
 PHP Version:      5.3CVS-2008-07-23 (snap)
 New Comment:

p.s. is really the error message formulation "(previously declared
abstract in IHuman)" correct?


Previous Comments:
------------------------------------------------------------------------

[2008-07-23 11:30:28] david at grudl dot com

Description:
------------
I think this fatal error is needless. 

Interface implementors can append optional parameter:

interface IAnimal
{
        function speak();
}

class Dog implements IAnimal
{
        function speak($optional = NULL)
        {
                echo 'Bark!';
        }
}

class Labrador extends Dog
{
        function speak($optional = NULL, $anotherOptinal = NULL)
        {
                ...
        }
}


That's correct behaviour. But the same behaviour is unallowed for
interface extenders. 



Reproduce code:
---------------
interface IAnimal
{
        function speak();
}


interface IHuman extends IAnimal
{
        function speak($language = NULL);
}




Expected result:
----------------
no error

Actual result:
--------------
Fatal error: Can't inherit abstract function IAnimal::speak()
(previously declared abstract in IHuman) 


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


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

Reply via email to