如果函数由于调用代码未正确调用而引发异常,如何使错误显示调用代码的文件和行号,而不是(或除了)引发异常的行?
IE:
class MyClass {
public function __call($MethodName, $Parameters)
{
if (!property_exists($this, $PropertyName))
throw new Exception('Error Getting Property: ' . $PropertyName . ' does not exist!');
// THIS line number appears in the exception, but
// is useless because it isn't the problem.
}
}
$MyClass = new MyClass();
// THIS line number should be in the exception,
// since its the line that's wrong.
$MyClass->GetSomethingThatDoesNotExist();