#45601 [NEW]: Extending interfaces
From: david at grudl dot com
Operating system: irrelevant
PHP version: 5.3CVS-2008-07-23 (snap)
PHP Bug Type: Feature/Change Request
Bug description: Extending interfaces
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 bug report at http://bugs.php.net/?id=45601&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45601&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45601&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45601&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=45601&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=45601&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=45601&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=45601&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=45601&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=45601&r=support
Expected behavior: http://bugs.php.net/fix.php?id=45601&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=45601&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=45601&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=45601&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45601&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=45601&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=45601&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=45601&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=45601&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=45601&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=45601&r=mysqlcfg
Thread (5 messages)
- david at grudl dot com