1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-29 20:28:59 +01:00

4.x - Prevent AfterFunctionCallAnalysisInterface from rewriting return types

This commit is contained in:
Matt Brown 2020-10-04 23:39:08 -04:00 committed by Daniil Gentili
parent ef36b311ea
commit 67d995b67f
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
4 changed files with 8 additions and 12 deletions

View File

@ -83,8 +83,8 @@ class FunctionCasingChecker implements AfterFunctionCallAnalysisInterface, After
Context $context,
StatementsSource $statements_source,
Codebase $codebase,
array &$file_replacements = [],
Union &$return_type_candidate = null
Union $return_type_candidate,
array &$file_replacements
) {
if ($expr->name instanceof PhpParser\Node\Expr) {
return;

View File

@ -1002,8 +1002,8 @@ class FunctionCallAnalyzer extends CallAnalyzer
$context,
$statements_analyzer->getSource(),
$codebase,
$file_manipulations,
$return_type
$return_type,
$file_manipulations
);
}
@ -1015,10 +1015,6 @@ class FunctionCallAnalyzer extends CallAnalyzer
}
}
if ($return_type === null) {
throw new \UnexpectedValueException('$return_type shouldnt be null here');
}
$stmt_type = $return_type;
$return_type->by_ref = $function_storage->returns_by_ref;

View File

@ -22,7 +22,7 @@ interface AfterFunctionCallAnalysisInterface
Context $context,
StatementsSource $statements_source,
Codebase $codebase,
array &$file_replacements = [],
Union &$return_type_candidate = null
Union $return_type_candidate,
array &$file_replacements
);
}

View File

@ -8,8 +8,8 @@ class BasePlugin implements Psalm\Plugin\Hook\AfterFunctionCallAnalysisInterface
\Psalm\Context $context,
\Psalm\StatementsSource $statements_source,
\Psalm\Codebase $codebase,
array &$file_replacements = [],
\Psalm\Type\Union &$return_type_candidate = null
\Psalm\Type\Union &$return_type_candidate,
array &$file_replacements
) {
}
}