Skip to content

Commit 07b1784

Browse files
refactor: refine ArgumentAdderRector named argument handling
1 parent 6cb5d82 commit 07b1784

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

rules/Arguments/Rector/ClassMethod/ArgumentAdderRector.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -352,18 +352,14 @@ private function processStaticCall(
352352
}
353353

354354
// Handle named arguments case - add as named argument at the end
355+
$arg = new Arg(new Variable($argumentName));
355356
if ($this->argsAnalyzer->hasNamedArg($staticCall->getArgs())) {
356-
$arg = new Arg(new Variable($argumentName));
357357
$arg->name = new Identifier($argumentName);
358-
$staticCall->args[] = $arg;
359-
$this->hasChanged = true;
360-
return;
358+
} else {
359+
$this->fillGapBetweenWithDefaultValue($staticCall, $position);
361360
}
362361

363-
// Original positional logic
364-
$this->fillGapBetweenWithDefaultValue($staticCall, $position);
365-
366-
$staticCall->args[$position] = new Arg(new Variable($argumentName));
362+
$staticCall->args[] = $arg;
367363
$this->hasChanged = true;
368364
}
369365

0 commit comments

Comments
 (0)