You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -266,50 +271,71 @@ public function hydrateValue(mixed $value, LivePropMetadata $propMetadata, objec
266
271
thrownew \LogicException(\sprintf('The LiveProp "%s" on component "%s" has "useSerializerForHydration: true", but the given serializer does not implement DenormalizerInterface.', $propMetadata->getName(), $parentObject::class));
thrownew \LogicException(\sprintf('The "%s::%s" object should be hydrated with the Serializer, but no type could be guessed.', $parentObject::class, $propMetadata->getName()));
default => thrownew \LogicException(\sprintf('Cannot coerce value "%s" to type "%s"', $value, $type)),
335
361
};
336
362
}
@@ -462,15 +488,35 @@ private function dehydrateValue(mixed $value, LivePropMetadata $propMetadata, ob
462
488
return$value;
463
489
}
464
490
491
+
if (!$type = $propMetadata->getType()) {
492
+
thrownew \LogicException(\sprintf('The "%s" property on component "%s" is missing its property-type. Add the "%s" type so the object can be hydrated later.', $propMetadata->getName(), $parentObject::class, $value::class));
493
+
}
494
+
465
495
if (\is_array($value)) {
466
-
if ($propMetadata->collectionValueType() && Type::BUILTIN_TYPE_OBJECT === $propMetadata->collectionValueType()->getBuiltinType()) {
thrownew \LogicException(\sprintf('The LiveProp "%s" on component "%s" is an array. We determined the array is full of %s objects, but at least one key had a different value of %s', $propMetadata->getName(), $parentObject::class, $collectionClass, get_debug_type($objectItem)));
thrownew \LogicException(\sprintf('The LiveProp "%s" on component "%s" is an array. We determined the array is full of %s objects, but at least one key had a different value of %s', $propMetadata->getName(), $parentObject::class, $collectionClass, get_debug_type($objectItem)));
@@ -485,14 +531,15 @@ private function dehydrateValue(mixed $value, LivePropMetadata $propMetadata, ob
485
531
thrownew \LogicException(\sprintf('Unable to dehydrate value of type "%s" for property "%s" on component "%s". Change this to a simpler type of an object that can be dehydrated. Or set the hydrateWith/dehydrateWith options in LiveProp or set "useSerializerForHydration: true" on the LiveProp to use the serializer.', get_debug_type($value), $propMetadata->getName(), $parentObject::class));
486
532
}
487
533
488
-
if (!$propMetadata->getType() || $propMetadata->isBuiltIn()) {
489
-
thrownew \LogicException(\sprintf('The "%s" property on component "%s" is missing its property-type. Add the "%s" type so the object can be hydrated later.', $propMetadata->getName(), $parentObject::class, $value::class));
534
+
while ($typeinstanceof WrappingTypeInterface) {
535
+
$type = $type->getWrappedType();
490
536
}
491
537
492
-
// at this point, we have an object and can assume $propMetadata->getType()
if ($typeinstanceof \ReflectionUnionType || $typeinstanceof \ReflectionIntersectionType) {
79
-
thrownew \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()));
if ($typeinstanceof UnionType && !$typeinstanceof NullableType || $typeinstanceof IntersectionType) {
87
+
thrownew \LogicException(\sprintf('Union or intersection types are not supported for LiveProps. You may want to change the type of property "%s" in "%s".', $propertyName, $className));
0 commit comments