RuntimeException
extends RuntimeException
in package
Exception type used to represent runtime errors specific to the container context.
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() : self
- Creates an exception for an invalid parameter type.
- forNonCallableExtension() : self
- Creates an exception for a non-callable service extension.
- forNonPublicMethod() : self
- Creates an exception for attempting to use a non-public method.
Methods
forInvalidParameterType()
Creates an exception for an invalid parameter type.
public
static forInvalidParameterType(string $parameter) : self
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
-
the name of the parameter with the invalid type
Return values
self —a RuntimeException instance with a descriptive message
forNonCallableExtension()
Creates an exception for a non-callable service extension.
public
static forNonCallableExtension(string $service, string $given) : self
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
-
the identifier of the service with the invalid extension
- $given : string
-
the type or class name of the invalid value
Return values
self —a RuntimeException instance with a descriptive message
forNonPublicMethod()
Creates an exception for attempting to use a non-public method.
public
static forNonPublicMethod(string $class, string $method) : self
This method SHOULD be used when trying to invoke a method that is not declared public, thereby violating service visibility requirements.
Parameters
- $class : string
-
the fully qualified class name
- $method : string
-
the name of the method that is not publicly accessible
Return values
self —a RuntimeException indicating the method MUST be public