Re: Interface inheritance
| From: | Stanislav Malyshev | Date: | Tue, 20 Apr 2004 14:55:48 +0000 |
| Subject: | Re: Interface inheritance | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-9424@lists.php.net to get a copy of this message | ||
FB>>Impl guarantees that by implementing interface A.
No. It _says_ it implements interface A, but you couldn't know if it
indeed does, if we allow your model - maybe that "dispatched" function
call doesn't really accept those arguments?
FB>>What if Impl::doSomething() would accept exactly two parameters, but
FB>>expects them to be arrays?
Then how can you say it implements B where object is required?
Since PHP does not dispatch methods by parameters, I don't know if there's
a good way to implement both A and B interfaces except making all
doSomething definitions not accept parameters or give them different
names.
FB>>IMO you cannot enforce this strictness with loose types...
When you use interfaces and typehints, you give up the loose-typedness,
not? You say "here the types can't be loose - I want exactly this class
and nothing else in this parameter".
--
Stanislav Malyshev, Zend Products Engineer
stas@zend.com http://www.zend.com/ +972-3-6139665 ext.115