Typehinting merge #50

已合并
belliash 2019-04-17 11:27:52 +02:00 将 298 次代码提交从 typehinting合并至 master
共有 2 个文件被更改,包括 37 次插入0 次删除
仅显示提交 08307c5ad6 的更改 - 显示所有提交

33
tests/exception_handler.aer 普通文件
查看文件

@ -0,0 +1,33 @@
class ExceptionHandler {
public static void printException(Exception $e) {
print('Uncaught ' + get_class($e) + ', code: ' + $e->getCode() + "\nMessage: " + htmlentities($e->getMessage()) + "\n");
}
public static void handleException(Exception $e) {
self::printException($e);
}
}
class NewException extends Exception {
}
class Program {
void main() {
callback $handler = void(Exception $e) {
ExceptionHandler::handleException($e);
};
set_exception_handler($handler);
try {
throw new NewException("Catch me once", 1);
} catch(Exception $e) {
ExceptionHandler::handleException($e);
}
throw new Exception("Catch me twice", 2);
}
}

查看文件

@ -0,0 +1,4 @@
Uncaught NewException, code: 1
Message: Catch me once
Uncaught Exception, code: 2
Message: Catch me twice