@@ -31,10 +31,10 @@ public function getNodeKindName() : string {
3131 * @return int
3232 * @throws \Exception
3333 */
34- public function getStart () : int {
34+ public function getStartPosition () : int {
3535 $ child = $ this ->getChildNodesAndTokens ()->current ();
3636 if ($ child instanceof Node) {
37- return $ child ->getStart ();
37+ return $ child ->getStartPosition ();
3838 } elseif ($ child instanceof Token) {
3939 return $ child ->start ;
4040 }
@@ -46,7 +46,7 @@ public function getStart() : int {
4646 * @return int
4747 * @throws \Exception
4848 */
49- public function getFullStart () : int {
49+ public function getFullStartPosition () : int {
5050 foreach ($ this ::CHILD_NAMES as $ name ) {
5151
5252 if (($ child = $ this ->$ name ) !== null ) {
@@ -59,7 +59,7 @@ public function getFullStart() : int {
5959 }
6060
6161 if ($ child instanceof Node) {
62- return $ child ->getFullStart ();
62+ return $ child ->getFullStartPosition ();
6363 }
6464
6565 if ($ child instanceof Token) {
@@ -330,7 +330,7 @@ public function getChildNames() {
330330 * @return int
331331 */
332332 public function getWidth () : int {
333- $ first = $ this ->getStart ();
333+ $ first = $ this ->getStartPosition ();
334334 $ last = $ this ->getEndPosition ();
335335
336336 return $ last - $ first ;
@@ -342,7 +342,7 @@ public function getWidth() : int {
342342 * @return int
343343 */
344344 public function getFullWidth () : int {
345- $ first = $ this ->getFullStart ();
345+ $ first = $ this ->getFullStartPosition ();
346346 $ last = $ this ->getEndPosition ();
347347
348348 return $ last - $ first ;
@@ -353,7 +353,7 @@ public function getFullWidth() : int {
353353 * @return string
354354 */
355355 public function getText () : string {
356- $ start = $ this ->getStart ();
356+ $ start = $ this ->getStartPosition ();
357357 $ end = $ this ->getEndPosition ();
358358
359359 $ fileContents = $ this ->getFileContents ();
@@ -365,7 +365,7 @@ public function getText() : string {
365365 * @return string
366366 */
367367 public function getFullText () : string {
368- $ start = $ this ->getFullStart ();
368+ $ start = $ this ->getFullStartPosition ();
369369 $ end = $ this ->getEndPosition ();
370370
371371 $ fileContents = $ this ->getFileContents ();
@@ -463,7 +463,7 @@ public function getDescendantNodeAtPosition(int $pos) {
463463 * @return bool
464464 */
465465 private function containsPosition (int $ pos ): bool {
466- return $ this ->getStart () <= $ pos && $ pos <= $ this ->getEndPosition ();
466+ return $ this ->getStartPosition () <= $ pos && $ pos <= $ this ->getEndPosition ();
467467 }
468468
469469 /**
@@ -476,7 +476,7 @@ private function containsPosition(int $pos): bool {
476476 public function getDocCommentText () {
477477 $ leadingTriviaText = $ this ->getLeadingCommentAndWhitespaceText ();
478478 $ leadingTriviaTokens = PhpTokenizer::getTokensArrayFromContent (
479- $ leadingTriviaText , ParseContext::SourceElements, $ this ->getFullStart (), false
479+ $ leadingTriviaText , ParseContext::SourceElements, $ this ->getFullStartPosition (), false
480480 );
481481 for ($ i = \count ($ leadingTriviaTokens ) - 1 ; $ i >= 0 ; $ i --) {
482482 $ token = $ leadingTriviaTokens [$ i ];
@@ -509,13 +509,13 @@ public function getImportTablesForCurrentScope() {
509509 $ topLevelNamespaceStatements = $ namespaceDefinition ->compoundStatementOrSemicolon instanceof Token
510510 ? $ namespaceDefinition ->parent ->statementList // we need to start from the namespace definition.
511511 : $ namespaceDefinition ->compoundStatementOrSemicolon ->statements ;
512- $ namespaceFullStart = $ namespaceDefinition ->getFullStart ();
512+ $ namespaceFullStart = $ namespaceDefinition ->getFullStartPosition ();
513513 } else {
514514 $ topLevelNamespaceStatements = $ this ->getRoot ()->statementList ;
515515 $ namespaceFullStart = 0 ;
516516 }
517517
518- $ nodeFullStart = $ this ->getFullStart ();
518+ $ nodeFullStart = $ this ->getFullStartPosition ();
519519
520520 // TODO optimize performance
521521 // Currently we rebuild the import tables on every call (and therefore every name resolution operation)
@@ -535,10 +535,10 @@ public function getImportTablesForCurrentScope() {
535535 $ contents = $ this ->getFileContents ();
536536
537537 foreach ($ topLevelNamespaceStatements as $ useDeclaration ) {
538- if ($ useDeclaration ->getFullStart () <= $ namespaceFullStart ) {
538+ if ($ useDeclaration ->getFullStartPosition () <= $ namespaceFullStart ) {
539539 continue ;
540540 }
541- if ($ useDeclaration ->getFullStart () > $ nodeFullStart ) {
541+ if ($ useDeclaration ->getFullStartPosition () > $ nodeFullStart ) {
542542 break ;
543543 } elseif (!($ useDeclaration instanceof NamespaceUseDeclaration)) {
544544 continue ;
@@ -609,11 +609,11 @@ public function getNamespaceDefinition() {
609609 throw new \Exception ("Invalid tree - SourceFileNode must always exist at root of tree. " );
610610 }
611611
612- $ fullStart = $ this ->getFullStart ();
612+ $ fullStart = $ this ->getFullStartPosition ();
613613 $ lastNamespaceDefinition = null ;
614614 if ($ namespaceDefinition instanceof SourceFileNode) {
615615 foreach ($ namespaceDefinition ->getChildNodes () as $ childNode ) {
616- if ($ childNode instanceof NamespaceDefinition && $ childNode ->getFullStart () < $ fullStart ) {
616+ if ($ childNode instanceof NamespaceDefinition && $ childNode ->getFullStartPosition () < $ fullStart ) {
617617 $ lastNamespaceDefinition = $ childNode ;
618618 }
619619 }
@@ -662,7 +662,7 @@ public function getPreviousSibling() {
662662 * Add the alias and resolved name to the corresponding namespace, function, or const import table.
663663 * If the alias already exists, it will get replaced by the most recent using.
664664 *
665- * TODO - worth throwing an error here in stead ?
665+ * TODO - worth throwing an error here instead ?
666666 */
667667 private function addToImportTable ($ alias , $ functionOrConst , $ namespaceNameParts , $ contents , & $ namespaceImportTable , & $ functionImportTable , & $ constImportTable ):array
668668 {
0 commit comments