Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions extension.neon
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ parameters:
- stubs/Symfony/Component/HttpFoundation/Session.stub
- stubs/Symfony/Component/Messenger/StampInterface.stub
- stubs/Symfony/Component/Messenger/Envelope.stub
- stubs/Symfony/Component/Messenger/TraceableMessageBus.stub
- stubs/Symfony/Component/OptionsResolver/Exception/InvalidOptionsException.stub
- stubs/Symfony/Component/OptionsResolver/Options.stub
- stubs/Symfony/Component/Process/Exception/LogicException.stub
Expand Down
24 changes: 24 additions & 0 deletions stubs/Symfony/Component/Messenger/TraceableMessageBus.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

namespace Symfony\Component\Messenger;

use Symfony\Component\Messenger\Stamp\StampInterface;

class TraceableMessageBus
{

/**
* @return list<array{
* stamps: list<StampInterface>,
* message: object,
* caller: array{name: string, file: string|null, line: int|null},
* callTime: float,
* exception?: \Throwable,
* stamps_after_dispatch: list<StampInterface>,
* }>
*/
public function getDispatchedMessages(): array
{
}

}
2 changes: 2 additions & 0 deletions tests/Type/Symfony/ExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ public function dataFileAsserts(): iterable
}

yield from $this->gatherAssertTypes(__DIR__ . '/data/envelope_all.php');
yield from $this->gatherAssertTypes(__DIR__ . '/data/traceable_message_bus.php');

yield from $this->gatherAssertTypes(__DIR__ . '/data/header_bag_get.php');
yield from $this->gatherAssertTypes(__DIR__ . '/data/response_header_bag_get_cookies.php');

Expand Down
14 changes: 14 additions & 0 deletions tests/Type/Symfony/data/traceable_message_bus.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php declare(strict_types = 1);

use Symfony\Component\Messenger\TraceableMessageBus;
use function PHPStan\Testing\assertType;

$bus = new TraceableMessageBus(new class implements \Symfony\Component\Messenger\MessageBusInterface {
public function dispatch(object $message, array $stamps = []): \Symfony\Component\Messenger\Envelope
{
return new \Symfony\Component\Messenger\Envelope($message);
}
});

$messages = $bus->getDispatchedMessages();
assertType('list<array{stamps: list<Symfony\Component\Messenger\Stamp\StampInterface>, message: object, caller: array{name: string, file: string|null, line: int|null}, callTime: float, exception?: Throwable, stamps_after_dispatch: list<Symfony\Component\Messenger\Stamp\StampInterface>}>', $messages);