ID:               47106
 Updated by:       johan...@php.net
 Reported By:      rico dot moorman at gmail dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Feature/Change Request
 Operating System: Linux
 PHP Version:      5.2.8
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

The derived intrface must fullfill the "is-a" relationship, you can add
optional paramters, but all calls which are allowed with the parent have
to be allowed with the extended interface, too.


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

[2009-01-14 19:05:55] rico dot moorman at gmail dot com

Description:
------------
With interfaces we are given the possibility to extend them too. We may
define additional methods. But while it's possible to add new methods
it's not possible to change the method signatures.

Within the "normal" class hierarchy on the other hand it's possible
though.

Adding this to the Interface implementation would surely lead to more
overall flexibility of the Interfaces/abstracts.

Reproduce code:
---------------
// interfaces to test with
interface MillableInterface { }
interface StoneInterface extends MillableInterface { }
interface WheatInterface extends MillableInterface { }

// works actually
class Mill {
    function mill(MillableInterface $stuff) {}
}
class StoneMill extends Mill {
    function mill(StoneInterface $stuff) {}
}
class WheatMill extends Mill {
    function mill(WheatInterface $stuff) {}
}

// doesn't work
interface MillInterface {
    function mill(MillableInterface $stuff);
}
interface StoneMillInterface extends MillInterface {
    function mill(StoneInterface $stuff);
}
interface WheatMillInterface extends MillInterface {
    function mill(WheatInterface $stuff);
}

Expected result:
----------------
no fatals ... just a working interface check

Actual result:
--------------
Fatal error: Can't inherit abstract function MillInterface::mill()
(previously declared abstract in StoneMillInterface) in
/home/rico/dingen.php on line 29


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


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

Reply via email to