Skip to content
Permalink
Browse files

Allow return type errors to be suppressed locally

  • Loading branch information...
muglug committed May 13, 2019
1 parent c6e2932 commit 9b4d841414f4a70eeed1732fe37eb89a49acb7b3
Showing with 6 additions and 1 deletion.
  1. +6 −1 src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeAnalyzer.php
@@ -250,6 +250,7 @@ public static function verifyReturnType(
if (!$closure_inside_call || $inferred_return_type->isMixed()) {
if ($codebase->alter_code
&& isset($project_analyzer->getIssuesToFix()['MissingClosureReturnType'])
&& !in_array('MissingClosureReturnType', $suppressed_issues)
) {
if ($inferred_return_type->hasMixed() || $inferred_return_type->isNull()) {
return null;
@@ -286,6 +287,7 @@ public static function verifyReturnType(
if ($codebase->alter_code
&& isset($project_analyzer->getIssuesToFix()['MissingReturnType'])
&& !in_array('MissingReturnType', $suppressed_issues)
) {
if ($inferred_return_type->hasMixed() || $inferred_return_type->isNull()) {
return null;
@@ -430,6 +432,7 @@ public static function verifyReturnType(
} else {
if ($codebase->alter_code
&& isset($project_analyzer->getIssuesToFix()['InvalidReturnType'])
&& !in_array('InvalidReturnType', $suppressed_issues)
) {
self::addOrUpdateReturnType(
$function,
@@ -458,7 +461,8 @@ public static function verifyReturnType(
}
}
} elseif ($codebase->alter_code
&& isset($project_analyzer->getIssuesToFix()['LessSpecificReturnType'])
&& isset($project_analyzer->getIssuesToFix()['LessSpecificReturnType'])
&& !in_array('LessSpecificReturnType', $suppressed_issues)
) {
if (!TypeAnalyzer::isContainedBy(
$codebase,
@@ -521,6 +525,7 @@ public static function verifyReturnType(
) {
if ($codebase->alter_code
&& isset($project_analyzer->getIssuesToFix()['InvalidNullableReturnType'])
&& !in_array('InvalidNullableReturnType', $suppressed_issues)
&& !$inferred_return_type->isNull()
) {
self::addOrUpdateReturnType(

0 comments on commit 9b4d841

Please sign in to comment.
You can’t perform that action at this time.