Skip to content

Commit 0ce9fa0

Browse files
committed
handle nullables
Signed-off-by: Robert Landers <landers.robert@gmail.com>
1 parent e0f5151 commit 0ce9fa0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Proxy/Generator.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,11 @@ abstract protected function impureCall(ReflectionMethod $method, bool $isHook =
135135
protected function getTypes(ReflectionNamedType|ReflectionUnionType|ReflectionIntersectionType|null $type): string
136136
{
137137
if ($type instanceof ReflectionNamedType) {
138+
$nullable = $type->allowsNull() ? '?' : '';
138139
if ($type->isBuiltin()) {
139-
return $type->getName();
140+
return $nullable . $type->getName();
140141
}
141-
return '\\' . $type->getName();
142+
return '\\' . $nullable . $type->getName();
142143
}
143144

144145
if ($type instanceof ReflectionUnionType) {

0 commit comments

Comments
 (0)