|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-01-17 18:19 UTC] johannes@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Tue Feb 10 10:00:01 2026 UTC |
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