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
 [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

Add a Patch

Pull Requests

Add a Pull Request

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 Apr 18 12:01:28 2024 UTC