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

From: Date: Thu, 08 Apr 2021 17:04:50 +0000
Subject: Doc #80942 [NEW]: Example for object implementing Iterator is incorrect / misleading
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-18701@lists.php.net to get a copy of this message
From:             php-bugs at allenjb dot me dot uk
Operating system: 
PHP version:      Irrelevant
Package:          Documentation problem
Bug Type:         Documentation Problem
Bug description:Example for object implementing Iterator is incorrect / misleading

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 bug report at https://bugs.php.net/bug.php?id=80942&edit=1
-- 
Fix committed:                    https://bugs.php.net/fix.php?id=80942&r=fixed
Fixed in release:                 https://bugs.php.net/fix.php?id=80942&r=alreadyfixed
Need backtrace:                   https://bugs.php.net/fix.php?id=80942&r=needtrace
Need Reproduce Script:            https://bugs.php.net/fix.php?id=80942&r=needscript
Try newer version:                https://bugs.php.net/fix.php?id=80942&r=oldversion
Not developer issue:              https://bugs.php.net/fix.php?id=80942&r=support
Expected behavior:                https://bugs.php.net/fix.php?id=80942&r=notwrong
Not enough info:                  https://bugs.php.net/fix.php?id=80942&r=notenoughinfo
Submitted twice:                  https://bugs.php.net/fix.php?id=80942&r=submittedtwice
register_globals:                 https://bugs.php.net/fix.php?id=80942&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80942&r=phptooold
Daylight Savings:                 https://bugs.php.net/fix.php?id=80942&r=dst
IIS Stability:                    https://bugs.php.net/fix.php?id=80942&r=isapi
Install GNU Sed:                  https://bugs.php.net/fix.php?id=80942&r=gnused
Floating point limitations:       https://bugs.php.net/fix.php?id=80942&r=float
No Zend Extensions:               https://bugs.php.net/fix.php?id=80942&r=nozend
MySQL Configuration Error:        https://bugs.php.net/fix.php?id=80942&r=mysqlcfg


Thread (3 messages)

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