class BuilderMacroResolver

Resolve the builder macros that model traits add through their global scopes.

Packages map each trait to an interface declaring its macros through the eloquentBuilderMacros parameter. A generic interface receives the model type.

Methods

__construct(ReflectionProvider $reflectionProvider, array $macros)

Create a builder macro resolver.

bool
hasMacro(ClassReflection $modelClass, string $methodName)

Determine whether the model's traits add the named builder macro.

MethodReflection|null
resolve(ClassReflection $builderClass, Type $modelType, Type $signatureModelType, string $methodName)

Resolve a trait macro called on a builder for the given model type.

Details

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

Create a builder macro resolver.

Parameters

ReflectionProvider $reflectionProvider
array $macros

at line 47
bool hasMacro(ClassReflection $modelClass, string $methodName)

Determine whether the model's traits add the named builder macro.

Parameters

ClassReflection $modelClass
string $methodName

Return Value

bool

at line 58
MethodReflection|null resolve(ClassReflection $builderClass, Type $modelType, Type $signatureModelType, string $methodName)

Resolve a trait macro called on a builder for the given model type.

The signature names the model by the signature model type, the receiver's own template type for it, so PHPStan binds the model only after replacing the receiver's static types.

Parameters

ClassReflection $builderClass
Type $modelType
Type $signatureModelType
string $methodName

Return Value

MethodReflection|null