Skip to content

Commit

Permalink
Improve Types::asNonLiteralType for TKeyedArray
Browse files Browse the repository at this point in the history
  • Loading branch information
klimick committed Jul 10, 2022
1 parent 2b9aa88 commit dab985a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Toolkit/Types.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,12 @@ public function asNonLiteralType(Union $type): Union
: new TNonEmptyString(),
$a instanceof TLiteralInt => new TInt(),
$a instanceof TLiteralFloat => new TFloat(),
$a instanceof TKeyedArray => new TNonEmptyArray([
self::asNonLiteralType($a->getGenericKeyType()),
self::asNonLiteralType($a->getGenericValueType()),
]),
$a instanceof TKeyedArray => $a->is_list
? new TNonEmptyList($a->getGenericValueType())
: new TNonEmptyArray([
self::asNonLiteralType($a->getGenericKeyType()),
self::asNonLiteralType($a->getGenericValueType()),
]),
$a instanceof TNonEmptyList => new TNonEmptyList(
self::asNonLiteralType($a->type_param),
),
Expand Down

0 comments on commit dab985a

Please sign in to comment.