Skip to content

Commit 9afe1f0

Browse files
committed
Printer::printType() refactoring
1 parent 05cd5e2 commit 9afe1f0

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
@@ -401,13 +401,9 @@ protected function printType(?string $type, bool $nullable): string
401401
$type = $this->namespace->simplifyType($type);
402402
}
403403

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

413409

0 commit comments

Comments
 (0)