Skip to documentation

ContainerException

Class
extends Exception
implements ContainerExceptionInterface
Final: Yes

Exception type for container-related errors while resolving services.

Description

This class MUST be used to signal problems occurring during service resolution from a container that complies with PSR-11.

Table of Contents

Interfaces

Methods

forCircularDependency()

Creates an exception describing the active dependency cycle.

 : self
forInvalidService()

Creates an exception for an invalid or unresolvable service identifier.

 : self
Methods

forCircularDependency()

Public Static

Creates an exception describing the active dependency cycle.

public static forCircularDependency( array<int, string>  $path) : self
Parameters
$path : array<int, string>

Description

the service identifiers, including the repeated entry

Return values
self

Description

an exception preserving the complete resolution path

forInvalidService()

Public Static

Creates an exception for an invalid or unresolvable service identifier.

public static forInvalidService( string  $id, Throwable  $previous) : self

Description

This factory method MUST be invoked when a service ID fails to resolve or the resolved service is invalid in the current context.

Parameters
$id : string

Description

the identifier of the service that caused the failure

$previous : Throwable

Description

the previous exception thrown during resolution

Return values
self

Description

an instance of ContainerException describing the issue

Search results