Skip to content

Commit 53117fa

Browse files
committed
patch path evaluation
1 parent c0a1f54 commit 53117fa

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/SchemaProcessor/PostProcessor/BuilderClassPostProcessor.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use PHPModelGenerator\PropertyProcessor\Decorator\TypeHint\TypeHintDecorator;
1818
use PHPModelGenerator\PropertyProcessor\Decorator\TypeHint\TypeHintTransferDecorator;
1919
use PHPModelGenerator\Utils\RenderHelper;
20+
use ReflectionClass;
2021
use UnitEnum;
2122

2223
class BuilderClassPostProcessor extends PostProcessor
@@ -128,8 +129,9 @@ private function getBuilderClassImports(array $properties, array $originalClassI
128129
// for nested objects, allow additionally to pass an instance of the nested model also just plain
129130
// arrays which will result in an object instantiation and validation during the build process
130131
if (in_array(JSONModelInterface::class, class_implements($type))) {
132+
$builderClassName = (new ReflectionClass($type))->getShortName() . 'Builder';
131133
$property->addTypeHintDecorator(new TypeHintDecorator(
132-
[basename($type) . 'Builder' . (str_contains($typeAnnotation, '[]') ? '[]' : ''), 'array'],
134+
[$builderClassName . (str_contains($typeAnnotation, '[]') ? '[]' : ''), 'array'],
133135
));
134136

135137
$property->setType();

0 commit comments

Comments
 (0)