From 9083e0a7a33f7d724ee0724c6353382206d05b11 Mon Sep 17 00:00:00 2001 From: RobChett Date: Thu, 20 Apr 2023 07:32:03 +0100 Subject: [PATCH] Check for the existence of the 'mixed' key to detect untyped parameters --- src/Psalm/Type/UnionTrait.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Psalm/Type/UnionTrait.php b/src/Psalm/Type/UnionTrait.php index 00e254462..48ab68c26 100644 --- a/src/Psalm/Type/UnionTrait.php +++ b/src/Psalm/Type/UnionTrait.php @@ -52,6 +52,8 @@ use function reset; use function sort; use function strpos; +use const ARRAY_FILTER_USE_BOTH; + /** * @psalm-immutable * @psalm-import-type TProperties from Union @@ -800,11 +802,13 @@ trait UnionTrait return count( array_filter( $this->types, - static fn($type): bool => $type instanceof TMixed + static fn($type, $key): bool => $key === 'mixed' + || $type instanceof TMixed || ($check_templates && $type instanceof TTemplateParam && $type->as->isMixed() - ) + ), + ARRAY_FILTER_USE_BOTH, ), ) === count($this->types); }