1--TEST-- 2ReflectionObject::getConstructor() - basic function test 3--FILE-- 4<?php 5class NewCtor { 6 function __construct() {} 7} 8 9class ExtendsNewCtor extends NewCtor { 10} 11 12class X { 13 function Y() {} 14} 15 16class Y extends X { 17} 18 19class B { 20 function B() {} 21} 22 23class C extends B { 24 function C() {} 25} 26 27class D1 extends C { 28 function __construct() {} 29} 30 31class D2 extends C { 32} 33 34$classes = array('NewCtor', 'ExtendsNewCtor', 35 'B', 'C', 'D1', 'D2', 'X', 'Y'); 36 37foreach ($classes as $class) { 38 $rc = new ReflectionObject(new $class); 39 $rm = $rc->getConstructor(); 40 if ($rm != null) { 41 echo "Constructor of $class: " . $rm->getName() . "\n"; 42 } else { 43 echo "No constructor for $class\n"; 44 } 45 46} 47 48?> 49--EXPECT-- 50Constructor of NewCtor: __construct 51Constructor of ExtendsNewCtor: __construct 52No constructor for B 53No constructor for C 54Constructor of D1: __construct 55No constructor for D2 56No constructor for X 57No constructor for Y 58