diff --git a/src/Psalm/Config.php b/src/Psalm/Config.php index c26ed6421..3c59748b4 100644 --- a/src/Psalm/Config.php +++ b/src/Psalm/Config.php @@ -1876,6 +1876,10 @@ class Config } if ($this->autoloader) { + // somee classes that we think are missing may not actually be missing + // as they might be autoloadable once we require the autoloader below + $codebase->classlikes->forgetMissingClassLikes(); + // do this in a separate method so scope does not leak $this->requireAutoloader($this->autoloader); diff --git a/src/Psalm/Internal/Codebase/ClassLikes.php b/src/Psalm/Internal/Codebase/ClassLikes.php index ee84e3066..4d38839bb 100644 --- a/src/Psalm/Internal/Codebase/ClassLikes.php +++ b/src/Psalm/Internal/Codebase/ClassLikes.php @@ -2315,6 +2315,11 @@ class ClassLikes && $this->existing_classlikes_lc[$fq_classlike_name_lc]; } + public function forgetMissingClassLikes() : void + { + $this->existing_classlikes_lc = \array_filter($this->existing_classlikes_lc); + } + /** * @param string $fq_class_name *