Skip to content

Commit c125c35

Browse files
committed
Printer::printType() refactoring
1 parent 7a71f2f commit c125c35

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/PhpGenerator/Printer.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -402,13 +402,9 @@ protected function printType(?string $type, bool $nullable): string
402402
$type = $this->namespace->simplifyType($type);
403403
}
404404

405-
if ($nullable && strcasecmp($type, 'mixed')) {
406-
$type = str_contains($type, '|')
407-
? $type . '|null'
408-
: '?' . $type;
409-
}
410-
411-
return $type;
405+
return $nullable
406+
? Type::nullable($type)
407+
: $type;
412408
}
413409

414410

0 commit comments

Comments
 (0)