From 77c92369679e2be10cc24d50fec1250584d4d2ca Mon Sep 17 00:00:00 2001 From: Gorbachev Egor <7gorbachevm@gmail.com> Date: Thu, 20 Apr 2023 12:22:14 +0300 Subject: [PATCH] Use dynamic instead of Object for mixed type --- src/Language/Dart/DartClassFactoryGenerator.php | 2 +- src/Language/Dart/DartGenerator.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Language/Dart/DartClassFactoryGenerator.php b/src/Language/Dart/DartClassFactoryGenerator.php index 0a6dc19..65ac946 100644 --- a/src/Language/Dart/DartClassFactoryGenerator.php +++ b/src/Language/Dart/DartClassFactoryGenerator.php @@ -82,7 +82,7 @@ private function resolveFactoryProperty( $collectionType->equalsTo(PhpBaseType::float()) => 'double', $collectionType->equalsTo(PhpBaseType::string()) => 'String', $collectionType->equalsTo(PhpBaseType::bool()) => 'bool', - $collectionType->equalsTo(PhpBaseType::mixed()), $collectionType->equalsTo(PhpBaseType::iterable()), $collectionType->equalsTo(PhpBaseType::array()) => 'Object', + $collectionType->equalsTo(PhpBaseType::mixed()), $collectionType->equalsTo(PhpBaseType::iterable()), $collectionType->equalsTo(PhpBaseType::array()) => 'dynamic', $collectionType->equalsTo(PhpBaseType::null()) => 'null', $collectionType->equalsTo(PhpBaseType::self()) => $dto->getName(), default => throw new \Exception(sprintf("Unknown base PHP type: %s", $type->jsonSerialize())) diff --git a/src/Language/Dart/DartGenerator.php b/src/Language/Dart/DartGenerator.php index 276c8b3..0b4723b 100644 --- a/src/Language/Dart/DartGenerator.php +++ b/src/Language/Dart/DartGenerator.php @@ -117,7 +117,7 @@ private function getDartTypeFromPhp(PhpTypeInterface $type, DtoType $dto, DtoLis $type->equalsTo(PhpBaseType::float()) => 'double', $type->equalsTo(PhpBaseType::string()) => 'String', $type->equalsTo(PhpBaseType::bool()) => 'bool', - $type->equalsTo(PhpBaseType::mixed()), $type->equalsTo(PhpBaseType::iterable()), $type->equalsTo(PhpBaseType::array()) => 'Object', + $type->equalsTo(PhpBaseType::mixed()), $type->equalsTo(PhpBaseType::iterable()), $type->equalsTo(PhpBaseType::array()) => 'dynamic', $type->equalsTo(PhpBaseType::null()) => 'null', $type->equalsTo(PhpBaseType::self()) => $dto->getName(), default => throw new \Exception(sprintf("Unknown base PHP type: %s", $type->jsonSerialize()))