From 4688cf7a926511a5f5d1f6dc3a0b016c750c39be Mon Sep 17 00:00:00 2001 From: Matthew Brown Date: Wed, 20 Jun 2018 09:09:03 -0400 Subject: [PATCH] Fix #831 - ignore falsable issues when getting callmap function params --- src/Psalm/Checker/FunctionLikeChecker.php | 8 +++++++- tests/FunctionCallTest.php | 7 +++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Psalm/Checker/FunctionLikeChecker.php b/src/Psalm/Checker/FunctionLikeChecker.php index 6ea0252f9..c36576af3 100644 --- a/src/Psalm/Checker/FunctionLikeChecker.php +++ b/src/Psalm/Checker/FunctionLikeChecker.php @@ -1016,7 +1016,13 @@ abstract class FunctionLikeChecker extends SourceChecker implements StatementsSo continue; } - if (TypeChecker::isContainedBy($project_checker->codebase, $arg->value->inferredType, $param_type)) { + if (TypeChecker::isContainedBy( + $project_checker->codebase, + $arg->value->inferredType, + $param_type, + $arg->value->inferredType->ignore_nullable_issues, + $arg->value->inferredType->ignore_falsable_issues + )) { continue; } diff --git a/tests/FunctionCallTest.php b/tests/FunctionCallTest.php index 151c27a15..013134621 100644 --- a/tests/FunctionCallTest.php +++ b/tests/FunctionCallTest.php @@ -694,6 +694,13 @@ class FunctionCallTest extends TestCase '$h' => 'array', ], ], + 'strstrWithPossiblyFalseFirstArg' => [ + ' "bar"] + );' + ], ]; }