Doc #80942 [Com]: Example for object implementing Iterator is incorrect / misleading

From: Date: Fri, 09 Apr 2021 16:33:15 +0000
Subject: Doc #80942 [Com]: Example for object implementing Iterator is incorrect / misleading
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-18704@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80942&edit=1

 ID:                 80942
 Comment by:         php-bugs at allenjb dot me dot uk
 Reported by:        php-bugs at allenjb dot me dot uk
 Summary:            Example for object implementing Iterator is
                     incorrect / misleading
 Status:             Open
 Type:               Documentation Problem
 Package:            Documentation problem
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

I've submitted a PR: https://github.com/php/doc-en/pull/517


Previous Comments:
------------------------------------------------------------------------
[2021-04-08 17:04:50] php-bugs at allenjb dot me dot uk

Description:
------------
---
From manual page: https://php.net/language.oop5.iterations
---
The example for an object implementing Iterator on this page has every method, including next()
returning a value, but the return types on these methods don't allow this.

While this "works", it will cause static analysis to hilight these as errors.

Additionally, the example here feels duplicitous - would it not be better to simply link to https://www.php.net/manual/en/class.iterator.php
which already has a very similar (and more correctly implemented) example?



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=80942&edit=1


Thread (3 messages)

« previous php.doc.bugs (#18704) next »