假设我有几个这样的类:
class Child extends Parent {
public function foo() {
try {
ChildEngine::bar()
} catch (Exception\Custom $e) {
//exception handling
}
}
}
在其中一些类中,bar()
从不在其ChildEngine
中抛出上述异常,而某些bar()
可能会抛出异常。在实例化Child
时,我想看看Exception\Custom
是否在不调用Child
的情况下抛出foo()
。
PHP有这种功能吗?