Skip to content

Commit 253088e

Browse files
committed
[DowngradePhp85] Handle implicit public on DowngradePropertyPromotionRector
1 parent 968f660 commit 253088e

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

rules-tests/DowngradePhp85/Rector/Class_/DowngradeFinalPropertyPromotionRector/Fixture/implicit_final_property_promotion.php renamed to rules-tests/DowngradePhp85/Rector/Class_/DowngradeFinalPropertyPromotionRector/Fixture/implicit_final_property_promotion.php.inc

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,20 @@ public function __construct(final string $foo)
77
{
88
}
99
}
10+
1011
?>
1112
-----
1213
<?php
1314
namespace Rector\Tests\DowngradeFinalPropertyPromotionRector\Rector\Class_\DowngradePropertyPromotionRector\Fixture;
1415

1516
class ImplicitFinalPropertyPromotion
1617
{
17-
public function __construct(
18-
/**
19-
* @final
20-
*/
21-
public string $foo
22-
)
18+
public function __construct(/**
19+
* @final
20+
*/
21+
public string $foo)
2322
{
2423
}
2524
}
25+
26+
?>

rules/DowngradePhp85/Rector/Class_/DowngradeFinalPropertyPromotionRector.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ public function refactor(Node $node): ?ClassMethod
9595
$hasChanged = true;
9696
$this->visibilityManipulator->makeNonFinal($param);
9797

98+
if (! $param->isPromoted()) {
99+
$this->visibilityManipulator->makePublic($param);
100+
}
101+
98102
$this->addPhpDocTag($param);
99103

100104
}

0 commit comments

Comments
 (0)