Is the @ suppression error in workerman source code simpler than the empty callback of set_error_handler ()?

searched the workerman source code and found that set_error_handler (); is used in many places to handle exception errors, but the callback is an empty function.

such as the following code:

set_error_handler(function(){});
fclose($this->_socket);
restore_error_handler();

does it feel more concise to directly use @ to suppress errors?

@fclose($this->_socket);
Jul.07,2021
Errors suppressed by

@ will still be caught by the function set by set_error_handler.
developers like to integrate workerman with other frameworks, and other frameworks usually use the set_error_handler function to catch errors.
causes errors in workerman to be suppressed by @ but still caught by other frameworks. In order to avoid causing trouble to developers, workerman uses set_error_handler to discard some predictable warning


clipboard.png

Menu