Skip to content

Commit

Permalink
Return Closure for object(Closure)
Browse files Browse the repository at this point in the history
  • Loading branch information
vudaltsov committed Feb 26, 2024
1 parent cf1b136 commit 1d12f5a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/types.php
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,10 @@ public static function nullable(Type $type): Type
*/
public static function object(string $class, Type ...$templateArguments): Type
{
if ($class === \Closure::class && $templateArguments === []) {
return self::closure;
}

return new NamedObjectType($class, array_values($templateArguments));
}

Expand Down

0 comments on commit 1d12f5a

Please sign in to comment.