mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
Pass statement to MethodReturnTypeProviderEvent
This commit is contained in:
parent
d505a692e1
commit
49ed7b045f
@ -56,6 +56,7 @@ class MethodCallReturnTypeFetcher
|
||||
$stmt->args,
|
||||
$context,
|
||||
new CodeLocation($statements_analyzer->getSource(), $stmt->name),
|
||||
$stmt,
|
||||
$lhs_type_part instanceof TGenericObject ? $lhs_type_part->type_params : null
|
||||
);
|
||||
|
||||
@ -76,6 +77,7 @@ class MethodCallReturnTypeFetcher
|
||||
$stmt->args,
|
||||
$context,
|
||||
new CodeLocation($statements_analyzer->getSource(), $stmt->name),
|
||||
$stmt,
|
||||
$lhs_type_part instanceof TGenericObject ? $lhs_type_part->type_params : null,
|
||||
$fq_class_name,
|
||||
$method_name
|
||||
|
@ -41,7 +41,8 @@ class MissingMethodCallHandler
|
||||
$method_id->method_name,
|
||||
$stmt->args,
|
||||
$context,
|
||||
new CodeLocation($statements_analyzer->getSource(), $stmt->name)
|
||||
new CodeLocation($statements_analyzer->getSource(), $stmt->name),
|
||||
$stmt
|
||||
);
|
||||
|
||||
if ($return_type_candidate) {
|
||||
|
@ -473,6 +473,7 @@ class AtomicStaticCallAnalyzer
|
||||
$stmt->args,
|
||||
$context,
|
||||
new CodeLocation($statements_analyzer->getSource(), $stmt_name),
|
||||
$stmt,
|
||||
null,
|
||||
null,
|
||||
strtolower($stmt_name->name)
|
||||
|
@ -193,7 +193,8 @@ class ExistingAtomicStaticCallAnalyzer
|
||||
$stmt_name->name,
|
||||
$stmt->args,
|
||||
$context,
|
||||
new CodeLocation($statements_analyzer->getSource(), $stmt_name)
|
||||
new CodeLocation($statements_analyzer->getSource(), $stmt_name),
|
||||
$stmt
|
||||
);
|
||||
}
|
||||
|
||||
@ -214,6 +215,7 @@ class ExistingAtomicStaticCallAnalyzer
|
||||
$stmt->args,
|
||||
$context,
|
||||
new CodeLocation($statements_analyzer->getSource(), $stmt_name),
|
||||
$stmt,
|
||||
null,
|
||||
$fq_class_name,
|
||||
$stmt_name->name
|
||||
|
@ -108,7 +108,7 @@ class MethodReturnTypeProvider
|
||||
/**
|
||||
* @param list<PhpParser\Node\Arg> $call_args
|
||||
* @param ?array<Type\Union> $template_type_parameters
|
||||
*
|
||||
* @param PhpParser\Node\Expr\MethodCall|PhpParser\Node\Expr\StaticCall $stmt
|
||||
*/
|
||||
public function getReturnType(
|
||||
StatementsSource $statements_source,
|
||||
@ -117,6 +117,7 @@ class MethodReturnTypeProvider
|
||||
array $call_args,
|
||||
Context $context,
|
||||
CodeLocation $code_location,
|
||||
$stmt,
|
||||
?array $template_type_parameters = null,
|
||||
?string $called_fq_classlike_name = null,
|
||||
?string $called_method_name = null
|
||||
@ -147,6 +148,7 @@ class MethodReturnTypeProvider
|
||||
$call_args,
|
||||
$context,
|
||||
$code_location,
|
||||
$stmt,
|
||||
$template_type_parameters,
|
||||
$called_fq_classlike_name,
|
||||
$called_method_name ? strtolower($called_method_name) : null
|
||||
|
@ -35,6 +35,10 @@ class MethodReturnTypeProviderEvent
|
||||
* @var CodeLocation
|
||||
*/
|
||||
private $code_location;
|
||||
/**
|
||||
* @var PhpParser\Node\Expr\MethodCall|PhpParser\Node\Expr\StaticCall
|
||||
*/
|
||||
private $stmt;
|
||||
/**
|
||||
* @var Type\Union[]|null
|
||||
*/
|
||||
@ -54,6 +58,7 @@ class MethodReturnTypeProviderEvent
|
||||
* something should be returned, but can't be more specific.
|
||||
*
|
||||
* @param list<PhpParser\Node\Arg> $call_args
|
||||
* @param PhpParser\Node\Expr\MethodCall|PhpParser\Node\Expr\StaticCall $stmt
|
||||
* @param ?array<Type\Union> $template_type_parameters
|
||||
* @param lowercase-string $method_name_lowercase
|
||||
* @param lowercase-string $called_method_name_lowercase
|
||||
@ -65,6 +70,7 @@ class MethodReturnTypeProviderEvent
|
||||
array $call_args,
|
||||
Context $context,
|
||||
CodeLocation $code_location,
|
||||
$stmt,
|
||||
?array $template_type_parameters = null,
|
||||
?string $called_fq_classlike_name = null,
|
||||
?string $called_method_name_lowercase = null
|
||||
@ -75,6 +81,7 @@ class MethodReturnTypeProviderEvent
|
||||
$this->call_args = $call_args;
|
||||
$this->context = $context;
|
||||
$this->code_location = $code_location;
|
||||
$this->stmt = $stmt;
|
||||
$this->template_type_parameters = $template_type_parameters;
|
||||
$this->called_fq_classlike_name = $called_fq_classlike_name;
|
||||
$this->called_method_name_lowercase = $called_method_name_lowercase;
|
||||
@ -136,4 +143,12 @@ class MethodReturnTypeProviderEvent
|
||||
{
|
||||
return $this->called_method_name_lowercase;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return PhpParser\Node\Expr\MethodCall|PhpParser\Node\Expr\StaticCall
|
||||
*/
|
||||
public function getStmt()
|
||||
{
|
||||
return $this->stmt;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user