Re: Re: com php-src: Fix bug #67064 => Countable interface inconsistency

From: Date: Wed, 30 Jul 2014 13:54:26 +0000
Subject: Re: Re: com php-src: Fix bug #67064 => Countable interface inconsistency
References: 1 2 3 4 5 6 7 8 9  Groups: php.internals 
Request: Send a blank email to internals+get-76273@lists.php.net to get a copy of this message
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/

« previous php.internals (#76273) next »