mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
Prevent first-class-callable handling with FunctionDynamicStorageProvider
This commit is contained in:
parent
de2257ecd3
commit
e5dae6a901
@ -61,6 +61,10 @@ final class FunctionDynamicStorageProvider
|
||||
Context $context,
|
||||
CodeLocation $code_location
|
||||
): ?FunctionStorage {
|
||||
if ($stmt->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$dynamic_storage_id = strtolower($statements_analyzer->getFilePath())
|
||||
. ':' . $stmt->getLine()
|
||||
. ':' . (int)$stmt->getAttribute('startFilePos')
|
||||
|
@ -68,9 +68,12 @@ final class FunctionDynamicStorageProviderEvent
|
||||
return $this->function_id;
|
||||
}
|
||||
|
||||
public function getExpr(): PhpParser\Node\Expr\FuncCall
|
||||
/**
|
||||
* @return list<PhpParser\Node\Arg>
|
||||
*/
|
||||
public function getArgs(): array
|
||||
{
|
||||
return $this->func_call;
|
||||
return $this->func_call->getArgs();
|
||||
}
|
||||
|
||||
public function getContext(): Context
|
||||
|
@ -26,15 +26,9 @@ class CustomArrayMapStorageProvider implements FunctionDynamicStorageProviderInt
|
||||
|
||||
public static function getFunctionStorage(FunctionDynamicStorageProviderEvent $event): ?DynamicFunctionStorage
|
||||
{
|
||||
$func_call = $event->getExpr();
|
||||
|
||||
if ($func_call->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$template_provider = $event->getTemplateProvider();
|
||||
$arg_type_inferer = $event->getArgTypeInferer();
|
||||
$call_args = $func_call->getArgs();
|
||||
$call_args = $event->getArgs();
|
||||
$args_count = count($call_args);
|
||||
$expected_callable_args_count = $args_count - 1;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user