__callStatic() should have proper exception thrown if invalid method is used

This commit is contained in:
Sergey Tsalkov
2021-06-16 13:47:08 -07:00
parent 7c1f9bc226
commit 2ea4c4c539

View File

@@ -58,7 +58,12 @@ class DB {
} }
public static function __callStatic($name, $args) { public static function __callStatic($name, $args) {
return call_user_func_array(array(DB::getMDB(), $name), $args); $fn = array(DB::getMDB(), $name);
if (! is_callable($fn)) {
throw new MeekroDBException("MeekroDB does not have a method called $name");
}
return call_user_func_array($fn, $args);
} }
public static function debugMode($handler = true) { public static function debugMode($handler = true) {