는이 코드가 있습니다ReflectionException을 캐치 할 수 없습니까?
namespace Some\Different\Name;
try {
$reflect = new ReflectionClass($class);
X: $instance = $reflect->newInstanceArgs($args);
} catch (ReflectionException $e) {
exit($e->getMessage());
}
을하고 나는 그것이 ReflectionException가 슬로우 만들려고 테스트하고있다. 그리고 나에게 준다 :
Fatal error: Uncaught exception 'ReflectionException' with message 'Class MyClass does not have a constructor, so you cannot pass any constructor arguments' in ... on line X.
내가 뭘 잘못하고 있니?
추신 : 나는 왜 예외가 던져 지는지, 나는 단지 그것이 잡히지 않은 이유를 알고 싶다!
정말 이상합니다. 일반'catch (Exception $ e)'가이를 잡을까요? –
해당 오류의 백 트레이스를 추가하십시오. – hakre
@MikePurcell, 그렇지 않습니다. – Shoe