mirror of
https://github.com/danog/psalm-plugin-laravel.git
synced 2024-11-30 04:39:01 +01:00
Merge pull request #18 from psalm/1.x
Use better API for inferring trans types
This commit is contained in:
commit
4fdfd6b5c0
@ -4,7 +4,7 @@
|
|||||||
"type": "psalm-plugin",
|
"type": "psalm-plugin",
|
||||||
"require": {
|
"require": {
|
||||||
"barryvdh/laravel-ide-helper": "^2.6",
|
"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"
|
"orchestra/testbench": "^3.5 || ^4.0"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
@ -25,10 +25,10 @@ class TransReturnTypeProvider implements \Psalm\Plugin\Hook\FunctionReturnTypePr
|
|||||||
Context $context,
|
Context $context,
|
||||||
CodeLocation $code_location
|
CodeLocation $code_location
|
||||||
) : Type\Union {
|
) : Type\Union {
|
||||||
if ($call_args
|
if ($call_args) {
|
||||||
&& isset($call_args[0]->value->inferredType)
|
$first_arg_type = $statements_source->getNodeTypeProvider()->getType($call_args[0]->value);
|
||||||
) {
|
|
||||||
if ($call_args[0]->value->inferredType->isString()) {
|
if ($first_arg_type && $first_arg_type->isString()) {
|
||||||
return \Psalm\Type::getString();
|
return \Psalm\Type::getString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user