From 97f409d27752fe6c630b63257a0c6b50e1ff3a01 Mon Sep 17 00:00:00 2001 From: Daniel Kurowski Date: Mon, 23 Jan 2023 10:48:50 +0100 Subject: [PATCH] fix BC for Food --- src/Event/Response/Diet.php | 2 +- src/Event/Response/Event.php | 7 +++++-- src/Event/Response/Food.php | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Event/Response/Diet.php b/src/Event/Response/Diet.php index fce10d2..0c1e35c 100644 --- a/src/Event/Response/Diet.php +++ b/src/Event/Response/Diet.php @@ -11,7 +11,7 @@ * @method static Diet VEGAN() * @method static Diet VEGETARIAN() */ -final class Diet extends Food +final class Diet extends Enum { use AutoInstances; diff --git a/src/Event/Response/Event.php b/src/Event/Response/Event.php index 157e17d..cd5ce9c 100644 --- a/src/Event/Response/Event.php +++ b/src/Event/Response/Event.php @@ -350,11 +350,14 @@ public function getAccommodation(): string /** * @deprecated use getPropagation()->getDiets() instead - * @return Diet[] + * @return Food[] */ public function getFood(): array { - return $this->getPropagation()->getDiets(); + return \array_map( + static fn(Diet $diet): Food => Food::fromScalar($diet->toScalar()), + $this->getPropagation()->getDiets(), + ); } /** @deprecated use getPropagation()->getInvitationTextWorkDescription() instead */ diff --git a/src/Event/Response/Food.php b/src/Event/Response/Food.php index 56d8ec1..162a9d3 100644 --- a/src/Event/Response/Food.php +++ b/src/Event/Response/Food.php @@ -12,7 +12,7 @@ * @method static Food MEAT() * @method static Food VEGAN() */ -abstract class Food extends Enum +final class Food extends Enum { use AutoInstances;