From d92919a51d530a7caf9e86322655eb3b2b5f74f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Poirier=20Th=C3=A9or=C3=AAt?= Date: Thu, 7 Dec 2023 14:55:46 -0500 Subject: [PATCH] [TesterBundle] php doc to strong type asserMessageMatch return value --- packages/tester-bundle/Messenger/TransportTester.php | 10 ++++++++-- .../Tests/Messenger/TransportTesterTest.php | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/tester-bundle/Messenger/TransportTester.php b/packages/tester-bundle/Messenger/TransportTester.php index e5216b469..a5e20c899 100644 --- a/packages/tester-bundle/Messenger/TransportTester.php +++ b/packages/tester-bundle/Messenger/TransportTester.php @@ -28,11 +28,17 @@ public function getTransport(): TransportInterface return $this->transport; } + /** + * @template T of object + * @param class-string $messageClass the name of the class + * + * @return array + */ public function assertMessageMatch( string $messageClass, ?Expression $expression = null, - $count = 1, - $message = '' + int $count = 1, + string $message = '' ): array { $messages = []; foreach ($this->transport->get() as $envelope) { diff --git a/packages/tester-bundle/Tests/Messenger/TransportTesterTest.php b/packages/tester-bundle/Tests/Messenger/TransportTesterTest.php index 255381881..1309ead22 100644 --- a/packages/tester-bundle/Tests/Messenger/TransportTesterTest.php +++ b/packages/tester-bundle/Tests/Messenger/TransportTesterTest.php @@ -45,6 +45,6 @@ public function testAssertMatchFailed(): void $this->expectException(ExpectationFailedException::class); - $this->transportTester->assertMessageMatch('test'); + $this->transportTester->assertMessageMatch(\Exception::class); } }