From 7665778b567a36992dc8c041125b28fc69bf7900 Mon Sep 17 00:00:00 2001 From: Matt Brown Date: Mon, 11 Jan 2021 17:44:57 -0500 Subject: [PATCH] Simplify assertion when mixed --- src/Psalm/Type/Atomic/TArray.php | 4 ++++ src/Psalm/Type/Atomic/TList.php | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/Psalm/Type/Atomic/TArray.php b/src/Psalm/Type/Atomic/TArray.php index f97e1471d..e363ab1ae 100644 --- a/src/Psalm/Type/Atomic/TArray.php +++ b/src/Psalm/Type/Atomic/TArray.php @@ -83,6 +83,10 @@ class TArray extends \Psalm\Type\Atomic public function getAssertionString(): string { + if ($this->type_params[1]->isMixed()) { + return 'array'; + } + return 'array<' . $this->type_params[0]->getAssertionString() . ', ' . $this->type_params[1]->getAssertionString() . '>' ; diff --git a/src/Psalm/Type/Atomic/TList.php b/src/Psalm/Type/Atomic/TList.php index a6480d30c..b4e610ae5 100644 --- a/src/Psalm/Type/Atomic/TList.php +++ b/src/Psalm/Type/Atomic/TList.php @@ -192,6 +192,10 @@ class TList extends \Psalm\Type\Atomic public function getAssertionString(): string { + if ($this->type_param->isMixed()) { + return 'list'; + } + return 'list<' . $this->type_param->getAssertionString() . '>'; }