Roave/BackwardCompatibilityCheck

Rename variadic parameter is not break BC

vjik opened this issue · 3 comments

vjik commented
interface A {
    public function test(...$a): void;
}

change to

interface A {
    public function test(...$b): void;
}

This is not break BC.

All data pass to variadic parameter when named arguments used. For example: https://3v4l.org/stRQl

Could we have that in a test case, perhaps? 🤔

I would need a patch touching these files:

public function __invoke(
ReflectionMethod|ReflectionFunction $fromFunction,
ReflectionMethod|ReflectionFunction $toFunction,
): Changes {
$fromHadNoNamedArgumentsAnnotation = $this->methodHasNoNamedArgumentsAnnotation($fromFunction);
$toHasNoNamedArgumentsAnnotation = $this->methodHasNoNamedArgumentsAnnotation($toFunction);
if ($fromHadNoNamedArgumentsAnnotation && ! $toHasNoNamedArgumentsAnnotation) {
return Changes::fromList(
Change::removed(
sprintf(
'The %s annotation was removed from %s',
self::NO_NAMED_ARGUMENTS_ANNOTATION,
$this->formatFunction->__invoke($fromFunction),
),
),
);
}
if (! $fromHadNoNamedArgumentsAnnotation && $toHasNoNamedArgumentsAnnotation) {
return Changes::fromList(
Change::added(
sprintf(
'The %s annotation was added from %s',
self::NO_NAMED_ARGUMENTS_ANNOTATION,
$this->formatFunction->__invoke($fromFunction),
),
),
);
}
if ($toHasNoNamedArgumentsAnnotation) {
return Changes::empty();
}
return Changes::fromIterator($this->checkSymbols(
$fromFunction->getParameters(),
$toFunction->getParameters(),
));
}

/** @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\FunctionBased\ParameterNameChanged */
final class ParameterNameChangedTest extends TestCase