mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
Do not emit issue when callable is called
This commit is contained in:
parent
883ca6a5db
commit
30a39a0ee6
@ -122,7 +122,10 @@ class CallChecker
|
||||
$stmt->inferredType = $var_type_part->return_type;
|
||||
}
|
||||
}
|
||||
} elseif (!$var_type_part->isMixed() && $var_type_part->value !== 'Closure') {
|
||||
} elseif (!$var_type_part->isMixed() &&
|
||||
$var_type_part->value !== 'Closure' &&
|
||||
!$var_type_part->isCallable()
|
||||
) {
|
||||
$var_id = ExpressionChecker::getVarId(
|
||||
$stmt->name,
|
||||
$statements_checker->getFQCLN(),
|
||||
|
@ -139,6 +139,19 @@ class ClosureTest extends PHPUnit_Framework_TestCase
|
||||
$this->assertEquals('int', (string) $context->vars_in_scope['$a']);
|
||||
}
|
||||
|
||||
public function testCallable()
|
||||
{
|
||||
$stmts = self::$parser->parse('<?php
|
||||
function foo(Callable $c) : void {
|
||||
echo (string)$c();
|
||||
}
|
||||
');
|
||||
|
||||
$file_checker = new FileChecker('somefile.php', $stmts);
|
||||
$context = new Context('somefile.php');
|
||||
$file_checker->check(true, true, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psalm\Exception\CodeException
|
||||
* @expectedExceptionMessage InvalidFunctionCall
|
||||
|
Loading…
x
Reference in New Issue
Block a user