Skip to content

Commit 12806b2

Browse files
committed
Add PsalmApi::$types->asNonNullable
1 parent ab1e1d3 commit 12806b2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/Toolkit/Types.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,14 @@ public function asNullable(Union $union): Union
9797
return $cloned;
9898
}
9999

100+
public function asNonNullable(Union $union): Union
101+
{
102+
$cloned = clone $union;
103+
$cloned->removeType((new TNull())->getId());
104+
105+
return $cloned;
106+
}
107+
100108
/**
101109
* @template T of TTemplateParam|TIterable|TNamedObject|TObjectWithProperties
102110
* @param T $to

0 commit comments

Comments
 (0)