class MacroThrowTypeExtension implements DynamicMethodThrowTypeExtension, DynamicStaticMethodThrowTypeExtension

Add a registered macro's exception to a method its @method tag types.

The tag owns the signature (see MacroMethodsClassReflectionExtension) but cannot declare exceptions, such as the ValidationException that Request::validate() throws. Only methods whose magic handler already declares an exception are claimed, because a supported extension replaces the method's exception, and returning none would drop it.

Methods

__construct(MacroMethodsClassReflectionExtension $macros, ReflectionProvider $reflectionProvider)

Create a macro throw type extension.

bool
isMethodSupported(MethodReflection $methodReflection)

Determine whether the method is a tag-typed macro with a known exception.

Type|null
getThrowTypeFromMethodCall(MethodReflection $methodReflection, MethodCall $methodCall, Scope $scope)

Get the exception of the macro registered on the call's receiver.

bool
isStaticMethodSupported(MethodReflection $methodReflection)

Determine whether the static method is a tag-typed macro with a known exception.

Type|null
getThrowTypeFromStaticMethodCall(MethodReflection $methodReflection, StaticCall $methodCall, Scope $scope)

Get the exception of the macro registered on the called class, or on a facade's root.

Details

at line 36
__construct(MacroMethodsClassReflectionExtension $macros, ReflectionProvider $reflectionProvider)

Create a macro throw type extension.

Parameters

MacroMethodsClassReflectionExtension $macros
ReflectionProvider $reflectionProvider

at line 45
bool isMethodSupported(MethodReflection $methodReflection)

Determine whether the method is a tag-typed macro with a known exception.

Parameters

MethodReflection $methodReflection

Return Value

bool

at line 53
Type|null getThrowTypeFromMethodCall(MethodReflection $methodReflection, MethodCall $methodCall, Scope $scope)

Get the exception of the macro registered on the call's receiver.

Parameters

MethodReflection $methodReflection
MethodCall $methodCall
Scope $scope

Return Value

Type|null

at line 64
bool isStaticMethodSupported(MethodReflection $methodReflection)

Determine whether the static method is a tag-typed macro with a known exception.

Parameters

MethodReflection $methodReflection

Return Value

bool

at line 72
Type|null getThrowTypeFromStaticMethodCall(MethodReflection $methodReflection, StaticCall $methodCall, Scope $scope)

Get the exception of the macro registered on the called class, or on a facade's root.

Parameters

MethodReflection $methodReflection
StaticCall $methodCall
Scope $scope

Return Value

Type|null