Hi!
Are optional argument specifications inherited? I did not think they
were, but its not clear if you are saying they are.
Of course they are - how couldn't they be, they are part of method
definition.
My understanding of PHP's optional arguments is that they only apply
to a function once it is called.
Yes, but it doesn't prevent them from being part of inheritance logic.
if you have foo($a = 1) then you can't override it with foo($a) - it
violates LSP (imagine somebody calling $a->foo()).
And it is doing something - if
you declare interface as foo(int $a) and implement it as foo(string $a)
there may be a lot of WTF happening.
I mean that it is never called, therefore the type hints are not
checked, and this is fine.
But it is called! The whole point of the interface is to call it - i.e.
to have code use the fact that you can be sure to have foo(int $a) in
some object of some unknown class.
--
Stanislav Malyshev, Zend Software Architect
s...@zend.com http://www.zend.com/
(408)253-8829 MSN: s...@zend.com
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php