Use better API for inferring trans types

This commit is contained in:
Matt Brown 2019-11-25 17:01:27 -05:00
parent f965a7662c
commit f4b6fa9530
2 changed files with 5 additions and 5 deletions

View File

@ -4,7 +4,7 @@
"type": "psalm-plugin",
"require": {
"barryvdh/laravel-ide-helper": "^2.6",
"vimeo/psalm": "3.2|3.3|3.4|3.5|3.6",
"vimeo/psalm": "3.7^",
"orchestra/testbench": "^3.5 || ^4.0"
},
"license": "MIT",

View File

@ -25,10 +25,10 @@ class TransReturnTypeProvider implements \Psalm\Plugin\Hook\FunctionReturnTypePr
Context $context,
CodeLocation $code_location
) : Type\Union {
if ($call_args
&& isset($call_args[0]->value->inferredType)
) {
if ($call_args[0]->value->inferredType->isString()) {
if ($call_args) {
$first_arg_type = $statements_source->getNodeTypeProvider()->getType($call_args[0]->value);
if ($first_arg_type && $first_arg_type->isString()) {
return \Psalm\Type::getString();
}
}