InvalidArgumentException
Represents invalid argument failures raised by the fork library.
Description
This exception class centralizes all argument validation errors related to worker management and orchestration.
Implementations throwing this exception MUST ensure that the provided input violates the expected contract. Consumers of this exception SHOULD treat it as a programming error and MUST NOT rely on it for normal control flow.
Interfaces
Methods
Creates an exception for a worker that is not owned by the manager.
Creates an exception for a worker group that belongs to another manager.
Creates an exception for a non-positive worker count.
Creates an exception for a worker implementation unsupported by the manager.
Initializes the exception with a descriptive message.
Creates an exception for a worker that is not owned by the manager.
public
static
forForeignWorker(
int
$workerPid) : self
Description
A worker MUST belong to the manager instance that operates on it. If a foreign worker is detected, this exception SHALL be thrown.
Parameters
$workerPid
:
int
Description
the process identifier of the foreign worker
Return values
Description
a new instance describing the ownership violation
Creates an exception for a worker group that belongs to another manager.
public
static
forForeignWorkerGroup() : self
Description
Worker groups MUST be associated with the same manager instance. Passing a group from a different manager SHALL result in this exception.
Return values
Description
a new instance describing the invalid worker group ownership
Creates an exception for a non-positive worker count.
public
static
forNonPositiveWorkerCount(
int
$workerCount) : self
Description
The worker count MUST be greater than zero. Any value less than or equal to zero SHALL be considered invalid and MUST trigger this exception.
Parameters
$workerCount
:
int
Description
the invalid worker count provided by the caller
Return values
Description
a new instance describing the invalid worker count
Creates an exception for a worker implementation unsupported by the manager.
public
static
forUnsupportedWorkerImplementation(
string
$className) : self
Description
The manager MAY restrict supported worker implementations. If an unsupported implementation is provided, this exception MUST be thrown.
Parameters
$className
:
string
Description
the fully-qualified class name of the unsupported worker
Return values
Description
a new instance describing the unsupported implementation
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