1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-26 20:34:47 +01:00

Fix #1223 - MissingClosureParamType should use all known suppressed issues

This commit is contained in:
Matthew Brown 2019-01-21 12:36:17 -05:00
parent 9b6b79728e
commit 075446e7df
2 changed files with 32 additions and 2 deletions

View File

@ -564,7 +564,7 @@ abstract class FunctionLikeAnalyzer extends SourceAnalyzer implements Statements
'Parameter $' . $function_param->name . ' has no provided type' . $infer_text,
$function_param->location
),
$storage->suppressed_issues
array_merge($this->suppressed_issues, $storage->suppressed_issues)
);
} else {
IssueBuffer::accepts(
@ -572,7 +572,7 @@ abstract class FunctionLikeAnalyzer extends SourceAnalyzer implements Statements
'Parameter $' . $function_param->name . ' has no provided type' . $infer_text,
$function_param->location
),
$storage->suppressed_issues
array_merge($this->suppressed_issues, $storage->suppressed_issues)
);
}
}

View File

@ -49,6 +49,36 @@ class IssueSuppressionTest extends TestCase
'assertions' => [],
'error_levels' => ['UndefinedFunction'],
],
'crossClosureBoundariesOnFunction' => [
'<?php
/**
* @psalm-suppress MissingClosureParamType
* @psalm-suppress MissingClosureReturnType
*/
function foo(array $bar): array {
return array_map(
function ($value) {
return (string)$value;
},
$bar
);
}'
],
'crossClosureBoundariesOnReturn' => [
'<?php
function bar(array $bar): array {
/**
* @psalm-suppress MissingClosureParamType
* @psalm-suppress MissingClosureReturnType
*/
return array_map(
function ($value) {
return (string)$value;
},
$bar
);
}'
],
];
}