Skip to content

Commit 410a14f

Browse files
authored
[DowngradePhp85] Handle implicit public on DowngradeFinalPropertyPromotionRector (#324)
* [DowngradePhp85] Handle implicit public on DowngradePropertyPromotionRector * namespace chagne
1 parent 968f660 commit 410a14f

File tree

5 files changed

+35
-28
lines changed

5 files changed

+35
-28
lines changed

rules-tests/DowngradePhp85/Rector/Class_/DowngradeFinalPropertyPromotionRector/Fixture/fixture.php.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Rector\Tests\DowngradeFinalPropertyPromotionRector\Rector\Class_\DowngradePropertyPromotionRector\Fixture;
3+
namespace Rector\Tests\DowngradePhp85\Rector\Class_\DowngradeFinalPropertyPromotionRector\Fixture;
44

55
class Fixture
66
{
@@ -13,7 +13,7 @@ class Fixture
1313
-----
1414
<?php
1515

16-
namespace Rector\Tests\DowngradeFinalPropertyPromotionRector\Rector\Class_\DowngradePropertyPromotionRector\Fixture;
16+
namespace Rector\Tests\DowngradePhp85\Rector\Class_\DowngradeFinalPropertyPromotionRector\Fixture;
1717

1818
class Fixture
1919
{

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

Lines changed: 0 additions & 25 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
namespace Rector\Tests\DowngradePhp85\Rector\Class_\DowngradeFinalPropertyPromotionRector\Fixture;
4+
5+
class ImplicitFinalPropertyPromotion
6+
{
7+
public function __construct(final string $foo)
8+
{
9+
}
10+
}
11+
12+
?>
13+
-----
14+
<?php
15+
16+
namespace Rector\Tests\DowngradePhp85\Rector\Class_\DowngradeFinalPropertyPromotionRector\Fixture;
17+
18+
class ImplicitFinalPropertyPromotion
19+
{
20+
public function __construct(/**
21+
* @final
22+
*/
23+
public string $foo)
24+
{
25+
}
26+
}
27+
28+
?>

rules-tests/DowngradePhp85/Rector/Class_/DowngradeFinalPropertyPromotionRector/Fixture/skip_fixture_readonly.php.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Rector\Tests\DowngradeFinalPropertyPromotionRector\Rector\Class_\DowngradePropertyPromotionRector\Fixture;
3+
namespace Rector\Tests\DowngradePhp85\Rector\Class_\DowngradeFinalPropertyPromotionRector\Fixture;
44

55
class SkipFixtureReadonly
66
{

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)