File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed
rules/DowngradePhp74/Rector/ArrowFunction Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change 1111use PhpParser \Node \Expr \Assign ;
1212use PhpParser \Node \Expr \Closure ;
1313use PhpParser \Node \Expr \Variable ;
14+ use PhpParser \Node \Stmt \Expression ;
1415use PhpParser \Node \Stmt \Return_ ;
1516use PhpParser \Node \Stmt \Throw_ ;
1617use PHPStan \Analyser \Scope ;
@@ -102,7 +103,7 @@ public function refactor(Node $node): Closure
102103 }
103104
104105 // downgrade "return throw"
105- $ this ->traverseNodesWithCallable ($ anonymousFunctionFactory , static function (Node $ node ): ?Throw_ {
106+ $ this ->traverseNodesWithCallable ($ anonymousFunctionFactory , static function (Node $ node ): ?Expression {
106107 if (! $ node instanceof Return_) {
107108 return null ;
108109 }
@@ -111,10 +112,8 @@ public function refactor(Node $node): Closure
111112 return null ;
112113 }
113114
114- $ throw = $ node ->expr ;
115-
116115 // throw expr to throw stmts
117- return new Throw_ ( $ throw ->expr );
116+ return new Expression ( $ node ->expr );
118117 });
119118
120119 $ this ->appendUsesFromInsertedVariable ($ node ->expr , $ anonymousFunctionFactory );
You can’t perform that action at this time.
0 commit comments