From 1d3dfe924f74764baf1e105c81bbc4215bfc6833 Mon Sep 17 00:00:00 2001 From: AndrolGenhald Date: Mon, 13 Dec 2021 13:45:55 -0600 Subject: [PATCH] Default to using inferred type unless in late static binding context. --- src/Psalm/Internal/Codebase/ClassLikes.php | 2 +- tests/ConstantTest.php | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Psalm/Internal/Codebase/ClassLikes.php b/src/Psalm/Internal/Codebase/ClassLikes.php index 9391d33591e..2e0e03155f0 100644 --- a/src/Psalm/Internal/Codebase/ClassLikes.php +++ b/src/Psalm/Internal/Codebase/ClassLikes.php @@ -1635,7 +1635,7 @@ public function getClassConstantType( int $visibility, ?StatementsAnalyzer $statements_analyzer = null, array $visited_constant_ids = [], - bool $late_static_binding = true + bool $late_static_binding = false ): ?Type\Union { $class_name = strtolower($class_name); diff --git a/tests/ConstantTest.php b/tests/ConstantTest.php index 18a464c7aed..ee80b061b3f 100644 --- a/tests/ConstantTest.php +++ b/tests/ConstantTest.php @@ -304,14 +304,17 @@ function foo(array $arg): void {} 'lateConstantResolutionParentStringConcat' => [ '