InvalidArgumentException

Class
extends InvalidArgumentException
Final: Yes

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.

Table of Contents

Interfaces

ForkExceptionInterface

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

Methods

forForeignWorker()

Creates an exception for a worker that is not owned by the manager.

 : self
forForeignWorkerGroup()

Creates an exception for a worker group that belongs to another manager.

 : self
forNonPositiveWorkerCount()

Creates an exception for a non-positive worker count.

 : self
forUnsupportedWorkerImplementation()

Creates an exception for a worker implementation unsupported by the manager.

 : self
__construct()

Initializes the exception with a descriptive message.

 : mixed
Methods

forForeignWorker()

Public Static

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
self

Description

a new instance describing the ownership violation

forForeignWorkerGroup()

Public Static

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
self

Description

a new instance describing the invalid worker group ownership

forNonPositiveWorkerCount()

Public Static

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
self

Description

a new instance describing the invalid worker count

forUnsupportedWorkerImplementation()

Public Static

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
self

Description

a new instance describing the unsupported implementation

__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