1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 05:41:20 +01:00

Simplify conditional

This commit is contained in:
Matthew Brown 2020-05-19 15:07:30 -04:00
parent b5ae0167a2
commit 777b6e8d91

View File

@ -69,13 +69,15 @@ class ArrayColumnReturnTypeProvider implements \Psalm\Plugin\Hook\FunctionReturn
$key_column_name = null; $key_column_name = null;
$third_arg_type = null; $third_arg_type = null;
// calculate key column name // calculate key column name
if (isset($call_args[2]) if (isset($call_args[2])) {
&& ($third_arg_type = $statements_source->node_data->getType($call_args[2]->value)) $third_arg_type = $statements_source->node_data->getType($call_args[2]->value);
) {
if ($third_arg_type->isSingleIntLiteral()) { if ($third_arg_type) {
$key_column_name = $third_arg_type->getSingleIntLiteral()->value; if ($third_arg_type->isSingleIntLiteral()) {
} elseif ($third_arg_type->isSingleStringLiteral()) { $key_column_name = $third_arg_type->getSingleIntLiteral()->value;
$key_column_name = $third_arg_type->getSingleStringLiteral()->value; } elseif ($third_arg_type->isSingleStringLiteral()) {
$key_column_name = $third_arg_type->getSingleStringLiteral()->value;
}
} }
} }