1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 04:45:20 +01:00

Merge pull request #9676 from Nicelocal/fix_callable_union_comparison

Fix comparison of unions of multiple callables
This commit is contained in:
orklah 2023-04-19 13:02:01 +02:00 committed by GitHub
commit 76ebf54262
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 3 deletions

View File

@ -175,7 +175,7 @@ class UnionTypeComparator
if ($container_required_param_count > $input_all_param_count
|| $container_all_param_count < $input_required_param_count
) {
return false;
continue;
}
}

View File

@ -805,7 +805,7 @@ class ArgTest extends TestCase
function foo($a) {}
caller("foo");',
'error_message' => 'InvalidScalarArgument',
'error_message' => 'PossiblyInvalidArgument',
],
'callableArgsCountMismatch' => [
'code' => '<?php
@ -823,7 +823,7 @@ class ArgTest extends TestCase
function foo($a, $b) {}
caller("foo");',
'error_message' => 'InvalidScalarArgument',
'error_message' => 'InvalidArgument',
],
];
}

View File

@ -159,6 +159,10 @@ class TypeComparatorTest extends TestCase
'lowercase-string',
'callable-string',
],
'callableUnionAcceptsCallableUnion' => [
'(callable(int,string[]): void)|(callable(int): void)',
'(callable(int): void)|(callable(int,string[]): void)',
],
];
}