diff --git a/src/Psalm/Internal/Codebase/Analyzer.php b/src/Psalm/Internal/Codebase/Analyzer.php index 9f23798b9..2bdb4c3c2 100644 --- a/src/Psalm/Internal/Codebase/Analyzer.php +++ b/src/Psalm/Internal/Codebase/Analyzer.php @@ -1028,20 +1028,6 @@ class Analyzer ]; } - /** - * @return void - */ - public function addDocblockType( - string $file_path, - \Psalm\CodeLocation\DocblockTypeLocation $code_location, - string $docblock_type - ) { - $this->type_map[$file_path][$code_location->raw_file_start] = [ - $code_location->raw_file_end, - $docblock_type - ]; - } - /** * @param array $aliases * @return void diff --git a/src/Psalm/Type/Atomic.php b/src/Psalm/Type/Atomic.php index fec931219..8c8d1b448 100644 --- a/src/Psalm/Type/Atomic.php +++ b/src/Psalm/Type/Atomic.php @@ -355,14 +355,10 @@ abstract class Atomic && $this->offset_start !== null && $this->offset_end !== null ) { - $codebase->analyzer->addDocblockType( + $codebase->analyzer->addOffsetReference( $source->getFilePath(), - new CodeLocation\DocblockTypeLocation( - $source, - $code_location->raw_file_start + $this->offset_start, - $code_location->raw_file_start + $this->offset_end, - $code_location->raw_line_number - ), + $code_location->raw_file_start + $this->offset_start, + $code_location->raw_file_start + $this->offset_end, $this->value ); } @@ -395,14 +391,10 @@ abstract class Atomic && $extra_type->offset_start !== null && $extra_type->offset_end !== null ) { - $codebase->analyzer->addDocblockType( + $codebase->analyzer->addOffsetReference( $source->getFilePath(), - new CodeLocation\DocblockTypeLocation( - $source, - $code_location->raw_file_start + $extra_type->offset_start, - $code_location->raw_file_start + $extra_type->offset_end, - $code_location->raw_line_number - ), + $code_location->raw_file_start + $extra_type->offset_start, + $code_location->raw_file_start + $extra_type->offset_end, $extra_type->value ); } diff --git a/tests/LanguageServer/SymbolLookupTest.php b/tests/LanguageServer/SymbolLookupTest.php index 54dd82043..3c853bd47 100644 --- a/tests/LanguageServer/SymbolLookupTest.php +++ b/tests/LanguageServer/SymbolLookupTest.php @@ -293,6 +293,6 @@ class SymbolLookupTest extends \Psalm\Tests\TestCase $this->assertNotNull($symbol_at_position); - $this->assertSame('type: Exception', $symbol_at_position[0]); + $this->assertSame('Exception', $symbol_at_position[0]); } }