[DOC-CVS] [doc-en] master: isiterable.xml Make the example executable (#4904)

[email protected] (Mikhail Alferov via GitHub)
Newsgroups php.doc.cvs
Message-ID <[email protected]>
Author: Mikhail Alferov (mmalferov)
Committer: GitHub (web-flow)
Pusher: kamil-tekiela
Date: 2025-10-13T12:37:29+01:00

Commit: https://github.com/php/doc-en/commit/2466135731709dbe9dc3cfae6544541d966c17a9
Raw diff: https://github.com/php/doc-en/commit/2466135731709dbe9dc3cfae6544541d966c17a9.diff

isiterable.xml Make the example executable (#4904)

Changed paths:
  M  reference/reflection/reflectionclass/isiterable.xml


Diff:

diff --git a/reference/reflection/reflectionclass/isiterable.xml b/reference/reflection/reflectionclass/isiterable.xml
index df4413424a5e..c6d17a35f3a2 100644
--- a/reference/reflection/reflectionclass/isiterable.xml
+++ b/reference/reflection/reflectionclass/isiterable.xml
@@ -38,23 +38,32 @@
 <![CDATA[
 <?php
 
-class IteratorClass implements Iterator {
-    public function __construct() { }
-    public function key() { }
-    public function current() { }
-    function next() { }
-    function valid() { }
-    function rewind() { }
+class IteratorClass implements Iterator
+{
+    public function __construct() {}
+
+    public function key(): mixed {}
+
+    public function current(): mixed {}
+
+    public function next(): void {}
+
+    public function valid(): bool {}
+
+    public function rewind(): void {}
 }
-class DerivedClass extends IteratorClass { }
-class NonIterator { }
 
-function dump_iterable($class) {
+class DerivedClass extends IteratorClass {}
+
+class NonIterator {}
+
+function dump_iterable($class)
+{
     $reflection = new ReflectionClass($class);
     var_dump($reflection->isIterable());
 }
 
-$classes = array("ArrayObject", "IteratorClass", "DerivedClass", "NonIterator");
+$classes = ["ArrayObject", "IteratorClass", "DerivedClass", "NonIterator",];
 
 foreach ($classes as $class) {
     echo "Is $class iterable? ";
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.