• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

nepada / message-bus / 4581487412

pending completion
4581487412

push

github

GitHub
Update spaze/phpstan-disallowed-calls requirement from 2.11.6 to 2.12.1 (#75)

303 of 315 relevant lines covered (96.19%)

0.96 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

85.71
/src/MessageBus/Middleware/PreventNestedHandlingMiddleware.php
1
<?php
2
declare(strict_types = 1);
3

4
namespace Nepada\MessageBus\Middleware;
5

6
use Symfony\Component\Messenger\Envelope;
7
use Symfony\Component\Messenger\Middleware\MiddlewareInterface;
8
use Symfony\Component\Messenger\Middleware\StackInterface;
9

10
/**
11
 * Do not allow nested handling of messages.
12
 */
13
class PreventNestedHandlingMiddleware implements MiddlewareInterface
14
{
15

16
    private bool $isHandling = false;
17

18
    public function handle(Envelope $envelope, StackInterface $stack): Envelope
1✔
19
    {
20
        if ($this->isHandling) {
1✔
21
            throw new AlreadyHandlingOtherMessageException('Already handling other message.');
1✔
22
        }
23

24
        $this->isHandling = true;
1✔
25

26
        try {
27
            return $stack->next()->handle($envelope, $stack);
1✔
28
        } finally {
×
29
            $this->isHandling = false;
1✔
30
        }
31
    }
32

33
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc