mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
4.x - Prevent AfterFunctionCallAnalysisInterface from rewriting return types
This commit is contained in:
parent
ef36b311ea
commit
67d995b67f
@ -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;
|
||||
|
@ -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 shouldn’t be null here');
|
||||
}
|
||||
|
||||
$stmt_type = $return_type;
|
||||
$return_type->by_ref = $function_storage->returns_by_ref;
|
||||
|
||||
|
@ -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
|
||||
);
|
||||
}
|
||||
|
4
tests/fixtures/stubs/base_plugin.php
vendored
4
tests/fixtures/stubs/base_plugin.php
vendored
@ -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
|
||||
) {
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user