Fixing a bug where non-existent classes would cause issues

This commit is contained in:
Ryan Weaver 2017-10-29 13:47:23 -04:00
parent e7b555e2c9
commit 4bb9d8207f

View File

@ -238,7 +238,18 @@ EOF
return false;
}
// see if the class exists (only need to trigger autoload once)
return class_exists($serviceId) || interface_exists($serviceId, false);
// if the id has a \, assume it is a class
if (false !== strpos($serviceId, '\\')) {
return true;
}
try {
$r = new \ReflectionClass($serviceId);
return true;
} catch (\ReflectionException $e) {
// the service id is not a valid class/interface
return false;
}
}
}