From ea8ba3a80723cb61f5ff83b9e75451e22a28f530 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Mi=C5=A1o=20=C4=8Cerve=C5=88=C3=A1k?= Date: Sat, 2 Nov 2024 16:46:07 +0100 Subject: [PATCH] fix enums --- src/Model/Model.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Model/Model.php b/src/Model/Model.php index 6ddffa8..f0c4fdf 100644 --- a/src/Model/Model.php +++ b/src/Model/Model.php @@ -52,9 +52,9 @@ public function &__get(string $key): mixed //phpcs:ignore if ($returnType->isSubclassOf(self::class)) { $value = $returnType->newInstance($value->toArray(), $value->getTable()); } - }/* elseif ($returnType->isSubclassOf(\BackedEnum::class)) { + } elseif ($returnType->isSubclassOf(\BackedEnum::class)) { $value = $returnType->getMethod('tryFrom')->invoke($returnType, $value); - }*/ + } } } return $value; @@ -96,10 +96,7 @@ public function getReferencedModel(string $requestedModel): ?self throw new CannotAccessModelException($requestedModel, $this); } - /** - * @return static - */ - public static function createFromActiveRow(ActiveRow $row): self + public static function createFromActiveRow(ActiveRow $row): static { if ($row instanceof static) { return $row;