Skip to content

Commit af27571

Browse files
author
Bart Vanderstukken
committed
Throw error when using union types for LiveProps
1 parent 8119f8f commit af27571

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/LiveComponent/src/Metadata/LiveComponentMetadataFactory.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ public function createPropMetadatas(\ReflectionClass $class): array
7171
}
7272

7373
$type = $property->getType();
74+
if ($type instanceof \ReflectionUnionType || $type instanceof \ReflectionIntersectionType) {
75+
throw new \LogicException(sprintf('Union or intersection types are not supported for LiveProps. You may want to change the type of property %s in %s.', $property->getName(), $property->getDeclaringClass()->getName()));
76+
}
7477
$metadatas[$property->getName()] = new LivePropMetadata(
7578
$property->getName(),
7679
$attribute->newInstance(),

0 commit comments

Comments
 (0)