I try to cycle through all loaded classes, that extend a certain class.
But is_subclass_of is throwing an "Class not found" Error, if the reason is an extend class that wasnt autoloaded - and i cannot catch it.
$allClasses = 'vendor/composer/autoload_classmap.php';
$classes=[];
foreach ($allClasses as $name => $file){
try {
if (is_subclass_of($name,'mynamespace\\project\\src\\models\\BaseWintypeModel'))
{
$classes[] = $name;
}
}
catch(\Throwable $e)
{
echo "caught exception";
}
}
Error is e.g.
PHP Fatal Error – yii\base\ErrorException
Class 'Illuminate\Support\ServiceProvider' not found
1. in /www/fresh/vendor/nesbot/carbon/src/Carbon/Laravel/ServiceProvider.php
because
class ServiceProvider extends \Illuminate\Support\ServiceProvider