Skip to content

Commit c042795

Browse files
committed
fix(attribute): mark ClassConstFetch as lazy to resolve enum attribute args
ClassConstFetch expressions (e.g. Status::Active) in attribute arguments were not marked as lazy values, so the PHPX bridge stored the backing string value instead of calling the factory that resolves the enum case. Add ClassConstFetch to requiresLazyValue() so the lazy marker is set and the factory function is invoked at runtime via typephp_attribute_set_lazy_value_argument().
1 parent 8ddd04e commit c042795

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

src/Transform/RuntimeAttributeFactoryLowering.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ private function requiresLazyValue(Expr $value): bool
131131
// though it is not represented by an Array_ AST node.
132132
|| $node instanceof Expr\Cast\Array_
133133
|| $node instanceof Expr\Cast\Object_
134+
|| $node instanceof Expr\ClassConstFetch
134135
|| (($node instanceof Expr\FuncCall || $node instanceof Expr\StaticCall)
135136
&& $node->isFirstClassCallable());
136137
}) !== null;

0 commit comments

Comments
 (0)