Skip to content

Commit b147022

Browse files
committed
skip variadic param on ParamTypeByParentCallTypeRector
1 parent 18f1061 commit b147022

3 files changed

Lines changed: 29 additions & 0 deletions

File tree

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\ParamTypeByParentCallTypeRector\Fixture;
4+
5+
use Rector\Tests\TypeDeclaration\Rector\ClassMethod\ParamTypeByParentCallTypeRector\Source\ParentClassWithArraySpread;
6+
7+
final class SkipParentClassWithArraySpread extends ParentClassWithArraySpread
8+
{
9+
public function __construct(...$items)
10+
{
11+
parent::__construct(...$items);
12+
}
13+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\ParamTypeByParentCallTypeRector\Source;
6+
7+
class ParentClassWithArraySpread
8+
{
9+
public function __construct(string $spreadedItem)
10+
{
11+
}
12+
}

rules/TypeDeclaration/Rector/ClassMethod/ParamTypeByParentCallTypeRector.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ public function refactor(Node $node): ?Node
104104
continue;
105105
}
106106

107+
if ($param->variadic) {
108+
continue;
109+
}
110+
107111
$parentParam = $this->callerParamMatcher->matchParentParam($parentStaticCall, $param, $scope);
108112
if (! $parentParam instanceof Param) {
109113
continue;

0 commit comments

Comments
 (0)