From c4551bd0dfda5b2773a3371fbf2e82bfef3371a2 Mon Sep 17 00:00:00 2001 From: Matthew Brown Date: Sat, 15 Jun 2019 18:49:58 -0400 Subject: [PATCH] Fix issue where extension_loaded stopped constructor being recognised --- .../Statements/Expression/Call/NewAnalyzer.php | 1 - tests/UnusedCodeTest.php | 10 ++++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/NewAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/NewAnalyzer.php index 106273e86..492dcc842 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/NewAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/NewAnalyzer.php @@ -288,7 +288,6 @@ class NewAnalyzer extends \Psalm\Internal\Analyzer\Statements\Expression\CallAna $stmt->inferredType = new Type\Union([new TNamedObject($fq_class_name)]); if (strtolower($fq_class_name) !== 'stdclass' && - $context->check_classes && $codebase->classlikes->classExists($fq_class_name) ) { $storage = $codebase->classlike_storage_provider->get($fq_class_name); diff --git a/tests/UnusedCodeTest.php b/tests/UnusedCodeTest.php index 686cd0950..26a7220ab 100644 --- a/tests/UnusedCodeTest.php +++ b/tests/UnusedCodeTest.php @@ -387,6 +387,16 @@ class UnusedCodeTest extends TestCase (new D)->bar();' ], + 'usedClassAfterExtensionLoaded' => [ + '