mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
Downgrade UndefinedMethod to PossiblyUndefinedMethod issue when one type has __call defined
This commit is contained in:
parent
5f03d08cb2
commit
806b032b13
@ -267,6 +267,8 @@ class MethodCallChecker extends \Psalm\Checker\Statements\Expression\CallChecker
|
||||
$statements_checker->getSource()
|
||||
)
|
||||
) {
|
||||
$has_valid_method_call_type = true;
|
||||
$existent_method_ids[] = $method_id;
|
||||
$return_type = Type::getMixed();
|
||||
continue;
|
||||
}
|
||||
|
@ -91,6 +91,20 @@ class MethodCallTest extends TestCase
|
||||
$a = new A;
|
||||
$a->bar();',
|
||||
],
|
||||
'canBeCalledOnMagic' => [
|
||||
'<?php
|
||||
class A {
|
||||
public function __call(string $method) {}
|
||||
}
|
||||
|
||||
class B {}
|
||||
|
||||
$a = rand(0, 1) ? new A : new B;
|
||||
|
||||
$a->maybeUndefinedMethod();',
|
||||
'assertions' => [],
|
||||
'error_levels' => ['PossiblyUndefinedMethod'],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user