Skip to content

Commit 2c3bcc6

Browse files
Merge branch '6.4' into 7.0
* 6.4: fix typo Add types to private and internal properties [Workflow] Cleaning code [Scheduler] Fix NPE in debug:scheduler command
2 parents a45db59 + 25d98e8 commit 2c3bcc6

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

Messenger/AbstractDoctrineMiddleware.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
*/
2626
abstract class AbstractDoctrineMiddleware implements MiddlewareInterface
2727
{
28-
protected $managerRegistry;
29-
protected $entityManagerName;
28+
protected ManagerRegistry $managerRegistry;
29+
protected ?string $entityManagerName;
3030

3131
public function __construct(ManagerRegistry $managerRegistry, string $entityManagerName = null)
3232
{

Messenger/DoctrineOpenTransactionLoggerMiddleware.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use Doctrine\ORM\EntityManagerInterface;
1515
use Doctrine\Persistence\ManagerRegistry;
1616
use Psr\Log\LoggerInterface;
17-
use Psr\Log\NullLogger;
1817
use Symfony\Component\Messenger\Envelope;
1918
use Symfony\Component\Messenger\Middleware\StackInterface;
2019

@@ -25,13 +24,13 @@
2524
*/
2625
class DoctrineOpenTransactionLoggerMiddleware extends AbstractDoctrineMiddleware
2726
{
28-
private $logger;
27+
private ?LoggerInterface $logger;
2928

3029
public function __construct(ManagerRegistry $managerRegistry, string $entityManagerName = null, LoggerInterface $logger = null)
3130
{
3231
parent::__construct($managerRegistry, $entityManagerName);
3332

34-
$this->logger = $logger ?? new NullLogger();
33+
$this->logger = $logger;
3534
}
3635

3736
protected function handleForManager(EntityManagerInterface $entityManager, Envelope $envelope, StackInterface $stack): Envelope
@@ -40,7 +39,7 @@ protected function handleForManager(EntityManagerInterface $entityManager, Envel
4039
return $stack->next()->handle($envelope, $stack);
4140
} finally {
4241
if ($entityManager->getConnection()->isTransactionActive()) {
43-
$this->logger->error('A handler opened a transaction but did not close it.', [
42+
$this->logger?->error('A handler opened a transaction but did not close it.', [
4443
'message' => $envelope->getMessage(),
4544
]);
4645
}

0 commit comments

Comments
 (0)