php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #80942 Example for object implementing Iterator is incorrect / misleading
Submitted: 2021-04-08 17:04 UTC Modified: 2021-04-20 10:02 UTC
From: php-bugs at allenjb dot me dot uk Assigned: cmb (profile)
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: php-bugs at allenjb dot me dot uk
New email:
PHP Version: OS:

 

 [2021-04-08 17:04 UTC] 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?


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-04-09 16:33 UTC] php-bugs at allenjb dot me dot uk
I've submitted a PR: https://github.com/php/doc-en/pull/517
 [2021-04-20 10:02 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 02 14:01:36 2025 UTC