File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed
tests/Rector/Coalesce/ApplyDefaultInsteadOfNullCoalesceRector/Fixture Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change 8
8
use PhpParser \Node \Expr \FuncCall ;
9
9
use PhpParser \Node \Expr \MethodCall ;
10
10
use PhpParser \Node \Expr \StaticCall ;
11
+ use PhpParser \Node \Expr \Throw_ ;
11
12
use PHPStan \Type \ObjectType ;
12
13
use Rector \Contract \Rector \ConfigurableRectorInterface ;
13
14
use RectorLaravel \AbstractRector ;
@@ -107,12 +108,14 @@ public function refactor(Node $node): MethodCall|StaticCall|FuncCall|null
107
108
$ this ->isObjectType (
108
109
$ objectType ,
109
110
$ applyDefaultWith ->getObjectType ()) &&
110
- $ this ->isName ($ call ->name , $ applyDefaultWith ->getMethodName ())
111
+ $ this ->isName ($ call ->name , $ applyDefaultWith ->getMethodName ()) &&
112
+ ! $ node ->right instanceof Throw_
111
113
) {
112
114
$ valid = true ;
113
115
} elseif (
114
116
$ applyDefaultWith ->getObjectType () === null &&
115
- $ this ->isName ($ call ->name , $ applyDefaultWith ->getMethodName ())
117
+ $ this ->isName ($ call ->name , $ applyDefaultWith ->getMethodName ()) &&
118
+ ! $ node ->right instanceof Throw_
116
119
) {
117
120
$ valid = true ;
118
121
}
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace RectorLaravel \Tests \Rector \Coalesce \ApplyDefaultInsteadOfNullCoalesceRector \Fixture ;
4
+
5
+ config ('app.name ' ) ?? throw new \Exception ('No Google maps base URL configured. ' );
6
+
7
+ (new \Illuminate \Http \Request ())->input ('value ' ) ?? throw new \Exception ('No Google maps base URL configured. ' );
8
+
9
+ \Illuminate \Support \Env::get ('APP_NAME ' ) ?? throw new \Exception ('No Google maps base URL configured. ' );
10
+
11
+ ?>
You can’t perform that action at this time.
0 commit comments