-
-
Notifications
You must be signed in to change notification settings - Fork 337
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Php82] Handle parent already readonly on ReadOnlyClassRector (#3199)
- Loading branch information
1 parent
c21cafa
commit be3bdd0
Showing
3 changed files
with
91 additions
and
21 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
...2/Rector/Class_/ReadOnlyClassRector/Fixture/child_extends_parent_already_readonly.php.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Php82\Rector\Class_\ReadOnlyClassRector\Fixture; | ||
|
||
use Rector\Tests\Php82\Rector\Class_\ReadOnlyClassRector\Source\ParentAlreadyReadonly; | ||
|
||
/** | ||
* Even class is not final, if extends class that already readonly, it must be readonly as well | ||
*/ | ||
class ChildExtendsParentAlreadyReadonly extends ParentAlreadyReadonly | ||
{ | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\Php82\Rector\Class_\ReadOnlyClassRector\Fixture; | ||
|
||
use Rector\Tests\Php82\Rector\Class_\ReadOnlyClassRector\Source\ParentAlreadyReadonly; | ||
|
||
/** | ||
* Even class is not final, if extends class that already readonly, it must be readonly as well | ||
*/ | ||
readonly class ChildExtendsParentAlreadyReadonly extends ParentAlreadyReadonly | ||
{ | ||
} | ||
|
||
?> |
7 changes: 7 additions & 0 deletions
7
rules-tests/Php82/Rector/Class_/ReadOnlyClassRector/Source/ParentAlreadyReadonly.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Php82\Rector\Class_\ReadOnlyClassRector\Source; | ||
|
||
readonly abstract class ParentAlreadyReadonly | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters