mirror of
https://github.com/rectorphp/rector.git
synced 2025-02-24 11:44:14 +01:00
Skip variadic arguments from property promotion (#5046)
This commit is contained in:
parent
bf9e31b515
commit
7a82928e08
@ -96,12 +96,16 @@ CODE_SAMPLE
|
|||||||
foreach ($promotionCandidates as $promotionCandidate) {
|
foreach ($promotionCandidates as $promotionCandidate) {
|
||||||
// does property have some useful annotations?
|
// does property have some useful annotations?
|
||||||
$property = $promotionCandidate->getProperty();
|
$property = $promotionCandidate->getProperty();
|
||||||
|
$param = $promotionCandidate->getParam();
|
||||||
|
|
||||||
|
if ($param->variadic) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$this->removeNode($property);
|
$this->removeNode($property);
|
||||||
$this->removeNode($promotionCandidate->getAssign());
|
$this->removeNode($promotionCandidate->getAssign());
|
||||||
|
|
||||||
$property = $promotionCandidate->getProperty();
|
$property = $promotionCandidate->getProperty();
|
||||||
$param = $promotionCandidate->getParam();
|
|
||||||
|
|
||||||
$this->decorateParamWithPropertyPhpDocInfo($property, $param);
|
$this->decorateParamWithPropertyPhpDocInfo($property, $param);
|
||||||
|
|
||||||
|
@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Rector\Php80\Tests\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector\Fixture;
|
||||||
|
|
||||||
|
class SkipVariadicArguments
|
||||||
|
{
|
||||||
|
/** @var string[] */
|
||||||
|
private array $bars;
|
||||||
|
|
||||||
|
public function __construct(string ...$bars)
|
||||||
|
{
|
||||||
|
$this->bars = $bars;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user