LogicException

Class
extends LogicException
Final: Yes

Represents logical contract violations detected during worker orchestration.

Description

This exception type is intended for scenarios in which the caller invokes the process management API in a way that is incompatible with the expected runtime lifecycle. Such failures indicate an invalid usage pattern rather than an invalid scalar argument value.

Callers MUST treat this exception as a signal of incorrect control flow or invalid process-context usage. Library code SHOULD throw this exception only when the operation is structurally invalid for the current execution state.

Table of Contents

Interfaces

ForkExceptionInterface

Represents the base contract for all exceptions thrown by the fork library.

Methods

forForkFromWorkerProcess()

Creates an exception for attempts to fork from within a worker process.

 : self
forWorkerWaitingOnItself()

Creates an exception for attempts by a worker to wait on itself.

 : self
__construct()

Initializes the exception with a descriptive message.

 : mixed
Methods

forForkFromWorkerProcess()

Public Static

Creates an exception for attempts to fork from within a worker process.

public static forForkFromWorkerProcess() : self

Description

A worker process MUST NOT reuse a manager instance that belongs to a parent process context for creating nested workers. If nested process management is required, the worker SHOULD instantiate a new manager within its own process.

Return values
self

Description

a new instance describing the invalid fork attempt

forWorkerWaitingOnItself()

Public Static

Creates an exception for attempts by a worker to wait on itself.

public static forWorkerWaitingOnItself( int  $workerPid) : self

Description

A worker MUST NOT attempt to block while waiting for its own termination, because such behavior would be logically invalid and would prevent correct lifecycle coordination.

Parameters
$workerPid : int

Description

the process identifier of the worker attempting to wait on itself

Return values
self

Description

a new instance describing the self-wait violation

__construct()

Private

Initializes the exception with a descriptive message.

private __construct( string  $message) : mixed

Description

This constructor is private to enforce the use of named constructors for specific logic violation scenarios, ensuring that each exception instance is created with a clear and relevant message.

Parameters
$message : string