1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-26 20:34:47 +01:00

Add reference, not type

Ref #1835
This commit is contained in:
Matthew Brown 2019-06-23 09:10:43 -04:00
parent 37ffd6dad6
commit 766b1b0384
3 changed files with 7 additions and 29 deletions

View File

@ -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<string, string> $aliases
* @return void

View File

@ -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
);
}

View File

@ -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]);
}
}