Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Messenger] Cleaning after new changes #29100

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 6, 2018
Merged
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
2 changes: 1 addition & 1 deletion src/Symfony/Component/Messenger/Command/DebugCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function __construct(array $mapping)
protected function configure()
{
$this
->addArgument('bus', InputArgument::OPTIONAL, sprintf('The bus id (one of %s)', implode(', ', array_keys($this->mapping))), null)
->addArgument('bus', InputArgument::OPTIONAL, sprintf('The bus id (one of %s)', implode(', ', array_keys($this->mapping))))
->setDescription('Lists messages you can dispatch using the message buses')
->setHelp(<<<'EOF'
The <info>%command.name%</info> command displays all messages that can be
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
use Symfony\Component\DependencyInjection\ChildDefinition;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\Compiler\PriorityTaggedServiceTrait;
use Symfony\Component\DependencyInjection\Compiler\ServiceLocatorTagPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
Expand All @@ -33,8 +32,6 @@
*/
class MessengerPass implements CompilerPassInterface
{
use PriorityTaggedServiceTrait;

private $handlerTag;
private $busTag;
private $receiverTag;
Expand Down Expand Up @@ -282,7 +279,7 @@ private function registerBusMiddleware(ContainerBuilder $container, string $busI
throw new RuntimeException(sprintf('Invalid middleware: service "%s" not found.', $id));
}

if (($definition = $container->findDefinition($messengerMiddlewareId))->isAbstract()) {
if ($container->findDefinition($messengerMiddlewareId)->isAbstract()) {
$childDefinition = new ChildDefinition($messengerMiddlewareId);
$childDefinition->setArguments($arguments);
$container->setDefinition($messengerMiddlewareId = $busId.'.middleware.'.$id, $childDefinition);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function next(): MiddlewareInterface
return $nextMiddleware;
}

public function stop()
public function stop(): void
{
if (null !== $this->currentEvent && $this->stopwatch->isStarted($this->currentEvent)) {
$this->stopwatch->stop($this->currentEvent);
Expand Down
1 change: 0 additions & 1 deletion src/Symfony/Component/Messenger/Tests/MessageBusTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public function testItCallsMiddleware()
{
$message = new DummyMessage('Hello');
$envelope = new Envelope($message);
$responseFromDepthMiddleware = 1234;

$firstMiddleware = $this->getMockBuilder(MiddlewareInterface::class)->getMock();
$firstMiddleware->expects($this->once())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function testItTracesDispatch()

$traceableBus = new TraceableMessageBus($bus);
$line = __LINE__ + 1;
$this->assertInstanceOf(Envelope::class, $traceableBus->dispatch($message));
$traceableBus->dispatch($message);
$this->assertCount(1, $tracedMessages = $traceableBus->getDispatchedMessages());
$this->assertArraySubset(array(
'message' => $message,
Expand All @@ -52,7 +52,7 @@ public function testItTracesDispatchWithEnvelope()

$traceableBus = new TraceableMessageBus($bus);
$line = __LINE__ + 1;
$this->assertInstanceOf(Envelope::class, $traceableBus->dispatch($envelope));
$traceableBus->dispatch($envelope);
$this->assertCount(1, $tracedMessages = $traceableBus->getDispatchedMessages());
$this->assertArraySubset(array(
'message' => $message,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function testItSendsAndReceivesMessages()

$receivedMessages = 0;
$receiver->receive(function (?Envelope $envelope) use ($receiver, &$receivedMessages, $first, $second) {
$this->assertEquals(0 == $receivedMessages ? $first : $second, $envelope);
$this->assertEquals(0 === $receivedMessages ? $first : $second, $envelope);

if (2 === ++$receivedMessages) {
$receiver->stop();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ public function testItReturnsTheSenderBasedOnTheMessageClass()
));

$this->assertSame(array($sender), iterator_to_array($locator->getSenders(new Envelope(new DummyMessage('a')))));
$this->assertSame(array(), iterator_to_array($locator->getSenders(new Envelope(new SecondMessage('b')))));
$this->assertSame(array(), iterator_to_array($locator->getSenders(new Envelope(new SecondMessage()))));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function encode(Envelope $envelope): array
);
}

private function decodeStamps($encodedEnvelope)
private function decodeStamps(array $encodedEnvelope): array
{
$stamps = array();
foreach ($encodedEnvelope['headers'] as $name => $value) {
Expand All @@ -113,7 +113,7 @@ private function decodeStamps($encodedEnvelope)
return $stamps;
}

private function encodeStamps(Envelope $envelope)
private function encodeStamps(Envelope $envelope): array
{
if (!$stamps = $envelope->all()) {
return array();
Expand Down