Skip to content

[CodeQuality] Simplify single-statement void callback in CallbackSingleAssertToSimplerRector#722

Merged
TomasVotruba merged 1 commit into
mainfrom
callback-single-stmt-void
Jul 13, 2026
Merged

[CodeQuality] Simplify single-statement void callback in CallbackSingleAssertToSimplerRector#722
TomasVotruba merged 1 commit into
mainfrom
callback-single-stmt-void

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Extends CallbackSingleAssertToSimplerRector to also simplify callbacks that hold a single assertSame() statement with no return true; (a void callback), not only the two-statement assertSame() + return true; shape.

 $this->mockModel->expects($this->once())
     ->method('queueWebhooksByType')
-    ->with($this->callback(function ($type): void {
-        $this->assertSame($type, 'some_value');
-    }));
+    ->with($this->equalTo('some_value'));

Multi-statement callbacks are still skipped.

@TomasVotruba TomasVotruba force-pushed the callback-single-stmt-void branch from 7b3a079 to 7095af8 Compare July 13, 2026 09:48
@TomasVotruba TomasVotruba merged commit 072d9b2 into main Jul 13, 2026
8 checks passed
@TomasVotruba TomasVotruba deleted the callback-single-stmt-void branch July 13, 2026 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant