44
55namespace Rector \Doctrine \TypedCollections \Rector \ClassMethod ;
66
7+ use PhpParser \Node \Stmt \Property ;
8+ use PhpParser \Node \Name ;
79use PhpParser \Node ;
810use PhpParser \Node \NullableType ;
911use PhpParser \Node \Stmt \ClassMethod ;
@@ -71,15 +73,15 @@ public function setItems(Collection $items): void
7173
7274 public function getNodeTypes (): array
7375 {
74- return [ClassMethod::class, Node \ Stmt \ Property::class];
76+ return [ClassMethod::class, Property::class];
7577 }
7678
7779 /**
78- * @param ClassMethod|Node\Stmt\ Property $node
80+ * @param ClassMethod|Property $node
7981 */
80- public function refactor (Node $ node ): ClassMethod |Node \ Stmt \ Property |null
82+ public function refactor (Node $ node ): ClassMethod |Property |null
8183 {
82- if ($ node instanceof Node \ Stmt \ Property) {
84+ if ($ node instanceof Property) {
8385 return $ this ->refactorProperty ($ node );
8486 }
8587
@@ -119,9 +121,9 @@ private function refactorClassMethod(ClassMethod $classMethod): null|ClassMethod
119121 return null ;
120122 }
121123
122- private function refactorProperty (Node \ Stmt \ Property $ node ): ?Node \ Stmt \ Property
124+ private function refactorProperty (Property $ property ): ?Property
123125 {
124- $ phpDocInfo = $ this ->phpDocInfoFactory ->createFromNode ($ node );
126+ $ phpDocInfo = $ this ->phpDocInfoFactory ->createFromNode ($ property );
125127 if (! $ phpDocInfo instanceof PhpDocInfo) {
126128 return null ;
127129 }
@@ -131,11 +133,11 @@ private function refactorProperty(Node\Stmt\Property $node): ?Node\Stmt\Property
131133 return null ;
132134 }
133135
134- if (! $ node ->type instanceof Node \ Name) {
136+ if (! $ property ->type instanceof Name) {
135137 return null ;
136138 }
137139
138- if (! $ this ->isName ($ node ->type , DoctrineClass::COLLECTION )) {
140+ if (! $ this ->isName ($ property ->type , DoctrineClass::COLLECTION )) {
139141 return null ;
140142 }
141143
@@ -150,8 +152,8 @@ private function refactorProperty(Node\Stmt\Property $node): ?Node\Stmt\Property
150152 $ phpDocInfo ->removeByType (VarTagValueNode::class);
151153 $ phpDocInfo ->addTagValueNode ($ varTagValueNode );
152154
153- $ this ->docBlockUpdater ->updateRefactoredNodeWithPhpDocInfo ($ node );
155+ $ this ->docBlockUpdater ->updateRefactoredNodeWithPhpDocInfo ($ property );
154156
155- return $ node ;
157+ return $ property ;
156158 }
157159}
0 commit comments