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

nepada / message-bus-doctrine / 8509392190

01 Apr 2024 02:33PM UTC coverage: 98.214%. Remained the same
8509392190

Pull #108

github

web-flow
Update php-parallel-lint/php-parallel-lint requirement

Updates the requirements on [php-parallel-lint/php-parallel-lint](https://github.com/php-parallel-lint/PHP-Parallel-Lint) to permit the latest version.
- [Release notes](https://github.com/php-parallel-lint/PHP-Parallel-Lint/releases)
- [Changelog](https://github.com/php-parallel-lint/PHP-Parallel-Lint/blob/v1.4.0/CHANGELOG.md)
- [Commits](https://github.com/php-parallel-lint/PHP-Parallel-Lint/compare/v1.3.2...v1.4.0)

---
updated-dependencies:
- dependency-name: php-parallel-lint/php-parallel-lint
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Pull Request #108: Update php-parallel-lint/php-parallel-lint requirement from 1.3.2 to 1.4.0

55 of 56 relevant lines covered (98.21%)

0.98 hits per line

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

91.67
/src/MessageBusDoctrine/Middleware/PreventOuterTransactionMiddleware.php
1
<?php
2
declare(strict_types = 1);
3

4
namespace Nepada\MessageBusDoctrine\Middleware;
5

6
use Doctrine\ORM\EntityManagerInterface;
7
use Symfony\Component\Messenger\Envelope;
8
use Symfony\Component\Messenger\Middleware\MiddlewareInterface;
9
use Symfony\Component\Messenger\Middleware\StackInterface;
10

11
class PreventOuterTransactionMiddleware implements MiddlewareInterface
12
{
13

14
    private EntityManagerInterface $entityManager;
15

16
    private bool $isHandlingRootMessage = false;
17

18
    public function __construct(EntityManagerInterface $entityManager)
1✔
19
    {
20
        $this->entityManager = $entityManager;
1✔
21
    }
1✔
22

23
    public function handle(Envelope $envelope, StackInterface $stack): Envelope
1✔
24
    {
25
        if ($this->isHandlingRootMessage) {
1✔
26
            return $stack->next()->handle($envelope, $stack);
1✔
27
        }
28

29
        if ($this->entityManager->getConnection()->isTransactionActive()) {
1✔
30
            throw new \LogicException('Database transaction was already started.');
1✔
31
        }
32

33
        try {
34
            $this->isHandlingRootMessage = true;
1✔
35
            return $stack->next()->handle($envelope, $stack);
1✔
36
        } finally {
×
37
            $this->isHandlingRootMessage = false;
1✔
38
        }
39
    }
40

41
}
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