Edit report at https://bugs.php.net/bug.php?id=60107&edit=1
ID: 60107 Comment by: dagguh at gmail dot com Reported by: mkallman at gmail dot com Summary: Allow subtype polymorphism in interfaces Status: Open Type: Feature/Change Request Package: Unknown/Other Function Operating System: All PHP Version: 5.3.8 Block user comment: N Private report: N New Comment: I disagree, your request violates the LSP. http://en.wikipedia.org/wiki/Liskov_substitution_principle Derived classes cannot expect more than parent class expects. By more I mean a condition that is harder to meet. Previous Comments: ------------------------------------------------------------------------ [2011-10-21 11:59:16] mkallman at gmail dot com Description: ------------ Please allow for subtype polymorphism/downcasting in interfaces. Test script: --------------- interface Deliverable {} interface DeliverableWithTruck extends Deliverable {} interface DeliveryService { function deliver( Deliverable $deliverable, $destination ); } class CookieJar implements DeliverableWithTruck {} class ExpressDeliveryService implements DeliveryService { function deliver( DeliverableWithTruck $deliverable, $destination ) { echo "Delivery underway"; } } $fedEx = new ExpressDeliveryService; $chocolateChipCookies = new CookieJar; $fedEx->deliver( $chocolateChipCookies, "Sesame Street" ); Expected result: ---------------- Delivery underway Actual result: -------------- Fatal error: Declaration of ExpressDeliveryService::deliver() must be compatible with that of DeliveryService::deliver() ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=60107&edit=1