File tree Expand file tree Collapse file tree
rules/CodeQuality/Rector/FuncCall Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1919use PhpParser \Node \Expr \StaticCall ;
2020use PhpParser \Node \Expr \Variable ;
2121use PhpParser \Node \Name \FullyQualified ;
22+ use PhpParser \Node \Stmt \ClassMethod ;
2223use PhpParser \NodeVisitor ;
2324use PHPStan \Reflection \ClassReflection ;
2425use Rector \PhpParser \Node \Value \ValueResolver ;
@@ -78,15 +79,23 @@ public function test()
7879 */
7980 public function getNodeTypes (): array
8081 {
81- return [Closure::class, FuncCall::class];
82+ return [ClassMethod::class, Closure::class, FuncCall::class];
8283 }
8384
8485 /**
85- * @param Closure|FuncCall $node
86+ * @param ClassMethod| Closure|FuncCall $node
8687 * @return StaticCall|MethodCall|null|NodeVisitor::DONT_TRAVERSE_CHILDREN
8788 */
8889 public function refactor (Node $ node ): StaticCall |MethodCall |null |int
8990 {
91+ if ($ node instanceof ClassMethod) {
92+ if ($ node ->isStatic ()) {
93+ return NodeVisitor::DONT_TRAVERSE_CHILDREN ;
94+ }
95+
96+ return null ;
97+ }
98+
9099 if ($ node instanceof Closure) {
91100 if ($ node ->static ) {
92101 return NodeVisitor::DONT_TRAVERSE_CHILDREN ;
You can’t perform that action at this time.
0 commit comments