Skip to content

Commit b412c12

Browse files
Declspeckfelixfbecker
authored andcommitted
fix(indexing): handle integer FQNs
1 parent 8adcf92 commit b412c12

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/PhpDocument.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,9 @@ public function updateContent(string $content)
160160

161161
// Register this document on the project for references
162162
foreach ($this->referenceNodes as $fqn => $nodes) {
163-
$this->index->addReferenceUri($fqn, $this->uri);
163+
// Cast the key to string. If (string)'2' is set as an array index, it will read out as (int)2. We must
164+
// deal with incorrect code, so this is a valid scenario.
165+
$this->index->addReferenceUri((string)$fqn, $this->uri);
164166
}
165167

166168
$this->sourceFileNode = $treeAnalyzer->getSourceFileNode();

0 commit comments

Comments
 (0)