From 289f5046b27cf9992cf98ca696168b3bcb990e41 Mon Sep 17 00:00:00 2001 From: Brown Date: Thu, 4 Oct 2018 16:58:11 -0400 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20disable=20class=20checks=20if?= =?UTF-8?q?=20extension=20is=20loaded?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Statements/Expression/Call/FunctionCallChecker.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Psalm/Checker/Statements/Expression/Call/FunctionCallChecker.php b/src/Psalm/Checker/Statements/Expression/Call/FunctionCallChecker.php index 6f7c4ba4e..52a072f8a 100644 --- a/src/Psalm/Checker/Statements/Expression/Call/FunctionCallChecker.php +++ b/src/Psalm/Checker/Statements/Expression/Call/FunctionCallChecker.php @@ -493,7 +493,14 @@ class FunctionCallChecker extends \Psalm\Checker\Statements\Expression\CallCheck $context->phantom_files[$var_id] = true; } } elseif ($function->parts === ['extension_loaded']) { - $context->check_classes = false; + if ($first_arg + && $first_arg->value instanceof PhpParser\Node\Scalar\String_ + && @extension_loaded($first_arg->value->value) + ) { + // do nothing + } else { + $context->check_classes = false; + } } elseif ($function->parts === ['function_exists']) { $context->check_functions = false; } elseif ($function->parts === ['is_callable']) {