Skip to content

Commit

Permalink
[TypeDeclaratoin] Skip variadic param
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Oct 29, 2021
1 parent 9efb3a5 commit 04354c2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

declare(strict_types=1);

namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\ParamTypeByMethodCallTypeRector\Fixture;

final class SkipVariadicArray
{
public function run(...$items)
{
$this->processVariadic($items);
}

private function processVariadic(array $value)
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,10 @@ private function shouldSkipParam(Param $param, ClassMethod $classMethod): bool
return true;
}

if ($param->variadic) {
return true;
}

// already has type, skip
return $param->type !== null;
}
Expand Down

0 comments on commit 04354c2

Please sign in to comment.