From 8bd85b56cf5bfbdc96d46f96124cea685a94b604 Mon Sep 17 00:00:00 2001 From: Vladimir Sadicov Date: Sat, 7 Dec 2024 11:52:22 +0100 Subject: [PATCH] fix possible mixed type issue un class source manipulator --- src/Util/ClassSourceManipulator.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Util/ClassSourceManipulator.php b/src/Util/ClassSourceManipulator.php index 25b57bdbb..a0335b9cc 100644 --- a/src/Util/ClassSourceManipulator.php +++ b/src/Util/ClassSourceManipulator.php @@ -143,7 +143,7 @@ public function addEntityField(ClassProperty $mapping): void } $propertyType = $typeHint; - if ($propertyType && !$defaultValue) { + if ($propertyType && !$defaultValue && $propertyType !== 'mixed') { // all property types $propertyType = '?'.$propertyType; } @@ -162,13 +162,13 @@ public function addEntityField(ClassProperty $mapping): void // getter methods always have nullable return values // because even though these are required in the db, they may not be set yet // unless there is a default value - null === $defaultValue, + null === $defaultValue && $propertyType !== 'mixed', $commentLines ); // don't generate setters for id fields if (!($mapping->id ?? false)) { - $this->addSetter($mapping->propertyName, $typeHint, $nullable); + $this->addSetter($mapping->propertyName, $typeHint, $nullable && $propertyType !== 'mixed'); } }