Skip to content

Commit f143ece

Browse files
committed
fixed closeParentIndex variable name
1 parent a55b44c commit f143ece

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/lib/PhpCsFixer/Rule/MultilineParametersFixer.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,23 @@ protected function applyFix(
4848
continue;
4949
}
5050

51-
$closeParenIndex = $tokens->findBlockEnd(Tokens::BLOCK_TYPE_PARENTHESIS_BRACE, $openParentIndex);
51+
$closeParentIndex = $tokens->findBlockEnd(Tokens::BLOCK_TYPE_PARENTHESIS_BRACE, $openParentIndex);
5252

5353
// Count commas to determine parameter count
54-
$paramCount = $this->countParameters($tokens, $openParentIndex, $closeParenIndex);
54+
$paramCount = $this->countParameters($tokens, $openParentIndex, $closeParentIndex);
5555

5656
// Only process if 2+ parameters
5757
if ($paramCount < 2) {
5858
continue;
5959
}
6060

6161
// Check if already multiline
62-
if ($this->isMultiline($tokens, $openParentIndex, $closeParenIndex)) {
62+
if ($this->isMultiline($tokens, $openParentIndex, $closeParentIndex)) {
6363
continue;
6464
}
6565

6666
// Apply multiline formatting
67-
$this->makeMultiline($tokens, $openParentIndex, $closeParenIndex);
67+
$this->makeMultiline($tokens, $openParentIndex, $closeParentIndex);
6868
}
6969
}
7070

@@ -119,41 +119,41 @@ private function isMultiline(
119119
private function makeMultiline(
120120
Tokens $tokens,
121121
int $openParentIndex,
122-
int $closeParenIndex
122+
int $closeParentIndex
123123
): void {
124124
$indent = $this->detectIndent($tokens, $openParentIndex);
125125
$lineIndent = str_repeat(' ', 4); // 4 spaces for parameters
126126

127127
// Add newline after opening parenthesis
128128
$tokens->insertAt($openParentIndex + 1, new Token([T_WHITESPACE, "\n" . $indent . $lineIndent]));
129-
++$closeParenIndex;
129+
++$closeParentIndex;
130130

131131
// Find all commas and add newlines after them
132132
$depth = 0;
133-
for ($i = $openParentIndex + 1; $i < $closeParenIndex; ++$i) {
133+
for ($i = $openParentIndex + 1; $i < $closeParentIndex; ++$i) {
134134
if ($tokens[$i]->equals('(') || $tokens[$i]->equals('[')) {
135135
++$depth;
136136
} elseif ($tokens[$i]->equals(')') || $tokens[$i]->equals(']')) {
137137
--$depth;
138138
} elseif ($depth === 0 && $tokens[$i]->equals(',')) {
139139
// Remove any whitespace after comma
140140
$nextIndex = $i + 1;
141-
while ($nextIndex < $closeParenIndex && $tokens[$nextIndex]->isWhitespace()) {
141+
while ($nextIndex < $closeParentIndex && $tokens[$nextIndex]->isWhitespace()) {
142142
$tokens->clearAt($nextIndex);
143143
++$nextIndex;
144144
}
145145

146146
// Insert newline with proper indentation
147147
$tokens->insertAt($i + 1, new Token([T_WHITESPACE, "\n" . $indent . $lineIndent]));
148-
$closeParenIndex = $tokens->findBlockEnd(Tokens::BLOCK_TYPE_PARENTHESIS_BRACE, $openParentIndex);
148+
$closeParentIndex = $tokens->findBlockEnd(Tokens::BLOCK_TYPE_PARENTHESIS_BRACE, $openParentIndex);
149149
}
150150
}
151151

152152
// Add newline before closing parenthesis
153-
$tokens->insertAt($closeParenIndex, new Token([T_WHITESPACE, "\n" . $indent]));
153+
$tokens->insertAt($closeParentIndex, new Token([T_WHITESPACE, "\n" . $indent]));
154154

155155
// Handle the opening brace
156-
$nextNonWhitespace = $tokens->getNextNonWhitespace($closeParenIndex);
156+
$nextNonWhitespace = $tokens->getNextNonWhitespace($closeParentIndex);
157157
if ($nextNonWhitespace !== null && $tokens[$nextNonWhitespace]->equals('{')) {
158158
$tokens->ensureWhitespaceAtIndex($nextNonWhitespace - 1, 1, ' ');
159159
}

0 commit comments

Comments
 (0)