Update to Symfony 7

This commit is contained in:
Alejandro Celaya 2024-02-17 10:46:29 +01:00
parent c0a77b790d
commit 95ea64980b
25 changed files with 35 additions and 34 deletions

View File

@ -17,6 +17,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and this
* [#1909](https://github.com/shlinkio/shlink/issues/1909) Update docker image to PHP 8.3.
* [#1786](https://github.com/shlinkio/shlink/issues/1786) Run API tests with RoadRunner by default.
* [#2008](https://github.com/shlinkio/shlink/issues/2008) Update to Doctrine ORM 3.0.
* [#2010](https://github.com/shlinkio/shlink/issues/2010) Update to Symfony 7.0 components.
### Deprecated
* *Nothing*

View File

@ -45,19 +45,19 @@
"shlinkio/shlink-common": "dev-main#178b332 as 6.0",
"shlinkio/shlink-config": "dev-main#6b287b3 as 2.6",
"shlinkio/shlink-event-dispatcher": "dev-main#46f5e21 as 4.0",
"shlinkio/shlink-importer": "^5.2.1",
"shlinkio/shlink-importer": "dev-main#f0a1f1d as 5.3",
"shlinkio/shlink-installer": "dev-develop#2dee7db as 9.0",
"shlinkio/shlink-ip-geolocation": "^3.4",
"shlinkio/shlink-ip-geolocation": "dev-main#c123a52 as 3.5",
"shlinkio/shlink-json": "^1.1",
"spiral/roadrunner": "^2023.3",
"spiral/roadrunner-cli": "^2.6",
"spiral/roadrunner-http": "^3.3",
"spiral/roadrunner-jobs": "^4.3",
"symfony/console": "^6.4",
"symfony/filesystem": "^6.4",
"symfony/lock": "^6.4",
"symfony/process": "^6.4",
"symfony/string": "^6.4"
"symfony/console": "^7.0",
"symfony/filesystem": "^7.0",
"symfony/lock": "^7.0",
"symfony/process": "^7.0",
"symfony/string": "^7.0"
},
"require-dev": {
"devizzent/cebe-php-openapi": "^1.0.1",
@ -72,7 +72,7 @@
"roave/security-advisories": "dev-master",
"shlinkio/php-coding-standard": "~2.3.0",
"shlinkio/shlink-test-utils": "^3.11",
"symfony/var-dumper": "^6.4",
"symfony/var-dumper": "^7.0",
"veewee/composer-run-parallel": "^1.3"
},
"conflict": {

View File

@ -31,7 +31,7 @@ class DisableKeyCommand extends Command
->addArgument('apiKey', InputArgument::REQUIRED, 'The API key to disable');
}
protected function execute(InputInterface $input, OutputInterface $output): ?int
protected function execute(InputInterface $input, OutputInterface $output): int
{
$apiKey = $input->getArgument('apiKey');
$io = new SymfonyStyle($input, $output);

View File

@ -98,7 +98,7 @@ class GenerateKeyCommand extends Command
->setHelp($help);
}
protected function execute(InputInterface $input, OutputInterface $output): ?int
protected function execute(InputInterface $input, OutputInterface $output): int
{
$expirationDate = $input->getOption('expiration-date');

View File

@ -29,7 +29,7 @@ class InitialApiKeyCommand extends Command
->addArgument('apiKey', InputArgument::REQUIRED, 'The initial API to create');
}
protected function execute(InputInterface $input, OutputInterface $output): ?int
protected function execute(InputInterface $input, OutputInterface $output): int
{
$key = $input->getArgument('apiKey');
$result = $this->apiKeyService->createInitial($key);

View File

@ -45,7 +45,7 @@ class ListKeysCommand extends Command
);
}
protected function execute(InputInterface $input, OutputInterface $output): ?int
protected function execute(InputInterface $input, OutputInterface $output): int
{
$enabledOnly = $input->getOption('enabled-only');

View File

@ -68,7 +68,7 @@ class DomainRedirectsCommand extends Command
$input->setArgument('domain', str_contains($selectedOption, 'New domain') ? $askNewDomain() : $selectedOption);
}
protected function execute(InputInterface $input, OutputInterface $output): ?int
protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);
$domainAuthority = $input->getArgument('domain');

View File

@ -38,7 +38,7 @@ class ListDomainsCommand extends Command
);
}
protected function execute(InputInterface $input, OutputInterface $output): ?int
protected function execute(InputInterface $input, OutputInterface $output): int
{
$domains = $this->domainService->listDomains();
$showRedirects = $input->getOption('show-redirects');

View File

@ -134,7 +134,7 @@ class CreateShortUrlCommand extends Command
}
}
protected function execute(InputInterface $input, OutputInterface $output): ?int
protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = $this->getIO($input, $output);
$longUrl = $input->getArgument('longUrl');

View File

@ -47,7 +47,7 @@ class DeleteShortUrlCommand extends Command
);
}
protected function execute(InputInterface $input, OutputInterface $output): ?int
protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);
$identifier = ShortUrlIdentifier::fromCli($input);

View File

@ -43,7 +43,7 @@ class DeleteShortUrlVisitsCommand extends AbstractDeleteVisitsCommand
);
}
protected function doExecute(InputInterface $input, SymfonyStyle $io): ?int
protected function doExecute(InputInterface $input, SymfonyStyle $io): int
{
$identifier = ShortUrlIdentifier::fromCli($input);
try {

View File

@ -129,7 +129,7 @@ class ListShortUrlsCommand extends Command
);
}
protected function execute(InputInterface $input, OutputInterface $output): ?int
protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);

View File

@ -49,7 +49,7 @@ class ResolveUrlCommand extends Command
}
}
protected function execute(InputInterface $input, OutputInterface $output): ?int
protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);

View File

@ -34,7 +34,7 @@ class DeleteTagsCommand extends Command
);
}
protected function execute(InputInterface $input, OutputInterface $output): ?int
protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);
$tagNames = $input->getOption('name');

View File

@ -31,7 +31,7 @@ class ListTagsCommand extends Command
->setDescription('Lists existing tags.');
}
protected function execute(InputInterface $input, OutputInterface $output): ?int
protected function execute(InputInterface $input, OutputInterface $output): int
{
ShlinkTable::default($output)->render(['Name', 'URLs amount', 'Visits amount'], $this->getTagsRows());
return ExitCode::EXIT_SUCCESS;

View File

@ -33,7 +33,7 @@ class RenameTagCommand extends Command
->addArgument('newName', InputArgument::REQUIRED, 'New name of the tag.');
}
protected function execute(InputInterface $input, OutputInterface $output): ?int
protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);
$oldName = $input->getArgument('oldName');

View File

@ -19,7 +19,7 @@ abstract class AbstractLockedCommand extends Command
parent::__construct();
}
final protected function execute(InputInterface $input, OutputInterface $output): ?int
final protected function execute(InputInterface $input, OutputInterface $output): int
{
$lockConfig = $this->getLockConfig();
$lock = $this->locker->createLock($lockConfig->lockName, $lockConfig->ttl, $lockConfig->isBlocking);

View File

@ -12,7 +12,7 @@ use Symfony\Component\Console\Style\SymfonyStyle;
abstract class AbstractDeleteVisitsCommand extends Command
{
final protected function execute(InputInterface $input, OutputInterface $output): ?int
final protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);
if (! $this->confirm($io)) {
@ -29,7 +29,7 @@ abstract class AbstractDeleteVisitsCommand extends Command
return $io->confirm('<comment>Continue deleting visits?</comment>', false);
}
abstract protected function doExecute(InputInterface $input, SymfonyStyle $io): ?int;
abstract protected function doExecute(InputInterface $input, SymfonyStyle $io): int;
abstract protected function getWarningMessage(): string;
}

View File

@ -34,7 +34,7 @@ abstract class AbstractVisitsListCommand extends Command
$this->endDateOption = new EndDateOption($this, 'visits');
}
final protected function execute(InputInterface $input, OutputInterface $output): ?int
final protected function execute(InputInterface $input, OutputInterface $output): int
{
$startDate = $this->startDateOption->get($input, $output);
$endDate = $this->endDateOption->get($input, $output);

View File

@ -27,7 +27,7 @@ class DeleteOrphanVisitsCommand extends AbstractDeleteVisitsCommand
->setDescription('Deletes all orphan visits');
}
protected function doExecute(InputInterface $input, SymfonyStyle $io): ?int
protected function doExecute(InputInterface $input, SymfonyStyle $io): int
{
$result = $this->deleter->deleteOrphanVisits();
$io->success(sprintf('Successfully deleted %s visits', $result->affectedItems));

View File

@ -37,7 +37,7 @@ class DownloadGeoLiteDbCommand extends Command
);
}
protected function execute(InputInterface $input, OutputInterface $output): ?int
protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);

View File

@ -22,7 +22,7 @@ use ShlinkioTest\Shlink\CLI\Util\CliTestUtils;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Tester\CommandTester;
use Symfony\Component\Lock\LockFactory;
use Symfony\Component\Lock\LockInterface;
use Symfony\Component\Lock\SharedLockInterface;
use Symfony\Component\Process\PhpExecutableFinder;
class CreateDatabaseCommandTest extends TestCase
@ -37,7 +37,7 @@ class CreateDatabaseCommandTest extends TestCase
protected function setUp(): void
{
$locker = $this->createMock(LockFactory::class);
$lock = $this->createMock(LockInterface::class);
$lock = $this->createMock(SharedLockInterface::class);
$lock->method('acquire')->withAnyParameters()->willReturn(true);
$locker->method('createLock')->withAnyParameters()->willReturn($lock);

View File

@ -13,7 +13,7 @@ use ShlinkioTest\Shlink\CLI\Util\CliTestUtils;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Tester\CommandTester;
use Symfony\Component\Lock\LockFactory;
use Symfony\Component\Lock\LockInterface;
use Symfony\Component\Lock\SharedLockInterface;
use Symfony\Component\Process\PhpExecutableFinder;
class MigrateDatabaseCommandTest extends TestCase
@ -24,7 +24,7 @@ class MigrateDatabaseCommandTest extends TestCase
protected function setUp(): void
{
$locker = $this->createMock(LockFactory::class);
$lock = $this->createMock(LockInterface::class);
$lock = $this->createMock(SharedLockInterface::class);
$lock->method('acquire')->withAnyParameters()->willReturn(true);
$locker->method('createLock')->withAnyParameters()->willReturn($lock);

View File

@ -46,7 +46,7 @@ class LocateVisitsCommandTest extends TestCase
$this->visitToLocation = $this->createMock(VisitToLocationHelperInterface::class);
$locker = $this->createMock(Lock\LockFactory::class);
$this->lock = $this->createMock(Lock\LockInterface::class);
$this->lock = $this->createMock(Lock\SharedLockInterface::class);
$locker->method('createLock')->with($this->isType('string'), 600.0, false)->willReturn($this->lock);
$command = new LocateVisitsCommand($this->visitService, $this->visitToLocation, $locker);

View File

@ -34,7 +34,7 @@ class GeolocationDbUpdaterTest extends TestCase
{
$this->dbUpdater = $this->createMock(DbUpdaterInterface::class);
$this->geoLiteDbReader = $this->createMock(Reader::class);
$this->lock = $this->createMock(Lock\LockInterface::class);
$this->lock = $this->createMock(Lock\SharedLockInterface::class);
$this->lock->method('acquire')->with($this->isTrue())->willReturn(true);
}