1--TEST-- 2ReflectionObject::IsInstantiable() - variation - constructors 3--FILE-- 4<?php 5 6class noCtor { 7 public static function reflectionObjectFactory() { 8 return new ReflectionObject(new self); 9 } 10} 11 12class publicCtorNew { 13 public function __construct() {} 14 public static function reflectionObjectFactory() { 15 return new ReflectionObject(new self); 16 } 17} 18 19class protectedCtorNew { 20 protected function __construct() {} 21 public static function reflectionObjectFactory() { 22 return new ReflectionObject(new self); 23 } 24} 25 26class privateCtorNew { 27 private function __construct() {} 28 public static function reflectionObjectFactory() { 29 return new ReflectionObject(new self); 30 } 31} 32 33$reflectionObjects = array( 34 noCtor::reflectionObjectFactory(), 35 publicCtorNew::reflectionObjectFactory(), 36 protectedCtorNew::reflectionObjectFactory(), 37 privateCtorNew::reflectionObjectFactory(), 38 ); 39 40foreach ($reflectionObjects as $reflectionObject) { 41 $name = $reflectionObject->getName(); 42 echo "Is $name instantiable? "; 43 var_dump($reflectionObject->IsInstantiable()); 44} 45?> 46--EXPECT-- 47Is noCtor instantiable? bool(true) 48Is publicCtorNew instantiable? bool(true) 49Is protectedCtorNew instantiable? bool(false) 50Is privateCtorNew instantiable? bool(false) 51