RuntimeException

Class
extends RuntimeException
Final: Yes

Exception type used to represent runtime errors specific to the container context.

Description

This class MUST be thrown when an error occurs due to invalid runtime behavior such as misconfigured extensions or illegal method accessibility.

Table of Contents

Methods

forInvalidParameterType()

Creates an exception for an invalid parameter type.

 : self
forNonCallableExtension()

Creates an exception for a non-callable service extension.

 : self
forNonPublicMethod()

Creates an exception for attempting to use a non-public method.

 : self
Methods

forInvalidParameterType()

Public Static

Creates an exception for an invalid parameter type.

public static forInvalidParameterType( string  $parameter) : self

Description

This method MUST be used when a parameter expected to represent a class name or interface name does not satisfy this constraint.

Parameters
$parameter : string

Description

the name of the parameter with the invalid type

Return values
self

Description

a RuntimeException instance with a descriptive message

forNonCallableExtension()

Public Static

Creates an exception for a non-callable service extension.

public static forNonCallableExtension( string  $service, string  $given) : self

Description

This method MUST be used when a value intended to act as a service extension is not callable, violating the expected contract of container extensions.

Parameters
$service : string

Description

the identifier of the service with the invalid extension

$given : string

Description

the type or class name of the invalid value

Return values
self

Description

a RuntimeException instance with a descriptive message

forNonPublicMethod()

Public Static

Creates an exception for attempting to use a non-public method.

public static forNonPublicMethod( string  $class, string  $method) : self

Description

This method SHOULD be used when trying to invoke a method that is not declared public, thereby violating service visibility requirements.

Parameters
$class : string

Description

the fully qualified class name

$method : string

Description

the name of the method that is not publicly accessible

Return values
self

Description

a RuntimeException indicating the method MUST be public