Skip to content

Commit c7ff9d3

Browse files
committed
isiterable.xml Make the example executable
php/doc-en@2466135
1 parent 5ebff06 commit c7ff9d3

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

reference/reflection/reflectionclass/isiterable.xml

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: 84f25609071c1da9110a54776d0eda3d3709cacb Maintainer: mumumu Status: ready -->
3+
<!-- EN-Revision: 2466135731709dbe9dc3cfae6544541d966c17a9 Maintainer: mumumu Status: ready -->
44

55
<refentry xml:id="reflectionclass.isiterable" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
66
<refnamediv>
@@ -41,23 +41,32 @@
4141
<![CDATA[
4242
<?php
4343
44-
class IteratorClass implements Iterator {
45-
public function __construct() { }
46-
public function key() { }
47-
public function current() { }
48-
function next() { }
49-
function valid() { }
50-
function rewind() { }
44+
class IteratorClass implements Iterator
45+
{
46+
public function __construct() {}
47+
48+
public function key(): mixed {}
49+
50+
public function current(): mixed {}
51+
52+
public function next(): void {}
53+
54+
public function valid(): bool {}
55+
56+
public function rewind(): void {}
5157
}
52-
class DerivedClass extends IteratorClass { }
53-
class NonIterator { }
5458
55-
function dump_iterable($class) {
59+
class DerivedClass extends IteratorClass {}
60+
61+
class NonIterator {}
62+
63+
function dump_iterable($class)
64+
{
5665
$reflection = new ReflectionClass($class);
5766
var_dump($reflection->isIterable());
5867
}
5968
60-
$classes = array("ArrayObject", "IteratorClass", "DerivedClass", "NonIterator");
69+
$classes = ["ArrayObject", "IteratorClass", "DerivedClass", "NonIterator",];
6170
6271
foreach ($classes as $class) {
6372
echo "Is $class iterable? ";

0 commit comments

Comments
 (0)