1--TEST-- 2ReflectionClass::isIterateable() basic 3--CREDITS-- 4Felix De Vliegher <felix.devliegher@gmail.com>, Marc Veldman <marc@ibuildings.nl> 5--FILE-- 6<?php 7 8class IteratorClass implements Iterator { 9 public function __construct() { } 10 public function key(): mixed {} 11 public function current(): mixed {} 12 function next(): void {} 13 function valid(): bool {} 14 function rewind(): void {} 15} 16class DerivedClass extends IteratorClass {} 17class NonIterator {} 18 19function dump_iterateable($class) { 20 $reflection = new ReflectionClass($class); 21 var_dump($reflection->isIterateable()); 22} 23 24$classes = array("ArrayObject", "IteratorClass", "DerivedClass", "NonIterator"); 25foreach ($classes as $class) { 26 echo "Is $class iterateable? "; 27 dump_iterateable($class); 28} 29?> 30--EXPECT-- 31Is ArrayObject iterateable? bool(true) 32Is IteratorClass iterateable? bool(true) 33Is DerivedClass iterateable? bool(true) 34Is NonIterator iterateable? bool(false) 35