Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"phpunit/php-code-coverage": "^13.0",
"phpunit/phpcov": "^12.0",
"phpunit/phpunit": "^13.0",
"shlinkio/shlink-mago-config": "^1.1",
"shlinkio/shlink-mago-config": "^1.2",
"shlinkio/shlink-test-utils": "^4.5",
"symfony/var-dumper": "^8.1",
"veewee/composer-run-parallel": "^1.5"
Expand Down
4 changes: 4 additions & 0 deletions data/migrations_template.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,23 @@ namespace <namespace>;
use Doctrine\DBAL\Platforms\AbstractMySQLPlatform;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
use Override;

final class <className> extends AbstractMigration
{
#[Override]
public function up(Schema $schema): void
{
<up>
}

#[Override]
public function down(Schema $schema): void
{
<down>
}

#[Override]
public function isTransactional(): bool
{
return !$this->connection->getDatabasePlatform() instanceof AbstractMySQLPlatform;
Expand Down
2 changes: 1 addition & 1 deletion mago-analyze-baseline.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1821,7 +1821,7 @@ count = 1
[[issues]]
file = "module/Core/src/Visit/Repository/VisitDeleterRepository.php"
code = "mixed-return-statement"
message = "Could not infer a precise return type for function `{closure:module/Core/src/Visit/Repository/VisitDeleterRepository.php:41:39}`. Saw type `mixed`."
message = "Could not infer a precise return type for function `{closure:module/Core/src/Visit/Repository/VisitDeleterRepository.php:44:39}`. Saw type `mixed`."
count = 1

[[issues]]
Expand Down
3 changes: 3 additions & 0 deletions mago.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ ambiguous-function-call = {
"module/Core/config/entities-mappings"
]
}
no-duplicate-match-arm = {
exclude = ["module/Core/src/Config/EnvVars.php"]
}

[analyzer]
baseline = "mago-analyze-baseline.toml"
2 changes: 2 additions & 0 deletions module/CLI/src/ApiKey/RoleResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Shlinkio\Shlink\CLI\ApiKey;

use Override;
use Shlinkio\Shlink\CLI\Command\Api\Input\ApiKeyInput;
use Shlinkio\Shlink\CLI\Exception\InvalidRoleConfigException;
use Shlinkio\Shlink\Core\Config\Options\UrlShortenerOptions;
Expand All @@ -18,6 +19,7 @@ public function __construct(
private UrlShortenerOptions $urlShortenerOptions,
) {}

#[Override]
public function determineRoles(ApiKeyInput $input): iterable
{
$domainAuthority = $input->domain;
Expand Down
2 changes: 2 additions & 0 deletions module/CLI/src/Command/Api/DeleteKeyCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Shlinkio\Shlink\CLI\Command\Api;

use Override;
use Shlinkio\Shlink\Rest\Entity\ApiKey;
use Shlinkio\Shlink\Rest\Exception\ApiKeyNotFoundException;
use Shlinkio\Shlink\Rest\Service\ApiKeyServiceInterface;
Expand Down Expand Up @@ -42,6 +43,7 @@ public function __construct(private readonly ApiKeyServiceInterface $apiKeyServi
parent::__construct();
}

#[Override]
protected function interact(InputInterface $input, OutputInterface $output): void
{
$apiKeyName = $input->getArgument('name');
Expand Down
2 changes: 2 additions & 0 deletions module/CLI/src/Command/Api/DisableKeyCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Shlinkio\Shlink\CLI\Command\Api;

use Override;
use Shlinkio\Shlink\Common\Exception\InvalidArgumentException;
use Shlinkio\Shlink\Rest\Entity\ApiKey;
use Shlinkio\Shlink\Rest\Service\ApiKeyServiceInterface;
Expand Down Expand Up @@ -42,6 +43,7 @@ public function __construct(private readonly ApiKeyServiceInterface $apiKeyServi
parent::__construct();
}

#[Override]
protected function interact(InputInterface $input, OutputInterface $output): void
{
$name = $input->getArgument('name');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Shlinkio\Shlink\CLI\Command\Integration;

use Override;
use Shlinkio\Shlink\Core\Matomo\MatomoOptions;
use Shlinkio\Shlink\Core\Matomo\MatomoVisitSenderInterface;
use Shlinkio\Shlink\Core\Matomo\VisitSendingProgressTrackerInterface;
Expand Down Expand Up @@ -108,11 +109,13 @@ public function __invoke(
return self::SUCCESS;
}

#[Override]
public function success(int $index): void
{
$this->io->write('.');
}

#[Override]
public function error(int $index, Throwable $e): void
{
$this->io->write('<error>E</error>');
Expand Down
3 changes: 3 additions & 0 deletions module/CLI/src/Command/Visit/DownloadGeoLiteDbCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Shlinkio\Shlink\CLI\Command\Visit;

use Override;
use Shlinkio\Shlink\Core\Exception\GeolocationDbUpdateFailedException;
use Shlinkio\Shlink\Core\Geolocation\GeolocationDbUpdaterInterface;
use Shlinkio\Shlink\Core\Geolocation\GeolocationDownloadProgressHandlerInterface;
Expand Down Expand Up @@ -85,12 +86,14 @@ private function processGeoLiteUpdateError(GeolocationDbUpdateFailedException $e
return $olderDbExists ? self::INVALID : self::FAILURE;
}

#[Override]
public function beforeDownload(bool $olderDbExists): void
{
$this->io->text(sprintf('<fg=blue>%s GeoLite2 db file...</>', $olderDbExists ? 'Updating' : 'Downloading'));
$this->progressBar = new ProgressBar($this->io);
}

#[Override]
public function handleProgress(int $total, int $downloaded, bool $olderDbExists): void
{
$this->progressBar?->setMaxSteps($total);
Expand Down
3 changes: 3 additions & 0 deletions module/CLI/src/Command/Visit/LocateVisitsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Shlinkio\Shlink\CLI\Command\Visit;

use Override;
use Shlinkio\Shlink\CLI\Command\Util\CommandUtils;
use Shlinkio\Shlink\CLI\Command\Util\LockConfig;
use Shlinkio\Shlink\Common\Util\IpAddress;
Expand Down Expand Up @@ -121,6 +122,7 @@ private function locateVisits(bool $retry, bool $all): int
/**
* @throws IpCannotBeLocatedException
*/
#[Override]
public function geolocateVisit(Visit $visit): Location
{
$ipAddr = $visit->remoteAddr ?? '?';
Expand All @@ -143,6 +145,7 @@ public function geolocateVisit(Visit $visit): Location
}
}

#[Override]
public function onVisitLocated(VisitLocation $visitLocation, Visit $visit): void
{
if (!$visitLocation->isEmpty) {
Expand Down
2 changes: 2 additions & 0 deletions module/CLI/src/RedirectRule/RedirectRuleHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Shlinkio\Shlink\CLI\RedirectRule;

use Doctrine\Common\Collections\ArrayCollection;
use Override;
use Shlinkio\Shlink\Common\ObjectMapper\LooseUriConverter;
use Shlinkio\Shlink\Common\ObjectMapper\MappingError;
use Shlinkio\Shlink\Core\Exception\InvalidArgumentException;
Expand Down Expand Up @@ -36,6 +37,7 @@

class RedirectRuleHandler implements RedirectRuleHandlerInterface
{
#[Override]
public function manageRules(StyleInterface $io, ShortUrl $shortUrl, array $rules): array|null
{
$amountOfRules = count($rules);
Expand Down
2 changes: 2 additions & 0 deletions module/CLI/src/Util/PhpProcessRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Shlinkio\Shlink\CLI\Util;

use Override;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Process\PhpExecutableFinder;

Expand All @@ -22,6 +23,7 @@ public function __construct(private ProcessRunnerInterface $wrappedProcessRunner
/**
* @inheritDoc
*/
#[Override]
public function run(OutputInterface $output, array $cmd): void
{
$this->wrappedProcessRunner->run($output, [$this->phpBinary, ...$cmd]);
Expand Down
2 changes: 2 additions & 0 deletions module/CLI/src/Util/ProcessRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Shlinkio\Shlink\CLI\Util;

use Closure;
use Override;
use Symfony\Component\Console\Helper\DebugFormatterHelper;
use Symfony\Component\Console\Helper\ProcessHelper;
use Symfony\Component\Console\Output\ConsoleOutputInterface;
Expand Down Expand Up @@ -35,6 +36,7 @@ public function __construct(private readonly ProcessHelper $helper, callable|nul
/**
* @inheritDoc
*/
#[Override]
public function run(OutputInterface $output, array $cmd): void
{
if ($output instanceof ConsoleOutputInterface) {
Expand Down
3 changes: 3 additions & 0 deletions module/CLI/test-cli/Command/ImportShortUrlsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace ShlinkioCliTest\Shlink\CLI\Command;

use Override;
use PHPUnit\Framework\Attributes\Test;
use Shlinkio\Shlink\CLI\Command\ShortUrl\ListShortUrlsCommand;
use Shlinkio\Shlink\Core\Domain\Entity\Domain;
Expand All @@ -22,6 +23,7 @@ class ImportShortUrlsTest extends CliTestCase
{
private false|string|null $tempCsvFile = null;

#[Override]
protected function setUp(): void
{
$this->tempCsvFile = tempnam(sys_get_temp_dir(), 'shlink_csv');
Expand All @@ -45,6 +47,7 @@ protected function setUp(): void
fclose($handle);
}

#[Override]
protected function tearDown(): void
{
if (is_string($this->tempCsvFile)) {
Expand Down
2 changes: 2 additions & 0 deletions module/CLI/test/ApiKey/RoleResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace ShlinkioTest\Shlink\CLI\ApiKey;

use Override;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\MockObject\MockObject;
Expand All @@ -21,6 +22,7 @@ class RoleResolverTest extends TestCase
private RoleResolver $resolver;
private MockObject&DomainServiceInterface $domainService;

#[Override]
protected function setUp(): void
{
$this->domainService = $this->createMock(DomainServiceInterface::class);
Expand Down
2 changes: 2 additions & 0 deletions module/CLI/test/Command/Api/DeleteKeyCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace ShlinkioTest\Shlink\CLI\Command\Api;

use Override;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
Expand All @@ -21,6 +22,7 @@ class DeleteKeyCommandTest extends TestCase
private CommandTester $commandTester;
private MockObject&ApiKeyServiceInterface $apiKeyService;

#[Override]
protected function setUp(): void
{
$this->apiKeyService = $this->createMock(ApiKeyServiceInterface::class);
Expand Down
2 changes: 2 additions & 0 deletions module/CLI/test/Command/Api/DisableKeyCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace ShlinkioTest\Shlink\CLI\Command\Api;

use Override;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
Expand All @@ -21,6 +22,7 @@ class DisableKeyCommandTest extends TestCase
private CommandTester $commandTester;
private MockObject&ApiKeyServiceInterface $apiKeyService;

#[Override]
protected function setUp(): void
{
$this->apiKeyService = $this->createMock(ApiKeyServiceInterface::class);
Expand Down
2 changes: 2 additions & 0 deletions module/CLI/test/Command/Api/GenerateKeyCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace ShlinkioTest\Shlink\CLI\Command\Api;

use Cake\Chronos\Chronos;
use Override;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
Expand All @@ -22,6 +23,7 @@ class GenerateKeyCommandTest extends TestCase
private CommandTester $commandTester;
private MockObject&ApiKeyServiceInterface $apiKeyService;

#[Override]
protected function setUp(): void
{
$this->apiKeyService = $this->createMock(ApiKeyServiceInterface::class);
Expand Down
2 changes: 2 additions & 0 deletions module/CLI/test/Command/Api/InitialApiKeyCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace ShlinkioTest\Shlink\CLI\Command\Api;

use Override;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\MockObject\MockObject;
Expand All @@ -20,6 +21,7 @@ class InitialApiKeyCommandTest extends TestCase
private CommandTester $commandTester;
private MockObject&ApiKeyServiceInterface $apiKeyService;

#[Override]
public function setUp(): void
{
$this->apiKeyService = $this->createMock(ApiKeyServiceInterface::class);
Expand Down
2 changes: 2 additions & 0 deletions module/CLI/test/Command/Api/ListKeysCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace ShlinkioTest\Shlink\CLI\Command\Api;

use Cake\Chronos\Chronos;
use Override;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\MockObject\MockObject;
Expand All @@ -23,6 +24,7 @@ class ListKeysCommandTest extends TestCase
private CommandTester $commandTester;
private MockObject&ApiKeyServiceInterface $apiKeyService;

#[Override]
protected function setUp(): void
{
$this->apiKeyService = $this->createMock(ApiKeyServiceInterface::class);
Expand Down
2 changes: 2 additions & 0 deletions module/CLI/test/Command/Api/RenameApiKeyCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace ShlinkioTest\Shlink\CLI\Command\Api;

use Override;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
Expand All @@ -18,6 +19,7 @@ class RenameApiKeyCommandTest extends TestCase
private CommandTester $commandTester;
private MockObject&ApiKeyServiceInterface $apiKeyService;

#[Override]
protected function setUp(): void
{
$this->apiKeyService = $this->createMock(ApiKeyServiceInterface::class);
Expand Down
2 changes: 2 additions & 0 deletions module/CLI/test/Command/Config/ReadEnvVarCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace ShlinkioTest\Shlink\CLI\Command\Config;

use Monolog\Test\TestCase;
use Override;
use PHPUnit\Framework\Attributes\Test;
use Shlinkio\Shlink\CLI\Command\Config\ReadEnvVarCommand;
use Shlinkio\Shlink\Core\Config\EnvVars;
Expand All @@ -17,6 +18,7 @@ class ReadEnvVarCommandTest extends TestCase
private CommandTester $commandTester;
private string $envVarValue = 'the_env_var_value';

#[Override]
protected function setUp(): void
{
$this->commandTester = CliTestUtils::testerForCommand(new ReadEnvVarCommand(fn () => $this->envVarValue));
Expand Down
2 changes: 2 additions & 0 deletions module/CLI/test/Command/Db/CreateDatabaseCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\ClassMetadataFactory;
use Exception;
use Override;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\MockObject\MockObject;
Expand All @@ -36,6 +37,7 @@ class CreateDatabaseCommandTest extends TestCase
private MockObject&AbstractSchemaManager $schemaManager;
private Stub&Driver $driver;

#[Override]
protected function setUp(): void
{
$locker = $this->createStub(LockFactory::class);
Expand Down
Loading
Loading