Updates to vendors etc

This commit is contained in:
Chris Hunt
2025-07-11 15:57:48 +01:00
parent d972cbcd0a
commit 8fb6438254
8043 changed files with 248005 additions and 189479 deletions

View File

@@ -11,6 +11,7 @@
namespace Symfony\Component\Console\Command;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Exception\LogicException;
use Symfony\Component\Lock\LockFactory;
use Symfony\Component\Lock\LockInterface;
@@ -26,6 +27,8 @@ trait LockableTrait
{
private ?LockInterface $lock = null;
private ?LockFactory $lockFactory = null;
/**
* Locks a command.
*/
@@ -39,13 +42,27 @@ trait LockableTrait
throw new LogicException('A lock is already in place.');
}
if (SemaphoreStore::isSupported()) {
$store = new SemaphoreStore();
} else {
$store = new FlockStore();
if (null === $this->lockFactory) {
if (SemaphoreStore::isSupported()) {
$store = new SemaphoreStore();
} else {
$store = new FlockStore();
}
$this->lockFactory = new LockFactory($store);
}
$this->lock = (new LockFactory($store))->createLock($name ?: $this->getName());
if (!$name) {
if ($this instanceof Command) {
$name = $this->getName();
} elseif ($attribute = (new \ReflectionClass($this::class))->getAttributes(AsCommand::class)) {
$name = $attribute[0]->newInstance()->name;
} else {
throw new LogicException(\sprintf('Lock name missing: provide it via "%s()", #[AsCommand] attribute, or by extending Command class.', __METHOD__));
}
}
$this->lock = $this->lockFactory->createLock($name);
if (!$this->lock->acquire($blocking)) {
$this->lock = null;