From 0aa7f41fde2c6f3b825b3cc41e6ad4c2b16587a3 Mon Sep 17 00:00:00 2001 From: Ondrej Mirtes Date: Thu, 12 Jan 2023 15:13:44 +0100 Subject: [PATCH] Enums do not allow dynamic properties --- src/Reflection/ClassReflection.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Reflection/ClassReflection.php b/src/Reflection/ClassReflection.php index 03010b362e..7cbf5fd051 100644 --- a/src/Reflection/ClassReflection.php +++ b/src/Reflection/ClassReflection.php @@ -346,6 +346,10 @@ private function collectTraits(ReflectionClass|ReflectionEnum $class): array public function allowsDynamicProperties(): bool { + if ($this->isEnum()) { + return false; + } + if (!$this->phpVersion->deprecatesDynamicProperties()) { return true; }