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,72 @@ 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
362
};
336
363
}
@@ -462,15 +489,35 @@ private function dehydrateValue(mixed $value, LivePropMetadata $propMetadata, ob
462
489
return$value;
463
490
}
464
491
492
+
if (!$type = $propMetadata->getType()) {
493
+
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));
494
+
}
495
+
465
496
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 +532,15 @@ private function dehydrateValue(mixed $value, LivePropMetadata $propMetadata, ob
485
532
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
533
}
487
534
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));
535
+
while ($typeinstanceof WrappingTypeInterface) {
536
+
$type = $type->getWrappedType();
490
537
}
491
538
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