ScopedCallback
Make a callback run when a dummy object leaves the scope.
|
Make a callback run when a dummy object leaves the scope. More...
Public Member Functions | |
__construct ( $callback, array $params=[]) | |
__destruct () | |
Trigger the callback when it leaves scope. | |
__sleep () | |
Do not allow this class to be serialized. More... | |
__wakeup () | |
Protect the caller against arbitrary code execution. More... | |
Static Public Member Functions | |
static | consume (ScopedCallback &$sc=null) |
Trigger a scoped callback and destroy it. More... | |
static | cancel (ScopedCallback &$sc=null) |
Destroy a scoped callback without triggering it. More... | |
static | newScopedIgnoreUserAbort () |
Make PHP ignore user aborts/disconnects until the returned value leaves scope. More... | |
Protected Attributes | |
$callback | |
$params | |
Make a callback run when a dummy object leaves the scope.
Wikimedia\ScopedCallback::__construct | ( | $callback, | |
array | $params = [] |
||
) |
callable | null | $callback | |
array | $params | Callback arguments (since 1.0.0, MediaWiki 1.25) |
Wikimedia\ScopedCallback::__sleep | ( | ) |
Do not allow this class to be serialized.
Wikimedia\ScopedCallback::__wakeup | ( | ) |
Protect the caller against arbitrary code execution.
|
static |
Destroy a scoped callback without triggering it.
ScopedCallback | null | &$sc |
|
static |
Trigger a scoped callback and destroy it.
This is the same as just setting it to null.
ScopedCallback | null | &$sc |
|
static |
Make PHP ignore user aborts/disconnects until the returned value leaves scope.
This returns null and does nothing in CLI mode.
Also no benefit testing a function just returns null.