1--TEST--
2ReflectionClass::getConstructor()
3--FILE--
4<?php
5class NewCtor {
6	function __construct() {}
7}
8
9class ExtendsNewCtor extends NewCtor {
10}
11
12class OldCtor {
13	function OldCtor() {}
14}
15
16class ExtendsOldCtor extends OldCtor {
17}
18
19
20class X {
21	function Y() {}
22}
23
24class Y extends X {
25}
26
27class OldAndNewCtor {
28	function OldAndNewCtor() {}
29	function __construct() {}
30}
31
32class NewAndOldCtor {
33	function __construct() {}
34	function NewAndOldCtor() {}
35}
36class B {
37	function B() {}
38}
39
40class C extends B {
41	function C() {}
42}
43
44class D1 extends C {
45	function __construct() {}
46}
47
48class D2 extends C {
49}
50
51$classes = array('NewCtor', 'ExtendsNewCtor', 'OldCtor', 'ExtendsOldCtor',
52				 'OldAndNewCtor', 'NewAndOldCtor', 'B', 'C', 'D1', 'D2', 'X', 'Y');
53
54foreach ($classes as $class) {
55	$rc = new ReflectionClass($class);
56	$rm = $rc->getConstructor();
57	if ($rm != null) {
58		echo "Constructor of $class: " . $rm->getName() . "\n";
59	}  else {
60		echo "No constructor for $class\n";
61	}
62
63}
64
65?>
66--EXPECTF--
67Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; OldCtor has a deprecated constructor in %s on line %d
68
69Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; B has a deprecated constructor in %s on line %d
70
71Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; C has a deprecated constructor in %s on line %d
72Constructor of NewCtor: __construct
73Constructor of ExtendsNewCtor: __construct
74Constructor of OldCtor: OldCtor
75Constructor of ExtendsOldCtor: OldCtor
76Constructor of OldAndNewCtor: __construct
77Constructor of NewAndOldCtor: __construct
78Constructor of B: B
79Constructor of C: C
80Constructor of D1: __construct
81Constructor of D2: C
82No constructor for X
83No constructor for Y
84