Hi Bob,

On 30/07/2014 14:33, Bob Weinand wrote:
> Is this a problem if the interface internally doesn't expect a parameter?
> 
> You're free to expect the parameter or not, where's  the issue?
> We allow implementations to accept more optional parameters than the
> interface specifies, but not less.

Yes, precisely. If something is using an Interface it should *not* add
unspecified parameters to the method calls, as the implementation might
have added some of their own with a different meaning.

> So, it seems optimal to me, to make the interface specify no parameters,
> then the class implementing this interface is free to accept either no
> parameter (= don't care about recursive) or one optional one.

So, PHP specifies a Countable interface, and its count() method has no
parameters. However, if you check the documentation then you'll find out
that in fact it might be sent one. On some occasions.

> I'll though happily apply your patch now.

I wrote it, but to be honest now I think it's just hiding the problem
under the carpet.


Cheers
-- 
Matteo Beccati

Development & Consulting - http://www.beccati.com/

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to