mirror of
https://github.com/danog/psalm.git
synced 2025-01-21 21:31:13 +01:00
Allow arrays to be called (ugh)
This commit is contained in:
parent
54cbee1265
commit
ee6a9b98fb
@ -165,7 +165,11 @@ class FunctionCallChecker extends \Psalm\Checker\Statements\Expression\CallCheck
|
||||
) {
|
||||
// this is fine
|
||||
$has_valid_function_call_type = true;
|
||||
} elseif ($var_type_part instanceof TString) {
|
||||
} elseif ($var_type_part instanceof TString
|
||||
|| $var_type_part instanceof TArray
|
||||
|| ($var_type_part instanceof Type\Atomic\ObjectLike
|
||||
&& count($var_type_part->properties) === 2)
|
||||
) {
|
||||
// this is also kind of fine
|
||||
$has_valid_function_call_type = true;
|
||||
} elseif ($var_type_part instanceof TNull) {
|
||||
|
@ -538,6 +538,18 @@ class FunctionCallTest extends TestCase
|
||||
'assertions' => [],
|
||||
'error_levels' => ['UndefinedMethod'],
|
||||
],
|
||||
'validCallables' => [
|
||||
'<?php
|
||||
class A {
|
||||
public static function b() : void {}
|
||||
}
|
||||
|
||||
function c() : void {}
|
||||
|
||||
["a", "b"]();
|
||||
"A::b"();
|
||||
"c"();'
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user