Skip to content

Commit

Permalink
[Php81] Skip by ref param on ReadOnlyPropertyRector (#6532)
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik authored Dec 8, 2024
1 parent 6b63879 commit cbc295a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace Rector\Tests\Php81\Rector\Property\ReadOnlyPropertyRector\Fixture;

final class SkipByRefParam
{
public function __construct(private array &$idx)
{
}
}
4 changes: 4 additions & 0 deletions rules/Php81/Rector/Property/ReadOnlyPropertyRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,10 @@ private function refactorParam(Class_ $class, ClassMethod $classMethod, Param $p
return null;
}

if ($param->byRef) {
return null;
}

if ($this->paramAnalyzer->isParamReassign($classMethod, $param)) {
return null;
}
Expand Down

0 comments on commit cbc295a

Please sign in to comment.