mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 04:45:20 +01:00
Merge pull request #8814 from weirdan/fix-8377
Fixes https://github.com/vimeo/psalm/issues/8377
This commit is contained in:
commit
35822f14d9
@ -685,18 +685,22 @@ class AtomicMethodCallAnalyzer extends CallAnalyzer
|
||||
}
|
||||
}
|
||||
|
||||
if (ArgumentsAnalyzer::analyze(
|
||||
$statements_analyzer,
|
||||
$stmt->getArgs(),
|
||||
null,
|
||||
null,
|
||||
true,
|
||||
$context
|
||||
) === false) {
|
||||
return;
|
||||
}
|
||||
if ($stmt->isFirstClassCallable()) {
|
||||
$result->return_type = Type::getClosure();
|
||||
} else {
|
||||
if (ArgumentsAnalyzer::analyze(
|
||||
$statements_analyzer,
|
||||
$stmt->getArgs(),
|
||||
null,
|
||||
null,
|
||||
true,
|
||||
$context
|
||||
) === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
$result->return_type = Type::getMixed();
|
||||
$result->return_type = Type::getMixed();
|
||||
}
|
||||
return;
|
||||
|
||||
default:
|
||||
|
@ -872,6 +872,21 @@ class ClosureTest extends TestCase
|
||||
'ignored_issues' => [],
|
||||
'php_version' => '8.1',
|
||||
],
|
||||
'FirstClassCallable:Method:Asserted' => [
|
||||
'code' => '<?php
|
||||
$r = false;
|
||||
/** @var object $o */;
|
||||
/** @var string $m */;
|
||||
if (method_exists($o, $m)) {
|
||||
$r = $o->$m(...);
|
||||
}
|
||||
',
|
||||
'assertions' => [
|
||||
'$r===' => 'Closure|false',
|
||||
],
|
||||
'ignored_issues' => [],
|
||||
'php_version' => '8.1',
|
||||
],
|
||||
'arrowFunctionReturnsNeverImplictly' => [
|
||||
'code' => '<?php
|
||||
$bar = ["foo", "bar"];
|
||||
|
Loading…
Reference in New Issue
Block a user