1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-12 09:19:40 +01:00

Add self_out_type to method storage

This commit is contained in:
Olle 2020-06-18 21:55:43 +00:00
parent 20cde0ca2c
commit 9d284f1331
2 changed files with 17 additions and 2 deletions

View File

@ -2439,7 +2439,6 @@ class ReflectorVisitor extends PhpParser\NodeVisitorAbstract implements PhpParse
$class_template_types = $this->class_template_types; $class_template_types = $this->class_template_types;
foreach ($docblock_info->params_out as $docblock_param_out) { foreach ($docblock_info->params_out as $docblock_param_out) {
$param_name = substr($docblock_param_out['name'], 1); $param_name = substr($docblock_param_out['name'], 1);
try { try {
@ -2477,7 +2476,18 @@ class ReflectorVisitor extends PhpParser\NodeVisitorAbstract implements PhpParse
} }
foreach ($docblock_info->self_out as $self_out) { foreach ($docblock_info->self_out as $self_out) {
var_dump($self_out); $out_type = TypeParser::parseTokens(
TypeTokenizer::getFullyQualifiedTokens(
$self_out['type'],
$this->aliases,
$this->function_template_types + $class_template_types,
$this->type_aliases
),
null,
$this->function_template_types + $class_template_types,
$this->type_aliases
);
$storage->self_out_type = $out_type;
} }
foreach ($docblock_info->taint_sink_params as $taint_sink_param) { foreach ($docblock_info->taint_sink_params as $taint_sink_param) {

View File

@ -72,4 +72,9 @@ class MethodStorage extends FunctionLikeStorage
* @var ?string * @var ?string
*/ */
public $plain_getter = null; public $plain_getter = null;
/**
* @var Type\Union|null
*/
public $self_out_type = null;
} }