File tree Expand file tree Collapse file tree 1 file changed +24
-6
lines changed Expand file tree Collapse file tree 1 file changed +24
-6
lines changed Original file line number Diff line number Diff line change @@ -85,12 +85,30 @@ public function getNode(): Node
8585 {
8686 $ arguments = [
8787 new Node \Arg (
88- value: new Node \Expr \New_ (
89- class: new Node \Name \FullyQualified ('SplFileObject ' ),
90- args: [
91- new Node \Arg ($ this ->filePath ),
92- new Node \Arg (new Node \Scalar \String_ ('r ' )),
93- ],
88+ value: new Node \Expr \Ternary (
89+ cond: new Node \Expr \FuncCall (
90+ name: new Node \Name ('file_exists ' ),
91+ args: [
92+ new Node \Arg (
93+ value: new Node \Expr \Assign (
94+ var: new Node \Expr \Variable ('file ' ),
95+ expr: $ this ->filePath ,
96+ )
97+ ),
98+ ],
99+ ),
100+ if: new Node \Expr \New_ (
101+ class: new Node \Name \FullyQualified ('SplFileObject ' ),
102+ args: [
103+ new Node \Arg (
104+ value: new Node \Expr \Variable ('file ' ),
105+ ),
106+ new Node \Arg (new Node \Scalar \String_ ('r ' )),
107+ ],
108+ ),
109+ else: new Node \Expr \New_ (
110+ class: new Node \Name \FullyQualified ('SplTempFileObject ' ),
111+ ),
94112 ),
95113 name: new Node \Identifier ('file ' ),
96114 ),
You can’t perform that action at this time.
0 commit comments