diff --git a/src/Psalm/Checker/TypeChecker.php b/src/Psalm/Checker/TypeChecker.php
index <HASH>..<HASH> 100644
--- a/src/Psalm/Checker/TypeChecker.php
+++ b/src/Psalm/Checker/TypeChecker.php
@@ -195,7 +195,6 @@ class TypeChecker
                 continue;
             }
 
-            $type_match_found = false;
             $scalar_type_match_found = false;
             $atomic_to_string_cast = false;
 
@@ -211,16 +210,12 @@ class TypeChecker
                 );
 
                 if ($is_atomic_contained_by) {
-                    $type_match_found = true;
+                    return true;
                 }
             }
-
-            if (!$type_match_found) {
-                return false;
-            }
         }
 
-        return true;
+        return false;
     }
 
     /**
diff --git a/tests/ArgTest.php b/tests/ArgTest.php
index <HASH>..<HASH> 100644
--- a/tests/ArgTest.php
+++ b/tests/ArgTest.php
@@ -71,6 +71,20 @@ class ArgTest extends TestCase
                     );',
                 'error_message' => 'PossiblyInvalidArgument',
             ],
+            'possiblyInvalidArgumentWithOverlap' => [
+                '<?php
+                    class A {}
+                    class B {}
+                    class C {}
+
+                    $foo = rand(0, 1) ? new A : new B;
+
+                    /** @param B|C $b */
+                    function bar($b) : void {}
+
+                    bar($foo);',
+                'error_message' => 'PossiblyInvalidArgument',
+            ],
         ];
     }
 }
If there’s any overlap in types use PossiblyInvalidArgument