RE: [DOC-CVS] svn: /phpdoc/en/trunk/reference/spl/emptyiterator/ current.xml key.xml valid.xml

From: Date: Sun, 10 Jan 2016 19:42:20 +0000
Subject: RE: [DOC-CVS] svn: /phpdoc/en/trunk/reference/spl/emptyiterator/ current.xml key.xml valid.xml
References: 1 2  Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-13969@lists.php.net to get a copy of this message
Hi Peter! > I don't think that this change is what we want. Fact is that current() and key() will > "return" void from EmptyIterator. It will never be anything else, and should IMO be > documented as such: in the method prototypes (as they were before this change), andin the return > value descriptions.  For both of the methods, the current return value description is "No > value is returned" so anything other than void in the prototype will only serve to confuse the > matter for the reader. I realise that all of EmptyIterator's methods (except for valid()) will throw exceptions, and so nothing will be returned from them. But I feel that it is more technically accurate for the EmptyIterator methods to be defined as having the same return types as per the implemented Iterator interface.. After all, if we were to define a Null object in userland in PHP 7.1, we wouldn't define the implemented methods as having void return values (in fact, we simply couldn't if the implemented interface specified other return types). So if anything, I'd say the current description of "No value is returned" should be the thing that is changed here, to mention instead that an exception will always be thrown (and so the return value cannot be used). I'm assuming that your lack of mentioning EmptyIterator::valid() is because you're ok with that change though? Whilst I feel that the documentation (after my edit) is the more correct version, I don't mind reverting it (particularly if you feel it'll confuse users). Thanks, Tom

« previous php.doc.cvs (#13969) next »