Skip to content
Permalink
Browse files

Ignore nullable issues on just-coerced types

  • Loading branch information...
muglug committed May 21, 2019
1 parent 034ea72 commit 29c869ed670dc448ee857a11be9be9329750fd99
Showing with 18 additions and 0 deletions.
  1. +4 −0 src/Psalm/Internal/Analyzer/Statements/Expression/CallAnalyzer.php
  2. +14 −0 tests/FunctionCallTest.php
@@ -2688,6 +2688,10 @@ private static function coerceValueAfterGatekeeperArgument(
}
} elseif ($input_type->isMixed() && $signature_param_type) {
$input_type = clone $signature_param_type;
if ($input_type->isNullable()) {
$input_type->ignore_nullable_issues = true;
}
}
$context->removeVarFromConflictingClauses($var_id, null, $statements_analyzer);
@@ -1661,6 +1661,20 @@ function bar($s) : void {
takesInt($s);
}',
],
'ignoreNullableIssuesAfterMixedCoercion' => [
'<?php
function takesNullableString(?string $s) : void {}
function takesString(string $s) : void {}
/**
* @param mixed $s
* @psalm-suppress MixedArgument
*/
function bar($s) : void {
takesNullableString($s);
takesString($s);
}',
],
];
}

0 comments on commit 29c869e

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