From 71b7a131edf84d5f11822b6938f3069a7b2e9cac Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Mon, 26 Jan 2026 22:13:27 +0700 Subject: [PATCH 1/2] [PHPUnit 12] Skip first class callable on CreateStubOverCreateMockArgRector --- .../Fixture/skip_first_class_callable.php.inc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 rules-tests/PHPUnit120/Rector/CallLike/CreateStubOverCreateMockArgRector/Fixture/skip_first_class_callable.php.inc diff --git a/rules-tests/PHPUnit120/Rector/CallLike/CreateStubOverCreateMockArgRector/Fixture/skip_first_class_callable.php.inc b/rules-tests/PHPUnit120/Rector/CallLike/CreateStubOverCreateMockArgRector/Fixture/skip_first_class_callable.php.inc new file mode 100644 index 00000000..44412a92 --- /dev/null +++ b/rules-tests/PHPUnit120/Rector/CallLike/CreateStubOverCreateMockArgRector/Fixture/skip_first_class_callable.php.inc @@ -0,0 +1,14 @@ + Date: Mon, 26 Jan 2026 22:14:46 +0700 Subject: [PATCH 2/2] fix --- .../Rector/CallLike/CreateStubOverCreateMockArgRector.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rules/PHPUnit120/Rector/CallLike/CreateStubOverCreateMockArgRector.php b/rules/PHPUnit120/Rector/CallLike/CreateStubOverCreateMockArgRector.php index 1aac6d07..bc120696 100644 --- a/rules/PHPUnit120/Rector/CallLike/CreateStubOverCreateMockArgRector.php +++ b/rules/PHPUnit120/Rector/CallLike/CreateStubOverCreateMockArgRector.php @@ -105,6 +105,10 @@ public function refactor(Node $node): MethodCall|StaticCall|New_|ArrayItem|null $hasChanges = false; + if ($node->isFirstClassCallable()) { + return null; + } + foreach ($node->getArgs() as $arg) { if (! $arg->value instanceof MethodCall) { continue;