Skip to content

Commit a458869

Browse files
authored
[Privatization] Do not remove readonly on promoted property on PrivatizeFinalClassPropertyRector (#7611)
* [Privatization] Do not remove readonly on promoted property on PrivatizeFinalClassPropertyRector * Fix
1 parent 8475e03 commit a458869

2 files changed

Lines changed: 25 additions & 5 deletions

File tree

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
namespace Rector\Tests\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector\Fixture;
4+
5+
final class DoNotRemoveReadonlyPromotedProperty
6+
{
7+
public function __construct(protected readonly \stdClass $std)
8+
{
9+
}
10+
}
11+
12+
?>
13+
-----
14+
<?php
15+
16+
namespace Rector\Tests\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector\Fixture;
17+
18+
final class DoNotRemoveReadonlyPromotedProperty
19+
{
20+
public function __construct(private readonly \stdClass $std)
21+
{
22+
}
23+
}
24+
25+
?>

rules/Privatization/NodeManipulator/VisibilityManipulator.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,6 @@ private function removeVisibility(ClassMethod | Property | ClassConst | Param $n
171171
return;
172172
}
173173

174-
if ($node instanceof Param) {
175-
$node->flags = 0;
176-
return;
177-
}
178-
179174
if ($node->isPublic()) {
180175
$node->flags |= Modifiers::PUBLIC;
181176
$node->flags -= Modifiers::PUBLIC;

0 commit comments

Comments
 (0)