The Patchwork Namespace
redefine(callable $subject, callable $content) : Handle
Makes all future calls to $subject go to $content instead, as if the former were redefined.
relay([array $arguments]) : mixed
To be called from inside a redefinition; this way, it invokes the original definition and passes on its return value. Arguments default to the ones originally received by the redefinition.
restore(Handle $returnValueOfRedefine) : void
Reverses the effects of redefine().
restoreAll() : void
Reverses the effects of all past calls to redefine(); in other words, makes all future calls behave in the usual manner.
getClass() : string
getCalledClass() : string
getFunction() : string
getMethod() : string
These are alternatives to magic constants and other kinds of self-reference that will not work as expected inside redefinitions.
always(mixed $value) : Closure
Returns a constant-valued callable for use as a redefinition.
hasMissed(callable $callable) : bool
Patchwork will be unable to redefine user-defined functions that are compiled earlier than itself. This checks for the aforementioned condition.
assertEventuallyDefined(Handle $returnValueOfRedefine) : void
Schedules a shutdown-time check to make sure the redefined function's original definition ever appeared.