1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Remove undefined variables

This commit is contained in:
adrew 2021-12-22 15:10:56 +03:00 committed by Bruce Weirdan
parent 2e4d75d6bd
commit d6d0fc6704
No known key found for this signature in database
GPG Key ID: CFC3AAB181751B0D
2 changed files with 10 additions and 11 deletions

View File

@ -406,18 +406,18 @@ class ArgumentsAnalyzer
|| $replaced_type_part instanceof TClosure
) {
if (isset($replaced_type_part->params[$closure_param_offset]->type)) {
$param_type = $replaced_type_part->params[$closure_param_offset]->type;
$replaced_param_type = $replaced_type_part->params[$closure_param_offset]->type;
if ($param_type->hasTemplate()) {
$param_type = TypeExpander::expandUnion(
if ($replaced_param_type->hasTemplate()) {
$replaced_param_type = TypeExpander::expandUnion(
$codebase,
$param_type,
$class_storage->name ?? null,
$calling_class_storage->name ?? null,
$replaced_param_type,
null,
null,
null,
true,
false,
$calling_class_storage->final ?? false,
false,
true,
true,
);
@ -426,7 +426,7 @@ class ArgumentsAnalyzer
if ($param_storage->type && !$param_type_inferred) {
$type_match_found = UnionTypeComparator::isContainedBy(
$codebase,
$param_type,
$replaced_param_type,
$param_storage->type
);
@ -437,7 +437,7 @@ class ArgumentsAnalyzer
$newly_inferred_type = Type::combineUnionTypes(
$newly_inferred_type,
$param_type,
$replaced_param_type,
$codebase
);
}

View File

@ -142,8 +142,7 @@ class CallableTest extends TestCase
}
/** @var ArrayList<int> $a */
$a = new ArrayList();
$b = asTupled($a);
',
$b = asTupled($a);',
'assertions' => [
'$b' => 'ArrayList<array{int}>',
],