File tree Expand file tree Collapse file tree 1 file changed +20
-13
lines changed Expand file tree Collapse file tree 1 file changed +20
-13
lines changed Original file line number Diff line number Diff line change @@ -41,19 +41,7 @@ public function getNodeTypes(): array
4141 public function refactor (Node $ node ): MethodCall |Identical |null
4242 {
4343 if ($ node instanceof Identical) {
44- if (! $ this ->valueResolver ->isNull ($ node ->right )) {
45- return null ;
46- }
47-
48- if ($ this ->isStmtsPropertyFetch ($ node ->left )) {
49- /** @var PropertyFetch $propertyFetch */
50- $ propertyFetch = $ node ->left ;
51-
52- $ node ->left = new MethodCall ($ propertyFetch ->var , 'getStmts ' );
53- $ node ->right = new Array_ ([]);
54-
55- return $ node ;
56- }
44+ return $ this ->refactorIdentical ($ node );
5745 }
5846
5947 if (! $ this ->isName ($ node ->name , 'stmts ' )) {
@@ -75,4 +63,23 @@ private function isStmtsPropertyFetch(Expr $expr): bool
7563
7664 return $ this ->isName ($ expr ->name , 'stmts ' );
7765 }
66+
67+ private function refactorIdentical (Identical $ node ): ?Identical
68+ {
69+ if (!$ this ->valueResolver ->isNull ($ node ->right )) {
70+ return null ;
71+ }
72+
73+ if ($ this ->isStmtsPropertyFetch ($ node ->left )) {
74+ /** @var PropertyFetch $propertyFetch */
75+ $ propertyFetch = $ node ->left ;
76+
77+ $ node ->left = new MethodCall ($ propertyFetch ->var , 'getStmts ' );
78+ $ node ->right = new Array_ ([]);
79+
80+ return $ node ;
81+ }
82+
83+ return null ;
84+ }
7885}
You can’t perform that action at this time.
0 commit comments