@@ -31,10 +31,10 @@ public function getNodeKindName() : string {
31
31
* @return int
32
32
* @throws \Exception
33
33
*/
34
- public function getStart () : int {
34
+ public function getStartPosition () : int {
35
35
$ child = $ this ->getChildNodesAndTokens ()->current ();
36
36
if ($ child instanceof Node) {
37
- return $ child ->getStart ();
37
+ return $ child ->getStartPosition ();
38
38
} elseif ($ child instanceof Token) {
39
39
return $ child ->start ;
40
40
}
@@ -46,7 +46,7 @@ public function getStart() : int {
46
46
* @return int
47
47
* @throws \Exception
48
48
*/
49
- public function getFullStart () : int {
49
+ public function getFullStartPosition () : int {
50
50
foreach ($ this ::CHILD_NAMES as $ name ) {
51
51
52
52
if (($ child = $ this ->$ name ) !== null ) {
@@ -59,7 +59,7 @@ public function getFullStart() : int {
59
59
}
60
60
61
61
if ($ child instanceof Node) {
62
- return $ child ->getFullStart ();
62
+ return $ child ->getFullStartPosition ();
63
63
}
64
64
65
65
if ($ child instanceof Token) {
@@ -330,7 +330,7 @@ public function getChildNames() {
330
330
* @return int
331
331
*/
332
332
public function getWidth () : int {
333
- $ first = $ this ->getStart ();
333
+ $ first = $ this ->getStartPosition ();
334
334
$ last = $ this ->getEndPosition ();
335
335
336
336
return $ last - $ first ;
@@ -342,7 +342,7 @@ public function getWidth() : int {
342
342
* @return int
343
343
*/
344
344
public function getFullWidth () : int {
345
- $ first = $ this ->getFullStart ();
345
+ $ first = $ this ->getFullStartPosition ();
346
346
$ last = $ this ->getEndPosition ();
347
347
348
348
return $ last - $ first ;
@@ -353,7 +353,7 @@ public function getFullWidth() : int {
353
353
* @return string
354
354
*/
355
355
public function getText () : string {
356
- $ start = $ this ->getStart ();
356
+ $ start = $ this ->getStartPosition ();
357
357
$ end = $ this ->getEndPosition ();
358
358
359
359
$ fileContents = $ this ->getFileContents ();
@@ -365,7 +365,7 @@ public function getText() : string {
365
365
* @return string
366
366
*/
367
367
public function getFullText () : string {
368
- $ start = $ this ->getFullStart ();
368
+ $ start = $ this ->getFullStartPosition ();
369
369
$ end = $ this ->getEndPosition ();
370
370
371
371
$ fileContents = $ this ->getFileContents ();
@@ -463,7 +463,7 @@ public function getDescendantNodeAtPosition(int $pos) {
463
463
* @return bool
464
464
*/
465
465
private function containsPosition (int $ pos ): bool {
466
- return $ this ->getStart () <= $ pos && $ pos <= $ this ->getEndPosition ();
466
+ return $ this ->getStartPosition () <= $ pos && $ pos <= $ this ->getEndPosition ();
467
467
}
468
468
469
469
/**
@@ -476,7 +476,7 @@ private function containsPosition(int $pos): bool {
476
476
public function getDocCommentText () {
477
477
$ leadingTriviaText = $ this ->getLeadingCommentAndWhitespaceText ();
478
478
$ leadingTriviaTokens = PhpTokenizer::getTokensArrayFromContent (
479
- $ leadingTriviaText , ParseContext::SourceElements, $ this ->getFullStart (), false
479
+ $ leadingTriviaText , ParseContext::SourceElements, $ this ->getFullStartPosition (), false
480
480
);
481
481
for ($ i = \count ($ leadingTriviaTokens ) - 1 ; $ i >= 0 ; $ i --) {
482
482
$ token = $ leadingTriviaTokens [$ i ];
@@ -509,13 +509,13 @@ public function getImportTablesForCurrentScope() {
509
509
$ topLevelNamespaceStatements = $ namespaceDefinition ->compoundStatementOrSemicolon instanceof Token
510
510
? $ namespaceDefinition ->parent ->statementList // we need to start from the namespace definition.
511
511
: $ namespaceDefinition ->compoundStatementOrSemicolon ->statements ;
512
- $ namespaceFullStart = $ namespaceDefinition ->getFullStart ();
512
+ $ namespaceFullStart = $ namespaceDefinition ->getFullStartPosition ();
513
513
} else {
514
514
$ topLevelNamespaceStatements = $ this ->getRoot ()->statementList ;
515
515
$ namespaceFullStart = 0 ;
516
516
}
517
517
518
- $ nodeFullStart = $ this ->getFullStart ();
518
+ $ nodeFullStart = $ this ->getFullStartPosition ();
519
519
520
520
// TODO optimize performance
521
521
// Currently we rebuild the import tables on every call (and therefore every name resolution operation)
@@ -535,10 +535,10 @@ public function getImportTablesForCurrentScope() {
535
535
$ contents = $ this ->getFileContents ();
536
536
537
537
foreach ($ topLevelNamespaceStatements as $ useDeclaration ) {
538
- if ($ useDeclaration ->getFullStart () <= $ namespaceFullStart ) {
538
+ if ($ useDeclaration ->getFullStartPosition () <= $ namespaceFullStart ) {
539
539
continue ;
540
540
}
541
- if ($ useDeclaration ->getFullStart () > $ nodeFullStart ) {
541
+ if ($ useDeclaration ->getFullStartPosition () > $ nodeFullStart ) {
542
542
break ;
543
543
} elseif (!($ useDeclaration instanceof NamespaceUseDeclaration)) {
544
544
continue ;
@@ -609,11 +609,11 @@ public function getNamespaceDefinition() {
609
609
throw new \Exception ("Invalid tree - SourceFileNode must always exist at root of tree. " );
610
610
}
611
611
612
- $ fullStart = $ this ->getFullStart ();
612
+ $ fullStart = $ this ->getFullStartPosition ();
613
613
$ lastNamespaceDefinition = null ;
614
614
if ($ namespaceDefinition instanceof SourceFileNode) {
615
615
foreach ($ namespaceDefinition ->getChildNodes () as $ childNode ) {
616
- if ($ childNode instanceof NamespaceDefinition && $ childNode ->getFullStart () < $ fullStart ) {
616
+ if ($ childNode instanceof NamespaceDefinition && $ childNode ->getFullStartPosition () < $ fullStart ) {
617
617
$ lastNamespaceDefinition = $ childNode ;
618
618
}
619
619
}
0 commit comments