Skip to content

Commit

Permalink
Added a new index for the end token of the type, which helps with nam…
Browse files Browse the repository at this point in the history
…espaced types
  • Loading branch information
gsherwood committed Aug 23, 2019
1 parent 19b7cc9 commit abf7417
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Files/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -1627,6 +1627,8 @@ public function getMethodProperties($stackPtr)
* 'type' => string, // The type of the var (empty if no type specifed).
* 'type_token' => integer, // The stack pointer to the start of the type
* // or FALSE if there is no type.
* 'type_end_token' => integer, // The stack pointer to the end of the type
* // or FALSE if there is no type.
* 'nullable_type' => boolean, // TRUE if the type is nullable.
* );
* </code>
Expand Down Expand Up @@ -1732,6 +1734,7 @@ public function getMemberProperties($stackPtr)

$type = '';
$typeToken = false;
$typeEndToken = false;
$nullableType = false;

if ($i < $stackPtr) {
Expand All @@ -1755,6 +1758,7 @@ public function getMemberProperties($stackPtr)
}

if (isset($valid[$this->tokens[$i]['code']]) === true) {
$typeEndToken = $i;
if ($typeToken === false) {
$typeToken = $i;
}
Expand All @@ -1774,6 +1778,7 @@ public function getMemberProperties($stackPtr)
'is_static' => $isStatic,
'type' => $type,
'type_token' => $typeToken,
'type_end_token' => $typeEndToken,
'nullable_type' => $nullableType,
];

Expand Down
1 change: 1 addition & 0 deletions tests/Core/File/GetMemberPropertiesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public function testGetMemberProperties($identifier, $expected)

$result = $this->phpcsFile->getMemberProperties($variable);
unset($result['type_token']);
unset($result['type_end_token']);
$this->assertSame($expected, $result);

}//end testGetMemberProperties()
Expand Down

0 comments on commit abf7417

Please sign in to comment.