From 003212fa158ce88a4c122930539c892e87d9455a Mon Sep 17 00:00:00 2001 From: Brown Date: Sat, 4 Apr 2020 21:47:35 -0400 Subject: [PATCH] =?UTF-8?q?Make=20sure=20to=20record=20class=20references?= =?UTF-8?q?=20even=20when=20we=20don=E2=80=99t=20know=20whether=20the=20cl?= =?UTF-8?q?ass=20exists?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Psalm/Internal/Codebase/ClassLikes.php | 44 +++++++++++----------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/Psalm/Internal/Codebase/ClassLikes.php b/src/Psalm/Internal/Codebase/ClassLikes.php index 98059697b..255a27f0d 100644 --- a/src/Psalm/Internal/Codebase/ClassLikes.php +++ b/src/Psalm/Internal/Codebase/ClassLikes.php @@ -308,28 +308,6 @@ class ClassLikes $fq_class_name_lc = strtolower($this->classlike_aliases[$fq_class_name_lc]); } - if (!isset($this->existing_classes_lc[$fq_class_name_lc]) - || !$this->existing_classes_lc[$fq_class_name_lc] - || !$this->classlike_storage_provider->has($fq_class_name_lc) - ) { - if (( - !isset($this->existing_classes_lc[$fq_class_name_lc]) - || $this->existing_classes_lc[$fq_class_name_lc] === true - ) - && !$this->classlike_storage_provider->has($fq_class_name_lc) - ) { - if (!isset($this->existing_classes_lc[$fq_class_name_lc])) { - $this->existing_classes_lc[$fq_class_name_lc] = false; - - return false; - } - - return $this->existing_classes_lc[$fq_class_name_lc]; - } - - return false; - } - if ($code_location) { if ($calling_method_id) { $this->file_reference_provider->addMethodReferenceToClass( @@ -357,6 +335,28 @@ class ClassLikes } } + if (!isset($this->existing_classes_lc[$fq_class_name_lc]) + || !$this->existing_classes_lc[$fq_class_name_lc] + || !$this->classlike_storage_provider->has($fq_class_name_lc) + ) { + if (( + !isset($this->existing_classes_lc[$fq_class_name_lc]) + || $this->existing_classes_lc[$fq_class_name_lc] === true + ) + && !$this->classlike_storage_provider->has($fq_class_name_lc) + ) { + if (!isset($this->existing_classes_lc[$fq_class_name_lc])) { + $this->existing_classes_lc[$fq_class_name_lc] = false; + + return false; + } + + return $this->existing_classes_lc[$fq_class_name_lc]; + } + + return false; + } + if ($this->collect_locations && $code_location) { $this->file_reference_provider->addCallingLocationForClass( $code_location,