diff --git a/src/Psalm/Context.php b/src/Psalm/Context.php
index <HASH>..<HASH> 100644
--- a/src/Psalm/Context.php
+++ b/src/Psalm/Context.php
@@ -291,7 +291,10 @@ class Context
     public function hasVariable($var_name)
     {
         if ($this->count_references) {
-            if (!$var_name || !isset($this->vars_possibly_in_scope[$var_name])) {
+            if (!$var_name ||
+                (!isset($this->vars_possibly_in_scope[$var_name]) &&
+                    !isset($this->vars_in_scope[$var_name]))
+            ) {
                 return false;
             }
Do not ignore object vars in hasVariable