Skip to content

Commit

Permalink
Check for the existance of the 'mixed' key to detect untyped parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
robchett committed Apr 20, 2023
1 parent 0a40286 commit 1bbe8c6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Psalm/Type/UnionTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
use function sort;
use function strpos;

use const ARRAY_FILTER_USE_BOTH;

/**
* @psalm-immutable
* @psalm-import-type TProperties from Union
Expand Down Expand Up @@ -800,11 +802,13 @@ public function isMixed(bool $check_templates = false): bool
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);
}
Expand Down

0 comments on commit 1bbe8c6

Please sign in to comment.