note 127309 added to class.iterator
| From: | InvisibleSmiley at main dot php dot net | Date: | Wed, 20 Jul 2022 07:32:29 +0000 |
| Subject: | note 127309 added to class.iterator | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-219039@lists.php.net to get a copy of this message | ||
If you implemented Iterator methods next() and rewind() by calling array functions next() and
reset() and returning their results, be advised that this violates the tentative return types (void
in both cases) introduced with PHP 8.1.
You can add the #[\ReturnTypeWillChange] attribute to both method implementations but that will only
delay the issue until PHP 9.0 comes around.
Better adapt your implementations now (stop returning anything from these methods) and, if need be,
only add the return type declarations later.
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.135 (proxied: 213.155.83.52)
----
Manual Page -- https://php.net/manual/en/class.iterator.php
Edit -- https://main.php.net/note/edit/127309
Del: integrated -- https://main.php.net/note/delete/127309/integrated
Del: useless -- https://main.php.net/note/delete/127309/useless
Del: bad code -- https://main.php.net/note/delete/127309/bad+code
Del: spam -- https://main.php.net/note/delete/127309/spam
Del: non-english -- https://main.php.net/note/delete/127309/non-english
Del: in docs -- https://main.php.net/note/delete/127309/in+docs
Del: other reasons-- https://main.php.net/note/delete/127309
Reject -- https://main.php.net/note/reject/127309
Search -- https://main.php.net/manage/user-notes.php