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:
parent
9b6b79728e
commit
075446e7df
@ -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)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
);
|
||||
}'
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user