register_shutdown_function
reactphp/event-loop
Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Register a function for execution on shutdown
register_shutdown_function
(callable
$callback
,
mixed
...
$args
): ?
bool
});
$stopped
=&
self
::
$stopped
;
register_shutdown_function
(function () use (
$loop
, &
$hasRun
, &
$stopped
) {
$error
=
error_get_last
();
if ((isset(
$error
[
'type'
]) ?
$error
[
'type'
] :
0
) & (
E_ERROR
|
E_CORE_ERROR
|
E_COMPILE_ERROR
|
E_USER_ERROR
|
E_RECOVERABLE_ERROR
)) {
return;
}
if (!
$hasRun
&& !
$stopped
) {
$loop
->
run
();
}
});
return
self
::
$instance
;
src/Loop.php