File tree Expand file tree Collapse file tree 3 files changed +10
-21
lines changed
DowngradePhp81/Rector/Property
DowngradePhp85/Rector/Class_
tests/Issues/DowngradeReadonlyClassPropertyToPhp80/Fixture Expand file tree Collapse file tree 3 files changed +10
-21
lines changed Original file line number Diff line number Diff line change @@ -102,17 +102,13 @@ public function refactor(Node $node): ?Node
102102 return null ;
103103 }
104104
105- $ hasChangedDoc = false ;
106105 $ hasChanged = false ;
107106 foreach ($ node ->params as $ param ) {
108107 if (! $ this ->visibilityManipulator ->isReadonly ($ param )) {
109108 continue ;
110109 }
111110
112- if ($ this ->addPhpDocTag ($ param )) {
113- $ hasChangedDoc = true ;
114- }
115-
111+ $ this ->addPhpDocTag ($ param );
116112 $ this ->visibilityManipulator ->removeReadonly ($ param );
117113 $ hasChanged = true ;
118114 }
@@ -121,23 +117,18 @@ public function refactor(Node $node): ?Node
121117 return null ;
122118 }
123119
124- if ($ hasChangedDoc ) {
125- $ node ->setAttribute (AttributeKey::ORIGINAL_NODE , null );
126- }
127-
128120 return $ node ;
129121 }
130122
131- private function addPhpDocTag (Property |Param $ node ): bool
123+ private function addPhpDocTag (Property |Param $ node ): void
132124 {
133125 $ phpDocInfo = $ this ->phpDocInfoFactory ->createFromNodeOrEmpty ($ node );
134126
135127 if ($ phpDocInfo ->hasByName (self ::TAGNAME )) {
136- return false ;
128+ return ;
137129 }
138130
139131 $ phpDocInfo ->addPhpDocTagNode (new PhpDocTagNode ('@ ' . self ::TAGNAME , new GenericTagValueNode ('' )));
140132 $ this ->docBlockUpdater ->updateRefactoredNodeWithPhpDocInfo ($ node );
141- return true ;
142133 }
143134}
Original file line number Diff line number Diff line change @@ -110,16 +110,16 @@ public function refactor(Node $node): ?ClassMethod
110110 return null ;
111111 }
112112
113- private function addPhpDocTag (Property |Param $ node ): bool
113+ private function addPhpDocTag (Property |Param $ node ): void
114114 {
115115 $ phpDocInfo = $ this ->phpDocInfoFactory ->createFromNodeOrEmpty ($ node );
116116
117117 if ($ phpDocInfo ->hasByName (self ::TAGNAME )) {
118- return false ;
118+ return ;
119119 }
120120
121121 $ phpDocInfo ->addPhpDocTagNode (new PhpDocTagNode ('@ ' . self ::TAGNAME , new GenericTagValueNode ('' )));
122122 $ this ->docBlockUpdater ->updateRefactoredNodeWithPhpDocInfo ($ node );
123- return true ;
123+ return ;
124124 }
125125}
Original file line number Diff line number Diff line change @@ -17,12 +17,10 @@ namespace Rector\Tests\Issues\DowngradeReadonlyClassPropertyToPhp80\Fixture;
1717
1818final class Fixture
1919{
20- public function __construct (
21- /**
22- * @readonly
23- */
24- public array $ property
25- )
20+ public function __construct (/**
21+ * @readonly
22+ */
23+ public array $ property )
2624 {
2725 }
2826}
You can’t perform that action at this time.
0 commit comments