diff --git a/rules-tests/CodingStyle/Rector/FuncCall/ClosureFromCallableToFirstClassCallableRector/Fixture/supports_static_self_call.php.inc b/rules-tests/CodingStyle/Rector/FuncCall/ClosureFromCallableToFirstClassCallableRector/Fixture/supports_static_self_call.php.inc new file mode 100644 index 00000000000..45bd4313818 --- /dev/null +++ b/rules-tests/CodingStyle/Rector/FuncCall/ClosureFromCallableToFirstClassCallableRector/Fixture/supports_static_self_call.php.inc @@ -0,0 +1,31 @@ + +----- + diff --git a/rules/CodingStyle/Rector/FuncCall/ClosureFromCallableToFirstClassCallableRector.php b/rules/CodingStyle/Rector/FuncCall/ClosureFromCallableToFirstClassCallableRector.php index ea351a52d18..81300fb5181 100644 --- a/rules/CodingStyle/Rector/FuncCall/ClosureFromCallableToFirstClassCallableRector.php +++ b/rules/CodingStyle/Rector/FuncCall/ClosureFromCallableToFirstClassCallableRector.php @@ -97,7 +97,12 @@ public function refactor(Node $node): ?Node return null; } - $classNode = new FullyQualified($array->items[0]->value->class->name); + if ($array->items[0]->value->class instanceof FullyQualified) { + $classNode = new FullyQualified($array->items[0]->value->class->name); + } else { + $classNode = new Name($array->items[0]->value->class->name); + } + } elseif ($array->items[0]->value instanceof FullyQualified) { $classNode = new FullyQualified($array->items[0]->value->name); } else {