Skip to content

Commit

Permalink
[TypeDeclaration] Skip Arg unpack on AddMethodCallBasedStrictParamTyp…
Browse files Browse the repository at this point in the history
…eRector (#3787)
  • Loading branch information
samsonasik committed May 10, 2023
1 parent 11b278c commit 388763c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

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

final class SkipArgUnpack
{
/**
* @param list<int> $list
*/
public function __construct(array $list)
{
$this->process(...$list);
}

private function process(int ...$variadic): void
{
}
}
4 changes: 4 additions & 0 deletions rules/TypeDeclaration/NodeAnalyzer/CallTypesResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ public function resolveStrictTypesFromCalls(array $calls): array
continue;
}

if ($arg->unpack) {
continue;
}

$staticTypesByArgumentPosition[$position][] = $this->resolveStrictArgValueType($arg);
}
}
Expand Down

0 comments on commit 388763c

Please sign in to comment.