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<T> $messageClass the name of the class + * + * @return array<T> + */ 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); } }