blob: 0401ed1e0cf1e27390e7fa2d8e3760fda42be8ba (
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
--TEST--
ReflectionObject::getConstructor() - basic function test
--FILE--
<?php
class NewCtor {
function __construct() {}
}
class ExtendsNewCtor extends NewCtor {
}
class X {
function Y() {}
}
class Y extends X {
}
class B {
function B() {}
}
class C extends B {
function C() {}
}
class D1 extends C {
function __construct() {}
}
class D2 extends C {
}
$classes = array('NewCtor', 'ExtendsNewCtor',
'B', 'C', 'D1', 'D2', 'X', 'Y');
foreach ($classes as $class) {
$rc = new ReflectionObject(new $class);
$rm = $rc->getConstructor();
if ($rm != null) {
echo "Constructor of $class: " . $rm->getName() . "\n";
} else {
echo "No constructor for $class\n";
}
}
?>
--EXPECT--
Constructor of NewCtor: __construct
Constructor of ExtendsNewCtor: __construct
No constructor for B
No constructor for C
Constructor of D1: __construct
No constructor for D2
No constructor for X
No constructor for Y
|