File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed
rules/CodeQuality/Rector/Class_ Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change 1313use Rector \PHPUnit \NodeAnalyzer \TestsNodeAnalyzer ;
1414use Rector \Rector \AbstractRector ;
1515use Rector \StaticTypeMapper \StaticTypeMapper ;
16- use Rector \TypeDeclaration \TypeInferer \ SilentVoidResolver ;
16+ use Rector \TypeDeclaration \NodeAnalyzer \ ReturnAnalyzer ;
1717use Symplify \RuleDocGenerator \ValueObject \CodeSample \CodeSample ;
1818use Symplify \RuleDocGenerator \ValueObject \RuleDefinition ;
1919
@@ -24,7 +24,7 @@ final class AddReturnTypeToDependedRector extends AbstractRector
2424{
2525 public function __construct (
2626 private readonly TestsNodeAnalyzer $ testsNodeAnalyzer ,
27- private readonly SilentVoidResolver $ silentVoidResolver ,
27+ private readonly ReturnAnalyzer $ returnAnalyzer ,
2828 private readonly StaticTypeMapper $ staticTypeMapper ,
2929 private readonly BetterNodeFinder $ betterNodeFinder
3030 ) {
@@ -106,11 +106,10 @@ public function refactor(Node $node): ?Node
106106 continue ;
107107 }
108108
109- if ($ this ->silentVoidResolver ->hasSilentVoid ($ classMethod )) {
110- continue ;
111- }
112-
113109 $ returns = $ this ->betterNodeFinder ->findReturnsScoped ($ classMethod );
110+ if (! $ this ->returnAnalyzer ->hasOnlyReturnWithExpr ($ classMethod , $ returns )) {
111+ return null ;
112+ }
114113 if (count ($ returns ) !== 1 ) {
115114 continue ;
116115 }
You can’t perform that action at this time.
0 commit comments