diff --git a/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php b/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php index 696ba0b99..a4e0263bd 100644 --- a/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php @@ -76,6 +76,7 @@ use function fwrite; use function get_class; use function in_array; use function is_string; +use function ltrim; use function preg_split; use function reset; use function round; @@ -793,6 +794,7 @@ class StatementsAnalyzer extends SourceAnalyzer if (isset($comments->tags['psalm-scope-this'])) { $trimmed = trim(reset($comments->tags['psalm-scope-this'])); + $trimmed = ltrim($trimmed, '\\'); if (!$codebase->classExists($trimmed)) { IssueBuffer::maybeAdd( diff --git a/tests/TypeReconciliation/ScopeTest.php b/tests/TypeReconciliation/ScopeTest.php index eaf26ef7f..2ebe26ca2 100644 --- a/tests/TypeReconciliation/ScopeTest.php +++ b/tests/TypeReconciliation/ScopeTest.php @@ -194,6 +194,13 @@ class ScopeTest extends TestCase ?>