|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-10-25 09:31 UTC] dagguh at gmail dot com
[2016-04-16 14:10 UTC] nikic@php.net
-Status: Open
+Status: Wont fix
[2016-04-16 14:10 UTC] nikic@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 08:00:01 2025 UTC |
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()