Skip to content

Commit 6a0e2ff

Browse files
authored
Add explicit types for 'nested_parenthesis' (#286)
* Add explicit types for 'nested_parenthesis' * Also allow string
1 parent f96c2ee commit 6a0e2ff

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

VariableAnalysis/Lib/Helpers.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ public static function findContainingOpeningBracket(File $phpcsFile, $stackPtr)
6969
{
7070
$tokens = $phpcsFile->getTokens();
7171
if (isset($tokens[$stackPtr]['nested_parenthesis'])) {
72+
/**
73+
* @var array<int|string|null>
74+
*/
7275
$openPtrs = array_keys($tokens[$stackPtr]['nested_parenthesis']);
7376
return (int)end($openPtrs);
7477
}
@@ -1081,6 +1084,9 @@ public static function getFunctionIndexForFunctionCallArgument(File $phpcsFile,
10811084
if (empty($token['nested_parenthesis'])) {
10821085
return null;
10831086
}
1087+
/**
1088+
* @var array<int|string|null>
1089+
*/
10841090
$startingParenthesis = array_keys($token['nested_parenthesis']);
10851091
$startOfArguments = end($startingParenthesis);
10861092
if (! is_int($startOfArguments)) {

0 commit comments

Comments
 (0)