From b412c125a437852673106f232ea13afc2d76569c Mon Sep 17 00:00:00 2001 From: Declspeck Date: Sun, 25 Feb 2018 22:02:54 +0200 Subject: [PATCH] fix(indexing): handle integer FQNs --- src/PhpDocument.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/PhpDocument.php b/src/PhpDocument.php index 0ac8421..805bc08 100644 --- a/src/PhpDocument.php +++ b/src/PhpDocument.php @@ -160,7 +160,9 @@ class PhpDocument // Register this document on the project for references foreach ($this->referenceNodes as $fqn => $nodes) { - $this->index->addReferenceUri($fqn, $this->uri); + // Cast the key to string. If (string)'2' is set as an array index, it will read out as (int)2. We must + // deal with incorrect code, so this is a valid scenario. + $this->index->addReferenceUri((string)$fqn, $this->uri); } $this->sourceFileNode = $treeAnalyzer->getSourceFileNode();