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

From: Date: Mon, 13 Oct 2025 11:37:31 +0000
Subject: [doc-en] master: isiterable.xml Make the example executable (#4904)
Groups: php.doc.cvs 
Request: Send a blank email to [email protected] to get a copy of this message
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? ";


Thread (1 message)

  • Mikhail Alferov via GitHub
« previous php.doc.cvs (#22802) next »