Skip to content

Commit 6fe899a

Browse files
committed
minor cr fixes
1 parent 7193144 commit 6fe899a

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

src/lib/PhpCsFixer/Rule/MultilineParametersFixer.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,28 +43,28 @@ protected function applyFix(
4343
continue;
4444
}
4545

46-
$openParenIndex = $tokens->getNextTokenOfKind($index, ['(']);
47-
if ($openParenIndex === null) {
46+
$openParentIndex = $tokens->getNextTokenOfKind($index, ['(']);
47+
if ($openParentIndex === null) {
4848
continue;
4949
}
5050

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

5353
// Count commas to determine parameter count
54-
$paramCount = $this->countParameters($tokens, $openParenIndex, $closeParenIndex);
54+
$paramCount = $this->countParameters($tokens, $openParentIndex, $closeParenIndex);
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, $openParenIndex, $closeParenIndex)) {
62+
if ($this->isMultiline($tokens, $openParentIndex, $closeParenIndex)) {
6363
continue;
6464
}
6565

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

@@ -118,19 +118,19 @@ private function isMultiline(
118118

119119
private function makeMultiline(
120120
Tokens $tokens,
121-
int $openParenIndex,
121+
int $openParentIndex,
122122
int $closeParenIndex
123123
): void {
124-
$indent = $this->detectIndent($tokens, $openParenIndex);
124+
$indent = $this->detectIndent($tokens, $openParentIndex);
125125
$lineIndent = str_repeat(' ', 4); // 4 spaces for parameters
126126

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

131131
// Find all commas and add newlines after them
132132
$depth = 0;
133-
for ($i = $openParenIndex + 1; $i < $closeParenIndex; ++$i) {
133+
for ($i = $openParentIndex + 1; $i < $closeParenIndex; ++$i) {
134134
if ($tokens[$i]->equals('(') || $tokens[$i]->equals('[')) {
135135
++$depth;
136136
} elseif ($tokens[$i]->equals(')') || $tokens[$i]->equals(']')) {
@@ -145,7 +145,7 @@ private function makeMultiline(
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, $openParenIndex);
148+
$closeParenIndex = $tokens->findBlockEnd(Tokens::BLOCK_TYPE_PARENTHESIS_BRACE, $openParentIndex);
149149
}
150150
}
151151

tests/lib/PhpCsFixer/Rule/MultilineParametersFixerTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Ibexa\CodeStyle\PhpCsFixer\Rule\MultilineParametersFixer;
1212
use PhpCsFixer\Tokenizer\Tokens;
1313
use PHPUnit\Framework\TestCase;
14+
use SplFileInfo;
1415

1516
final class MultilineParametersFixerTest extends TestCase
1617
{
@@ -29,7 +30,7 @@ public function testFix(
2930
string $expected
3031
): void {
3132
$tokens = Tokens::fromCode($input);
32-
$this->fixer->fix(new \SplFileInfo(__FILE__), $tokens);
33+
$this->fixer->fix(new SplFileInfo(__FILE__), $tokens);
3334

3435
self::assertSame($expected, $tokens->generateCode());
3536
}

0 commit comments

Comments
 (0)