Skip to content

Commit b8c5436

Browse files
committed
Merge branch 'feature/generic-lowercasetype-union-types-php8' of https://github.com/jrfnl/PHP_CodeSniffer
2 parents 0277ae1 + d1fdf32 commit b8c5436

File tree

5 files changed

+295
-110
lines changed

5 files changed

+295
-110
lines changed

src/Files/File.php

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1556,17 +1556,19 @@ public function getMethodParameters($stackPtr)
15561556
* The format of the return value is:
15571557
* <code>
15581558
* array(
1559-
* 'scope' => 'public', // Public, private, or protected
1560-
* 'scope_specified' => true, // TRUE if the scope keyword was found.
1561-
* 'return_type' => '', // The return type of the method.
1562-
* 'return_type_token' => integer, // The stack pointer to the start of the return type
1563-
* // or FALSE if there is no return type.
1564-
* 'nullable_return_type' => false, // TRUE if the return type is preceded by the
1565-
* // nullability operator.
1566-
* 'is_abstract' => false, // TRUE if the abstract keyword was found.
1567-
* 'is_final' => false, // TRUE if the final keyword was found.
1568-
* 'is_static' => false, // TRUE if the static keyword was found.
1569-
* 'has_body' => false, // TRUE if the method has a body
1559+
* 'scope' => 'public', // Public, private, or protected
1560+
* 'scope_specified' => true, // TRUE if the scope keyword was found.
1561+
* 'return_type' => '', // The return type of the method.
1562+
* 'return_type_token' => integer, // The stack pointer to the start of the return type
1563+
* // or FALSE if there is no return type.
1564+
* 'return_type_end_token' => integer, // The stack pointer to the end of the return type
1565+
* // or FALSE if there is no return type.
1566+
* 'nullable_return_type' => false, // TRUE if the return type is preceded by the
1567+
* // nullability operator.
1568+
* 'is_abstract' => false, // TRUE if the abstract keyword was found.
1569+
* 'is_final' => false, // TRUE if the final keyword was found.
1570+
* 'is_static' => false, // TRUE if the static keyword was found.
1571+
* 'has_body' => false, // TRUE if the method has a body
15701572
* );
15711573
* </code>
15721574
*
@@ -1645,6 +1647,7 @@ public function getMethodProperties($stackPtr)
16451647

16461648
$returnType = '';
16471649
$returnTypeToken = false;
1650+
$returnTypeEndToken = false;
16481651
$nullableReturnType = false;
16491652
$hasBody = true;
16501653

@@ -1684,9 +1687,10 @@ public function getMethodProperties($stackPtr)
16841687
$returnTypeToken = $i;
16851688
}
16861689

1687-
$returnType .= $this->tokens[$i]['content'];
1690+
$returnType .= $this->tokens[$i]['content'];
1691+
$returnTypeEndToken = $i;
16881692
}
1689-
}
1693+
}//end for
16901694

16911695
if ($this->tokens[$stackPtr]['code'] === T_FN) {
16921696
$bodyToken = T_FN_ARROW;
@@ -1703,15 +1707,16 @@ public function getMethodProperties($stackPtr)
17031707
}
17041708

17051709
return [
1706-
'scope' => $scope,
1707-
'scope_specified' => $scopeSpecified,
1708-
'return_type' => $returnType,
1709-
'return_type_token' => $returnTypeToken,
1710-
'nullable_return_type' => $nullableReturnType,
1711-
'is_abstract' => $isAbstract,
1712-
'is_final' => $isFinal,
1713-
'is_static' => $isStatic,
1714-
'has_body' => $hasBody,
1710+
'scope' => $scope,
1711+
'scope_specified' => $scopeSpecified,
1712+
'return_type' => $returnType,
1713+
'return_type_token' => $returnTypeToken,
1714+
'return_type_end_token' => $returnTypeEndToken,
1715+
'nullable_return_type' => $nullableReturnType,
1716+
'is_abstract' => $isAbstract,
1717+
'is_final' => $isFinal,
1718+
'is_static' => $isStatic,
1719+
'has_body' => $hasBody,
17151720
];
17161721

17171722
}//end getMethodProperties()

0 commit comments

Comments
 (0)