File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
rules/Unambiguous/Rector/Expression Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change 44
55namespace Rector \Unambiguous \Rector \Expression ;
66
7+ use PhpParser \Node \Stmt \Return_ ;
78use PhpParser \Node ;
89use PhpParser \Node \Expr ;
910use PhpParser \Node \Expr \Assign ;
@@ -67,15 +68,15 @@ public function run()
6768 }
6869
6970 /**
70- * @return array<class-string<\PhpParser\ Node>>
71+ * @return array<class-string<Node>>
7172 */
7273 public function getNodeTypes (): array
7374 {
74- return [Expression::class, Node \ Stmt \ Return_::class];
75+ return [Expression::class, Return_::class];
7576 }
7677
7778 /**
78- * @param Expression|Node\Stmt\ Return_ $node
79+ * @param Expression|Return_ $node
7980 */
8081 public function refactor (Node $ node ): ?array
8182 {
@@ -126,10 +127,11 @@ public function refactor(Node $node): ?array
126127
127128 private function resolveVariableName (Expr $ expr ): string
128129 {
129- if ($ expr instanceof New_) {
130- if ($ expr ->class instanceof Name) {
131- return $ this ->propertyNaming ->fqnToVariableName ($ expr ->class );
132- }
130+ if (!$ expr instanceof New_) {
131+ return 'someVariable ' ;
132+ }
133+ if ($ expr ->class instanceof Name) {
134+ return $ this ->propertyNaming ->fqnToVariableName ($ expr ->class );
133135 }
134136
135137 return 'someVariable ' ;
You can’t perform that action at this time.
0 commit comments