SignalHandlerInterface
Defines the contract for manager-owned signal handlers.
Description
Implementations MUST define which signals they subscribe to and MUST provide a callable handler capable of reacting to those signals within the context of a fork manager.
Signal handlers SHOULD be idempotent and MUST be safe to execute multiple times, as signal delivery MAY occur repeatedly or concurrently depending on the runtime environment.
Implementations MAY normalize or reinterpret signals before acting upon them, provided that the resulting behavior remains predictable for consumers.
The key words "MUST", "MUST NOT", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" are to be interpreted as described in RFC 2119.
Methods
Handles a signal for the provided manager.
Handles a signal for the provided manager.
public
__invoke(ForkManagerInterface
$manager, Signal
$signal) : void
Description
Implementations MUST execute the handling logic for the given signal in the context of the provided manager. The handler MAY trigger side effects such as propagating signals to workers, performing cleanup, or terminating the process.
Parameters
Description
manager that received the signal
Description
signal that was received or normalized by the manager
Returns the signals handled by this handler.
public
signals() : array<int, Signal>
Description
Implementations MUST return a non-empty list of signals that the manager will subscribe to on behalf of this handler.
Return values
Description
the list of handled signals