class ModelAppendsRule implements Rule

This rule validates that the properties a model appends are computed properties, which serialization reads through a get accessor or a class cast.

Unlike upstream, the rule reads both $appends and #[Appends], and checks each concrete model with the appends it inherits. A database column can be appended when a get accessor or class cast computes it, while a set-only accessor does not make a property computed.

Constants

private SERIALIZATION_METHODS

The model methods that decide how serialization reads appended properties.

Methods

__construct(ModelHelper $modelHelper, ModelRuleHelper $modelRuleHelper, InitializerExprTypeResolver $initializerExprTypeResolver, ReflectionProvider $reflectionProvider)

Create a new model appends rule instance.

string
getNodeType()

Get the node type the rule checks.

array
processNode(Node $node, Scope $scope)

Report appended properties that serialization cannot compute.

Details

at line 64
__construct(ModelHelper $modelHelper, ModelRuleHelper $modelRuleHelper, InitializerExprTypeResolver $initializerExprTypeResolver, ReflectionProvider $reflectionProvider)

Create a new model appends rule instance.

Parameters

ModelHelper $modelHelper
ModelRuleHelper $modelRuleHelper
InitializerExprTypeResolver $initializerExprTypeResolver
ReflectionProvider $reflectionProvider

at line 75
string getNodeType()

Get the node type the rule checks.

Return Value

string

at line 86
array processNode(Node $node, Scope $scope)

Report appended properties that serialization cannot compute.

Parameters

Node $node
Scope $scope

Return Value

array