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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 31 23:01:28 2024 UTC