Closed
Description
Problem
Call to undefined method ReflectionUnionType::getName()
Cause
https://github.com/symfony/ux/blob/2.x/src/LiveComponent/src/Metadata/LiveComponentMetadataFactory.php#L77 assuming to work with a ReflectionNamedType
.
Reproduce
Create a LiveComponent with
#[LiveProp] public int|string $someProperty;
Use it somewhere
Expected behavior
Either:
- Support using UnionTypes for LiveProps
- Throw clear error that UnionTypes are not supported
I want to contribute, but am not sure if option 1 or 2 is desired. The current $metadatas
array is keyed by the property name and is flat, i.e. does not allow multiple types for one property (nor does the LivePropMetadata
object), so allowing union types (option 1) will require some changes.
Metadata
Metadata
Assignees
Labels
No labels