diff --git a/src/Node.php b/src/Node.php index d6ddbe66..7dcb2d99 100644 --- a/src/Node.php +++ b/src/Node.php @@ -29,10 +29,10 @@ public function getNodeKindName() : string { * @return int * @throws \Exception */ - public function getStart() : int { + public function getStartPosition() : int { $child = $this->getChildNodesAndTokens()->current(); if ($child instanceof Node) { - return $child->getStart(); + return $child->getStartPosition(); } elseif ($child instanceof Token) { return $child->start; } @@ -285,7 +285,7 @@ public function getChildNames() { * @return int */ public function getWidth() : int { - $first = $this->getStart(); + $first = $this->getStartPosition(); $last = $this->getEndPosition(); return $last - $first; @@ -308,7 +308,7 @@ public function getFullWidth() : int { * @return string */ public function getText() : string { - $start = $this->getStart(); + $start = $this->getStartPosition(); $end = $this->getEndPosition(); $fileContents = $this->getFileContents(); @@ -354,7 +354,7 @@ public function jsonSerialize() { } /** - * Get the end index of a Node. + * Get the end position of a Node. * @return int * @throws \Exception */ @@ -417,7 +417,7 @@ public function getDescendantNodeAtPosition(int $pos) { * @return bool */ private function containsPosition(int $pos): bool { - return $this->getStart() <= $pos && $pos <= $this->getEndPosition(); + return $this->getStartPosition() <= $pos && $pos <= $this->getEndPosition(); } /** diff --git a/src/Node/QualifiedName.php b/src/Node/QualifiedName.php index ee4c8c31..d768f86c 100644 --- a/src/Node/QualifiedName.php +++ b/src/Node/QualifiedName.php @@ -80,7 +80,7 @@ public function isUnqualifiedName() : bool { */ public function getResolvedName($namespaceDefinition = null) { // Name resolution not applicable to constructs that define symbol names or aliases. - if (($this->parent instanceof Node\Statement\NamespaceDefinition && $this->parent->name->getStart() === $this->getStart()) || + if (($this->parent instanceof Node\Statement\NamespaceDefinition && $this->parent->name->getStartPosition() === $this->getStartPosition()) || $this->parent instanceof Node\Statement\NamespaceUseDeclaration || $this->parent instanceof Node\NamespaceUseClause || $this->parent instanceof Node\NamespaceUseGroupClause ||