[PHP 8.0] skip alternative arg count (#5283)

This commit is contained in:
Tomas Votruba 2021-01-22 10:37:29 +01:00 committed by GitHub
parent 7db7d4e037
commit 9cd09e9512
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 0 deletions

View File

@ -130,6 +130,10 @@ CODE_SAMPLE
return null;
}
if (count($new->args) !== count($constructorClassMethod->getParams())) {
return null;
}
$newArgs = $this->argumentSorter->sortArgsByExpectedParamOrder($new->args, $expectedOrderedParams);
if ($new->args === $newArgs) {
return null;
@ -157,6 +161,10 @@ CODE_SAMPLE
return null;
}
if (count($methodCall->args) !== count($classMethod->getParams())) {
return null;
}
$newArgs = $this->argumentSorter->sortArgsByExpectedParamOrder($methodCall->args, $expectedOrderedParams);
if ($methodCall->args === $newArgs) {
return null;

View File

@ -0,0 +1,19 @@
<?php
declare(strict_types=1);
namespace Rector\Php80\Tests\Rector\ClassMethod\OptionalParametersAfterRequiredRector\Fixture;
final class SkipFuncGetArgs
{
public function go($required)
{
$args = func_get_args();
return $args;
}
public function create()
{
return $this->go(1, 5, 100);
}
}