File tree Expand file tree Collapse file tree 3 files changed +30
-1
lines changed
rules-tests/Php55/Rector/FuncCall/GetCalledClassToSelfClassRector/Fixture Expand file tree Collapse file tree 3 files changed +30
-1
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ die ('blocked ' );
4+
5+ function my_function () {
6+ // It seems like this call below can be any function,
7+ // so long as it returns something
8+ return implode (', ' , []);
9+ }
10+
11+ echo my_function ();
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ exit ('blocked ' );
4+
5+ function my_function () {
6+ // It seems like this call below can be any function,
7+ // so long as it returns something
8+ return implode (', ' , []);
9+ }
10+
11+ echo my_function ();
Original file line number Diff line number Diff line change 55namespace Rector \Core \PHPStan \NodeVisitor ;
66
77use PhpParser \Node ;
8+ use PhpParser \Node \Expr \Exit_ ;
89use PhpParser \Node \Stmt \ClassLike ;
910use PhpParser \Node \Stmt \Declare_ ;
11+ use PhpParser \Node \Stmt \Expression ;
1012use PhpParser \NodeVisitorAbstract ;
1113use PHPStan \Analyser \MutatingScope ;
1214use Rector \Core \Contract \PhpParser \Node \StmtsAwareInterface ;
@@ -41,7 +43,12 @@ public function enterNode(Node $node): ?Node
4143 );
4244
4345 foreach ($ node ->stmts as $ stmt ) {
44- if ($ stmt ->getAttribute (AttributeKey::IS_UNREACHABLE ) === true ) {
46+ if ($ stmt instanceof Expression && $ stmt ->expr instanceof Exit_) {
47+ $ isPassedUnreachableStmt = true ;
48+ continue ;
49+ }
50+
51+ if ($ stmt ->getAttribute (AttributeKey::IS_UNREACHABLE ) === true ) {
4552 $ isPassedUnreachableStmt = true ;
4653 continue ;
4754 }
You can’t perform that action at this time.
0 commit comments