mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
rector fixes after rector's upgrade
This commit is contained in:
parent
e477a49c92
commit
2d82c1e105
@ -364,7 +364,7 @@ class StoredObject implements Document, TrackCreationInterface
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
return base_convert(bin2hex(random_bytes(32)), 16, 36);
|
return base_convert(bin2hex(random_bytes(32)), 16, 36);
|
||||||
} catch (RandomException $e) {
|
} catch (RandomException) {
|
||||||
return uniqid(more_entropy: true);
|
return uniqid(more_entropy: true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,9 +23,9 @@ use Doctrine\Persistence\ObjectRepository;
|
|||||||
*/
|
*/
|
||||||
class StoredObjectVersionRepository implements ObjectRepository
|
class StoredObjectVersionRepository implements ObjectRepository
|
||||||
{
|
{
|
||||||
private EntityRepository $repository;
|
private readonly EntityRepository $repository;
|
||||||
|
|
||||||
private Connection $connection;
|
private readonly Connection $connection;
|
||||||
|
|
||||||
public function __construct(EntityManagerInterface $entityManager)
|
public function __construct(EntityManagerInterface $entityManager)
|
||||||
{
|
{
|
||||||
|
@ -23,16 +23,16 @@ use Symfony\Component\Messenger\MessageBusInterface;
|
|||||||
* This cronjob is executed every 7days, to remove expired stored object. For every
|
* This cronjob is executed every 7days, to remove expired stored object. For every
|
||||||
* expired stored object, every version is sent to message bus for async deletion.
|
* expired stored object, every version is sent to message bus for async deletion.
|
||||||
*/
|
*/
|
||||||
final class RemoveExpiredStoredObjectCronJob implements CronJobInterface
|
final readonly class RemoveExpiredStoredObjectCronJob implements CronJobInterface
|
||||||
{
|
{
|
||||||
public const string KEY = 'remove-expired-stored-object';
|
public const string KEY = 'remove-expired-stored-object';
|
||||||
|
|
||||||
private const string LAST_DELETED_KEY = 'last-deleted-stored-object-id';
|
private const string LAST_DELETED_KEY = 'last-deleted-stored-object-id';
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly ClockInterface $clock,
|
private ClockInterface $clock,
|
||||||
private readonly MessageBusInterface $messageBus,
|
private MessageBusInterface $messageBus,
|
||||||
private readonly StoredObjectRepositoryInterface $storedObjectRepository
|
private StoredObjectRepositoryInterface $storedObjectRepository
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
public function canRun(?CronJobExecution $cronJobExecution): bool
|
public function canRun(?CronJobExecution $cronJobExecution): bool
|
||||||
|
@ -106,9 +106,7 @@ class RemoveExpiredStoredObjectCronJobTest extends TestCase
|
|||||||
false => $messageBus->method('dispatch'),
|
false => $messageBus->method('dispatch'),
|
||||||
};
|
};
|
||||||
|
|
||||||
$methodDispatch->willReturnCallback(function (RemoveOldVersionMessage $message) {
|
$methodDispatch->willReturnCallback(fn (RemoveOldVersionMessage $message) => new Envelope($message));
|
||||||
return new Envelope($message);
|
|
||||||
});
|
|
||||||
|
|
||||||
return $messageBus;
|
return $messageBus;
|
||||||
}
|
}
|
||||||
|
@ -95,9 +95,7 @@ class RemoveOldVersionCronJobTest extends KernelTestCase
|
|||||||
false => $messageBus->method('dispatch'),
|
false => $messageBus->method('dispatch'),
|
||||||
};
|
};
|
||||||
|
|
||||||
$methodDispatch->willReturnCallback(function (RemoveOldVersionMessage $message) {
|
$methodDispatch->willReturnCallback(fn (RemoveOldVersionMessage $message) => new Envelope($message));
|
||||||
return new Envelope($message);
|
|
||||||
});
|
|
||||||
|
|
||||||
return $messageBus;
|
return $messageBus;
|
||||||
}
|
}
|
||||||
|
@ -217,13 +217,11 @@ final class StoredObjectManagerTest extends TestCase
|
|||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('generate')
|
->method('generate')
|
||||||
->with($this->identicalTo('DELETE'), $this->identicalTo('object_name'))
|
->with($this->identicalTo('DELETE'), $this->identicalTo('object_name'))
|
||||||
->willReturnCallback(function (string $method, string $objectName) {
|
->willReturnCallback(fn (string $method, string $objectName) => new SignedUrl(
|
||||||
return new SignedUrl(
|
$method,
|
||||||
$method,
|
'https://example.com/'.$objectName,
|
||||||
'https://example.com/'.$objectName,
|
new \DateTimeImmutable('1 hours')
|
||||||
new \DateTimeImmutable('1 hours')
|
));
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
$storedObjectManager = new StoredObjectManager($httpClient, $tempUrlGenerator);
|
$storedObjectManager = new StoredObjectManager($httpClient, $tempUrlGenerator);
|
||||||
$storedObjectManager->delete($version);
|
$storedObjectManager->delete($version);
|
||||||
@ -276,14 +274,12 @@ final class StoredObjectManagerTest extends TestCase
|
|||||||
->expects($this->never())
|
->expects($this->never())
|
||||||
->method('generate')
|
->method('generate')
|
||||||
->with($this->identicalTo('HEAD'), $this->isType('string'))
|
->with($this->identicalTo('HEAD'), $this->isType('string'))
|
||||||
->willReturnCallback(function (string $method, string $objectName) {
|
->willReturnCallback(fn (string $method, string $objectName) => new SignedUrl(
|
||||||
return new SignedUrl(
|
$method,
|
||||||
$method,
|
'https://example.com/'.$objectName,
|
||||||
'https://example.com/'.$objectName,
|
new \DateTimeImmutable('1 hours'),
|
||||||
new \DateTimeImmutable('1 hours'),
|
$objectName
|
||||||
$objectName
|
));
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
$manager = new StoredObjectManager($client, $tempUrlGenerator);
|
$manager = new StoredObjectManager($client, $tempUrlGenerator);
|
||||||
|
|
||||||
@ -307,13 +303,11 @@ final class StoredObjectManagerTest extends TestCase
|
|||||||
->expects($this->atLeastOnce())
|
->expects($this->atLeastOnce())
|
||||||
->method('generate')
|
->method('generate')
|
||||||
->with($this->identicalTo('HEAD'), $this->isType('string'))
|
->with($this->identicalTo('HEAD'), $this->isType('string'))
|
||||||
->willReturnCallback(function (string $method, string $objectName) {
|
->willReturnCallback(fn (string $method, string $objectName) => new SignedUrl(
|
||||||
return new SignedUrl(
|
$method,
|
||||||
$method,
|
'https://example.com/'.$objectName,
|
||||||
'https://example.com/'.$objectName,
|
new \DateTimeImmutable('1 hours')
|
||||||
new \DateTimeImmutable('1 hours')
|
));
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
$manager = new StoredObjectManager($client, $tempUrlGenerator);
|
$manager = new StoredObjectManager($client, $tempUrlGenerator);
|
||||||
|
|
||||||
@ -368,14 +362,12 @@ final class StoredObjectManagerTest extends TestCase
|
|||||||
->expects($this->atLeastOnce())
|
->expects($this->atLeastOnce())
|
||||||
->method('generate')
|
->method('generate')
|
||||||
->with($this->logicalOr($this->identicalTo('GET'), $this->identicalTo('PUT')), $this->isType('string'))
|
->with($this->logicalOr($this->identicalTo('GET'), $this->identicalTo('PUT')), $this->isType('string'))
|
||||||
->willReturnCallback(function (string $method, string $objectName) {
|
->willReturnCallback(fn (string $method, string $objectName) => new SignedUrl(
|
||||||
return new SignedUrl(
|
$method,
|
||||||
$method,
|
'https://example.com/'.$objectName,
|
||||||
'https://example.com/'.$objectName,
|
new \DateTimeImmutable('1 hours'),
|
||||||
new \DateTimeImmutable('1 hours'),
|
$objectName
|
||||||
$objectName
|
));
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
return $tempUrlGenerator;
|
return $tempUrlGenerator;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user