Skip to content

Commit c6ceb0c

Browse files
committed
meaningfully error in DeduplicateStamp if the Lock component is missing
1 parent cb08480 commit c6ceb0c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Symfony/Component/Messenger/Stamp/DeduplicateStamp.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\Messenger\Stamp;
1313

1414
use Symfony\Component\Lock\Key;
15+
use Symfony\Component\Messenger\Exception\LogicException;
1516

1617
final class DeduplicateStamp implements StampInterface
1718
{
@@ -22,6 +23,10 @@ public function __construct(
2223
private ?float $ttl = 300.0,
2324
private bool $onlyDeduplicateInQueue = false,
2425
) {
26+
if (!class_exists(Key::class)) {
27+
throw new LogicException(\sprintf('You cannot use the "%s" as the Lock component is not installed. Try running "composer require symfony/lock".', self::class));
28+
}
29+
2530
$this->key = new Key($key);
2631
}
2732

0 commit comments

Comments
 (0)