Skip to content

Commit

Permalink
Simplify assertion when mixed
Browse files Browse the repository at this point in the history
  • Loading branch information
muglug committed Jan 11, 2021
1 parent 53afd28 commit 5beb3ad
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Psalm/Type/Atomic/TArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ public function equals(Atomic $other_type): bool

public function getAssertionString(): string
{
if ($this->type_params[1]->isMixed()) {
return 'array';
}

return 'array<'
. $this->type_params[0]->getAssertionString() . ', ' . $this->type_params[1]->getAssertionString()
. '>' ;
Expand Down
4 changes: 4 additions & 0 deletions src/Psalm/Type/Atomic/TList.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@ public function equals(Atomic $other_type): bool

public function getAssertionString(): string
{
if ($this->type_param->isMixed()) {
return 'list';
}

return 'list<' . $this->type_param->getAssertionString() . '>';
}

Expand Down

0 comments on commit 5beb3ad

Please sign in to comment.