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