File tree Expand file tree Collapse file tree
rules/TypedCollections/Rector/ClassMethod Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -119,7 +119,7 @@ private function refactorReturnDocblockTag(ClassMethod $classMethod): bool
119119
120120 private function hasNativeCollectionType (ClassMethod $ classMethod ): bool
121121 {
122- if (! $ classMethod ->returnType ) {
122+ if (!$ classMethod ->returnType instanceof Node ) {
123123 return false ;
124124 }
125125
@@ -128,7 +128,7 @@ private function hasNativeCollectionType(ClassMethod $classMethod): bool
128128
129129 private function refactorNativeReturn (ClassMethod $ classMethod ): bool
130130 {
131- if ($ classMethod ->returnType === null ) {
131+ if (! $ classMethod ->returnType instanceof Node ) {
132132 return false ;
133133 }
134134
@@ -157,11 +157,7 @@ private function refactorNativeReturn(ClassMethod $classMethod): bool
157157 }
158158 }
159159
160- if (count ($ unionType ->types ) === 1 ) {
161- $ classMethod ->returnType = array_pop ($ unionType ->types );
162- } else {
163- $ classMethod ->returnType = $ unionType ->types ;
164- }
160+ $ classMethod ->returnType = count ($ unionType ->types ) === 1 ? array_pop ($ unionType ->types ) : $ unionType ->types ;
165161
166162 return true ;
167163 }
You can’t perform that action at this time.
0 commit comments