Currently I’m doing it like this:
$classes = get_declared_classes();
$models = array();
foreach($classes as $class){
$class = new \ReflectionClass($class);
if($class->isSubclassOf('\\App\\Model'))
$models[] = $class;
}
But as you see I’m creating a reflection object for each class, in order to find out which one is a child of my “model” class.
Is there a faster way to search for my child classes?
Try
Pop last argument if you get notices/warnings. The 3rd one says 1st argument is a string and should not be directly rejected (function expects objects by default).
Works for me!