Updated to coding standard v2.1

This commit is contained in:
Alejandro Celaya
2020-01-01 20:48:31 +01:00
parent 1070482629
commit 50100c251e
112 changed files with 253 additions and 300 deletions

View File

@@ -36,7 +36,7 @@ class GenerateKeyCommand extends Command
'expirationDate',
'e',
InputOption::VALUE_REQUIRED,
'The date in which the API key should expire. Use any valid PHP format.'
'The date in which the API key should expire. Use any valid PHP format.',
);
}

View File

@@ -42,7 +42,7 @@ class ListKeysCommand extends Command
'enabledOnly',
'e',
InputOption::VALUE_NONE,
'Tells if only enabled API keys should be returned.'
'Tells if only enabled API keys should be returned.',
);
}
@@ -81,8 +81,6 @@ class ListKeysCommand extends Command
}
/**
* @param ApiKey $apiKey
* @return string
*/
private function getEnabledSymbol(ApiKey $apiKey): string
{

View File

@@ -41,7 +41,7 @@ class CreateDatabaseCommand extends AbstractDatabaseCommand
$this
->setName(self::NAME)
->setDescription(
'Creates the database needed for shlink to work. It will do nothing if the database already exists'
'Creates the database needed for shlink to work. It will do nothing if the database already exists',
);
}

View File

@@ -39,7 +39,7 @@ class DeleteShortUrlCommand extends Command
'i',
InputOption::VALUE_NONE,
'Ignores the safety visits threshold check, which could make short URLs with many visits to be '
. 'accidentally deleted'
. 'accidentally deleted',
);
}

View File

@@ -47,45 +47,45 @@ class GenerateShortUrlCommand extends Command
'tags',
't',
InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED,
'Tags to apply to the new short URL'
'Tags to apply to the new short URL',
)
->addOption(
'validSince',
's',
InputOption::VALUE_REQUIRED,
'The date from which this short URL will be valid. '
. 'If someone tries to access it before this date, it will not be found.'
. 'If someone tries to access it before this date, it will not be found.',
)
->addOption(
'validUntil',
'u',
InputOption::VALUE_REQUIRED,
'The date until which this short URL will be valid. '
. 'If someone tries to access it after this date, it will not be found.'
. 'If someone tries to access it after this date, it will not be found.',
)
->addOption(
'customSlug',
'c',
InputOption::VALUE_REQUIRED,
'If provided, this slug will be used instead of generating a short code'
'If provided, this slug will be used instead of generating a short code',
)
->addOption(
'maxVisits',
'm',
InputOption::VALUE_REQUIRED,
'This will limit the number of visits for this short URL.'
'This will limit the number of visits for this short URL.',
)
->addOption(
'findIfExists',
'f',
InputOption::VALUE_NONE,
'This will force existing matching URL to be returned if found, instead of creating a new one.'
'This will force existing matching URL to be returned if found, instead of creating a new one.',
)
->addOption(
'domain',
'd',
InputOption::VALUE_REQUIRED,
'The domain to which this short URL will be attached.'
'The domain to which this short URL will be attached.',
);
}
@@ -127,8 +127,8 @@ class GenerateShortUrlCommand extends Command
$customSlug,
$maxVisits !== null ? (int) $maxVisits : null,
$input->getOption('findIfExists'),
$input->getOption('domain')
)
$input->getOption('domain'),
),
);
$io->writeln([

View File

@@ -61,25 +61,25 @@ class ListShortUrlsCommand extends AbstractWithDateRangeCommand
'p',
InputOption::VALUE_REQUIRED,
sprintf('The first page to list (%s items per page)', ShortUrlRepositoryAdapter::ITEMS_PER_PAGE),
'1'
'1',
)
->addOption(
'searchTerm',
'st',
InputOption::VALUE_REQUIRED,
'A query used to filter results by searching for it on the longUrl and shortCode fields'
'A query used to filter results by searching for it on the longUrl and shortCode fields',
)
->addOption(
'tags',
't',
InputOption::VALUE_REQUIRED,
'A comma-separated list of tags to filter results'
'A comma-separated list of tags to filter results',
)
->addOption(
'orderBy',
'o',
InputOption::VALUE_REQUIRED,
'The field from which we want to order by. Pass ASC or DESC separated by a comma'
'The field from which we want to order by. Pass ASC or DESC separated by a comma',
)
->addOption('showTags', null, InputOption::VALUE_NONE, 'Whether to display the tags or not');
}
@@ -122,6 +122,9 @@ class ListShortUrlsCommand extends AbstractWithDateRangeCommand
return ExitCodes::EXIT_SUCCESS;
}
/**
* @param string|array|null $orderBy
*/
private function renderPage(
OutputInterface $output,
int $page,
@@ -137,7 +140,7 @@ class ListShortUrlsCommand extends AbstractWithDateRangeCommand
$searchTerm,
$tags,
$orderBy,
new DateRange($startDate, $endDate)
new DateRange($startDate, $endDate),
);
$headers = ['Short code', 'Short URL', 'Long URL', 'Date created', 'Visits count'];
@@ -159,7 +162,7 @@ class ListShortUrlsCommand extends AbstractWithDateRangeCommand
ShlinkTable::fromOutput($output)->render($headers, $rows, $this->formatCurrentPageMessage(
$result,
'Page %s of %s'
'Page %s of %s',
));
return $result;

View File

@@ -33,7 +33,7 @@ class CreateTagCommand extends Command
'name',
't',
InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY,
'The name of the tags to create'
'The name of the tags to create',
);
}

View File

@@ -33,7 +33,7 @@ class DeleteTagsCommand extends Command
'name',
't',
InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY,
'The name of the tags to delete'
'The name of the tags to delete',
);
}

View File

@@ -29,7 +29,7 @@ abstract class AbstractLockedCommand extends Command
if (! $lock->acquire($lockConfig->isBlocking())) {
$output->writeln(
sprintf('<comment>Command "%s" is already in progress. Skipping.</comment>', $lockConfig->lockName())
sprintf('<comment>Command "%s" is already in progress. Skipping.</comment>', $lockConfig->lockName()),
);
return ExitCodes::EXIT_WARNING;
}

View File

@@ -36,7 +36,7 @@ abstract class AbstractWithDateRangeCommand extends Command
$output->writeln(sprintf(
'<comment>> Ignored provided "%s" since its value "%s" is not a valid date. <</comment>',
$key,
$value
$value,
));
if ($output->isVeryVerbose()) {

View File

@@ -66,13 +66,13 @@ class LocateVisitsCommand extends AbstractLockedCommand
$this->visitService->locateUnlocatedVisits(
[$this, 'getGeolocationDataForVisit'],
static function (VisitLocation $location) use ($output) {
static function (VisitLocation $location) use ($output): void {
if (!$location->isEmpty()) {
$output->writeln(
sprintf(' [<info>Address located at "%s"</info>]', $location->getCountryName())
sprintf(' [<info>Address located at "%s"</info>]', $location->getCountryName()),
);
}
}
},
);
$this->io->success('Finished processing all IPs');
@@ -92,7 +92,7 @@ class LocateVisitsCommand extends AbstractLockedCommand
if (! $visit->hasRemoteAddr()) {
$this->io->writeln(
'<comment>Ignored visit with no IP address</comment>',
OutputInterface::VERBOSITY_VERBOSE
OutputInterface::VERBOSITY_VERBOSE,
);
throw IpCannotBeLocatedException::forEmptyAddress();
}
@@ -119,12 +119,12 @@ class LocateVisitsCommand extends AbstractLockedCommand
private function checkDbUpdate(): void
{
try {
$this->dbUpdater->checkDbUpdate(function (bool $olderDbExists) {
$this->dbUpdater->checkDbUpdate(function (bool $olderDbExists): void {
$this->io->writeln(
sprintf('<fg=blue>%s GeoLite2 database...</>', $olderDbExists ? 'Updating' : 'Downloading')
sprintf('<fg=blue>%s GeoLite2 database...</>', $olderDbExists ? 'Updating' : 'Downloading'),
);
$this->progressBar = new ProgressBar($this->io);
}, function (int $total, int $downloaded) {
}, function (int $total, int $downloaded): void {
$this->progressBar->setMaxSteps($total);
$this->progressBar->setProgress($downloaded);
});
@@ -141,7 +141,7 @@ class LocateVisitsCommand extends AbstractLockedCommand
$this->io->newLine();
$this->io->writeln(
'<fg=yellow;options=bold>[Warning] GeoLite2 database update failed. Proceeding with old version.</>'
'<fg=yellow;options=bold>[Warning] GeoLite2 database update failed. Proceeding with old version.</>',
);
}
}

View File

@@ -8,7 +8,7 @@ use function Shlinkio\Shlink\Common\loadConfigFromGlob;
class ConfigProvider
{
public function __invoke()
public function __invoke(): array
{
return loadConfigFromGlob(__DIR__ . '/../config/{,*.}config.php');
}

View File

@@ -16,7 +16,7 @@ class GeolocationDbUpdateFailedException extends RuntimeException implements Exc
$e = new self(
'An error occurred while updating geolocation database, and an older version could not be found',
0,
$prev
$prev,
);
$e->olderDbExists = $olderDbExists;

View File

@@ -29,7 +29,7 @@ class GenerateKeyCommandTest extends TestCase
}
/** @test */
public function noExpirationDateIsDefinedIfNotProvided()
public function noExpirationDateIsDefinedIfNotProvided(): void
{
$create = $this->apiKeyService->create(null)->willReturn(new ApiKey());
@@ -41,7 +41,7 @@ class GenerateKeyCommandTest extends TestCase
}
/** @test */
public function expirationDateIsDefinedIfProvided()
public function expirationDateIsDefinedIfProvided(): void
{
$this->apiKeyService->create(Argument::type(Chronos::class))->shouldBeCalledOnce()
->willReturn(new ApiKey());

View File

@@ -33,7 +33,7 @@ class CreateDatabaseCommandTest extends TestCase
$locker = $this->prophesize(LockFactory::class);
$lock = $this->prophesize(LockInterface::class);
$lock->acquire(Argument::any())->willReturn(true);
$lock->release()->will(function () {
$lock->release()->will(function (): void {
});
$locker->createLock(Argument::cetera())->willReturn($lock->reveal());
@@ -55,7 +55,7 @@ class CreateDatabaseCommandTest extends TestCase
$this->processHelper->reveal(),
$phpExecutableFinder->reveal(),
$this->regularConn->reveal(),
$this->noDbNameConn->reveal()
$this->noDbNameConn->reveal(),
);
$app = new Application();
$app->add($command);
@@ -69,7 +69,7 @@ class CreateDatabaseCommandTest extends TestCase
$shlinkDatabase = 'shlink_database';
$getDatabase = $this->regularConn->getDatabase()->willReturn($shlinkDatabase);
$listDatabases = $this->schemaManager->listDatabases()->willReturn(['foo', $shlinkDatabase, 'bar']);
$createDatabase = $this->schemaManager->createDatabase($shlinkDatabase)->will(function () {
$createDatabase = $this->schemaManager->createDatabase($shlinkDatabase)->will(function (): void {
});
$listTables = $this->schemaManager->listTableNames()->willReturn(['foo_table', 'bar_table']);
@@ -89,7 +89,7 @@ class CreateDatabaseCommandTest extends TestCase
$shlinkDatabase = 'shlink_database';
$getDatabase = $this->regularConn->getDatabase()->willReturn($shlinkDatabase);
$listDatabases = $this->schemaManager->listDatabases()->willReturn(['foo', 'bar']);
$createDatabase = $this->schemaManager->createDatabase($shlinkDatabase)->will(function () {
$createDatabase = $this->schemaManager->createDatabase($shlinkDatabase)->will(function (): void {
});
$listTables = $this->schemaManager->listTableNames()->willReturn(['foo_table', 'bar_table']);
@@ -107,7 +107,7 @@ class CreateDatabaseCommandTest extends TestCase
$shlinkDatabase = 'shlink_database';
$getDatabase = $this->regularConn->getDatabase()->willReturn($shlinkDatabase);
$listDatabases = $this->schemaManager->listDatabases()->willReturn(['foo', $shlinkDatabase, 'bar']);
$createDatabase = $this->schemaManager->createDatabase($shlinkDatabase)->will(function () {
$createDatabase = $this->schemaManager->createDatabase($shlinkDatabase)->will(function (): void {
});
$listTables = $this->schemaManager->listTableNames()->willReturn([]);
$runCommand = $this->processHelper->mustRun(Argument::type(OutputInterface::class), [
@@ -136,7 +136,7 @@ class CreateDatabaseCommandTest extends TestCase
$shlinkDatabase = 'shlink_database';
$getDatabase = $this->regularConn->getDatabase()->willReturn($shlinkDatabase);
$listDatabases = $this->schemaManager->listDatabases()->willReturn(['foo', 'bar']);
$createDatabase = $this->schemaManager->createDatabase($shlinkDatabase)->will(function () {
$createDatabase = $this->schemaManager->createDatabase($shlinkDatabase)->will(function (): void {
});
$listTables = $this->schemaManager->listTableNames()->willReturn(['foo_table', 'bar_table']);

View File

@@ -26,7 +26,7 @@ class MigrateDatabaseCommandTest extends TestCase
$locker = $this->prophesize(LockFactory::class);
$lock = $this->prophesize(LockInterface::class);
$lock->acquire(Argument::any())->willReturn(true);
$lock->release()->will(function () {
$lock->release()->will(function (): void {
});
$locker->createLock(Argument::cetera())->willReturn($lock->reveal());
@@ -38,7 +38,7 @@ class MigrateDatabaseCommandTest extends TestCase
$command = new MigrateDatabaseCommand(
$locker->reveal(),
$this->processHelper->reveal(),
$phpExecutableFinder->reveal()
$phpExecutableFinder->reveal(),
);
$app = new Application();
$app->add($command);

View File

@@ -38,7 +38,7 @@ class DeleteShortUrlCommandTest extends TestCase
public function successMessageIsPrintedIfUrlIsProperlyDeleted(): void
{
$shortCode = 'abc123';
$deleteByShortCode = $this->service->deleteByShortCode($shortCode, false)->will(function () {
$deleteByShortCode = $this->service->deleteByShortCode($shortCode, false)->will(function (): void {
});
$this->commandTester->execute(['shortCode' => $shortCode]);
@@ -46,7 +46,7 @@ class DeleteShortUrlCommandTest extends TestCase
$this->assertStringContainsString(
sprintf('Short URL with short code "%s" successfully deleted.', $shortCode),
$output
$output,
);
$deleteByShortCode->shouldHaveBeenCalledOnce();
}
@@ -56,7 +56,7 @@ class DeleteShortUrlCommandTest extends TestCase
{
$shortCode = 'abc123';
$deleteByShortCode = $this->service->deleteByShortCode($shortCode, false)->willThrow(
Exception\ShortUrlNotFoundException::fromNotFoundShortCode($shortCode)
Exception\ShortUrlNotFoundException::fromNotFoundShortCode($shortCode),
);
$this->commandTester->execute(['shortCode' => $shortCode]);
@@ -77,13 +77,13 @@ class DeleteShortUrlCommandTest extends TestCase
): void {
$shortCode = 'abc123';
$deleteByShortCode = $this->service->deleteByShortCode($shortCode, Argument::type('bool'))->will(
function (array $args) use ($shortCode) {
function (array $args) use ($shortCode): void {
$ignoreThreshold = array_pop($args);
if (!$ignoreThreshold) {
throw Exception\DeleteShortUrlException::fromVisitsThreshold(10, $shortCode);
}
}
},
);
$this->commandTester->setInputs($retryAnswer);
@@ -92,7 +92,7 @@ class DeleteShortUrlCommandTest extends TestCase
$this->assertStringContainsString(sprintf(
'Impossible to delete short URL with short code "%s" since it has more than "10" visits.',
$shortCode
$shortCode,
), $output);
$this->assertStringContainsString($expectedMessage, $output);
$deleteByShortCode->shouldHaveBeenCalledTimes($expectedDeleteCalls);
@@ -110,7 +110,7 @@ class DeleteShortUrlCommandTest extends TestCase
{
$shortCode = 'abc123';
$deleteByShortCode = $this->service->deleteByShortCode($shortCode, false)->willThrow(
Exception\DeleteShortUrlException::fromVisitsThreshold(10, $shortCode)
Exception\DeleteShortUrlException::fromVisitsThreshold(10, $shortCode),
);
$this->commandTester->setInputs(['no']);
@@ -119,7 +119,7 @@ class DeleteShortUrlCommandTest extends TestCase
$this->assertStringContainsString(sprintf(
'Impossible to delete short URL with short code "%s" since it has more than "10" visits.',
$shortCode
$shortCode,
), $output);
$this->assertStringContainsString('Short URL was not deleted.', $output);
$deleteByShortCode->shouldHaveBeenCalledOnce();

View File

@@ -72,7 +72,7 @@ class GenerateShortUrlCommandTest extends TestCase
public function providingNonUniqueSlugOutputsError(): void
{
$urlToShortCode = $this->urlShortener->urlToShortCode(Argument::cetera())->willThrow(
NonUniqueSlugException::fromSlug('my-slug')
NonUniqueSlugException::fromSlug('my-slug'),
);
$this->commandTester->execute(['longUrl' => 'http://domain.com/invalid', '--customSlug' => 'my-slug']);
@@ -93,7 +93,7 @@ class GenerateShortUrlCommandTest extends TestCase
Assert::assertEquals(['foo', 'bar', 'baz', 'boo', 'zar'], $tags);
return $tags;
}),
Argument::cetera()
Argument::cetera(),
)->willReturn($shortUrl);
$this->commandTester->execute([

View File

@@ -43,7 +43,7 @@ class GetVisitsCommandTest extends TestCase
{
$shortCode = 'abc123';
$this->visitsTracker->info($shortCode, new VisitsParams(new DateRange(null, null)))->willReturn(
new Paginator(new ArrayAdapter([]))
new Paginator(new ArrayAdapter([])),
)->shouldBeCalledOnce();
$this->commandTester->execute(['shortCode' => $shortCode]);
@@ -57,7 +57,7 @@ class GetVisitsCommandTest extends TestCase
$endDate = '2016-02-01';
$this->visitsTracker->info(
$shortCode,
new VisitsParams(new DateRange(Chronos::parse($startDate), Chronos::parse($endDate)))
new VisitsParams(new DateRange(Chronos::parse($startDate), Chronos::parse($endDate))),
)
->willReturn(new Paginator(new ArrayAdapter([])))
->shouldBeCalledOnce();
@@ -86,7 +86,7 @@ class GetVisitsCommandTest extends TestCase
$info->shouldHaveBeenCalledOnce();
$this->assertStringContainsString(
sprintf('Ignored provided "startDate" since its value "%s" is not a valid date', $startDate),
$output
$output,
);
}
@@ -97,9 +97,9 @@ class GetVisitsCommandTest extends TestCase
$this->visitsTracker->info($shortCode, Argument::any())->willReturn(
new Paginator(new ArrayAdapter([
(new Visit(new ShortUrl(''), new Visitor('bar', 'foo', '')))->locate(
new VisitLocation(new Location('', 'Spain', '', '', 0, 0, ''))
new VisitLocation(new Location('', 'Spain', '', '', 0, 0, '')),
),
]))
])),
)->shouldBeCalledOnce();
$this->commandTester->execute(['shortCode' => $shortCode]);

View File

@@ -162,6 +162,7 @@ class ListShortUrlsCommandTest extends TestCase
}
/**
* @param string|array|null $expectedOrderBy
* @test
* @dataProvider provideOrderBy
*/

View File

@@ -40,7 +40,7 @@ class DeleteTagsCommandTest extends TestCase
public function serviceIsInvokedOnSuccess(): void
{
$tagNames = ['foo', 'bar'];
$deleteTags = $this->tagService->deleteTags($tagNames)->will(function () {
$deleteTags = $this->tagService->deleteTags($tagNames)->will(function (): void {
});
$this->commandTester->execute([

View File

@@ -45,7 +45,7 @@ class LocateVisitsCommandTest extends TestCase
$this->locker = $this->prophesize(Lock\LockFactory::class);
$this->lock = $this->prophesize(Lock\LockInterface::class);
$this->lock->acquire(false)->willReturn(true);
$this->lock->release()->will(function () {
$this->lock->release()->will(function (): void {
});
$this->locker->createLock(Argument::type('string'), 90.0, false)->willReturn($this->lock->reveal());
@@ -53,7 +53,7 @@ class LocateVisitsCommandTest extends TestCase
$this->visitService->reveal(),
$this->ipResolver->reveal(),
$this->locker->reveal(),
$this->dbUpdater->reveal()
$this->dbUpdater->reveal(),
);
$app = new Application();
$app->add($command);
@@ -68,16 +68,16 @@ class LocateVisitsCommandTest extends TestCase
$location = new VisitLocation(Location::emptyInstance());
$locateVisits = $this->visitService->locateUnlocatedVisits(Argument::cetera())->will(
function (array $args) use ($visit, $location) {
function (array $args) use ($visit, $location): void {
$firstCallback = array_shift($args);
$firstCallback($visit);
$secondCallback = array_shift($args);
$secondCallback($location, $visit);
}
},
);
$resolveIpLocation = $this->ipResolver->resolveIpLocation(Argument::any())->willReturn(
Location::emptyInstance()
Location::emptyInstance(),
);
$this->commandTester->execute([]);
@@ -98,16 +98,16 @@ class LocateVisitsCommandTest extends TestCase
$location = new VisitLocation(Location::emptyInstance());
$locateVisits = $this->visitService->locateUnlocatedVisits(Argument::cetera())->will(
function (array $args) use ($visit, $location) {
function (array $args) use ($visit, $location): void {
$firstCallback = array_shift($args);
$firstCallback($visit);
$secondCallback = array_shift($args);
$secondCallback($location, $visit);
}
},
);
$resolveIpLocation = $this->ipResolver->resolveIpLocation(Argument::any())->willReturn(
Location::emptyInstance()
Location::emptyInstance(),
);
$this->commandTester->execute([], ['verbosity' => OutputInterface::VERBOSITY_VERBOSE]);
@@ -137,13 +137,13 @@ class LocateVisitsCommandTest extends TestCase
$location = new VisitLocation(Location::emptyInstance());
$locateVisits = $this->visitService->locateUnlocatedVisits(Argument::cetera())->will(
function (array $args) use ($visit, $location) {
function (array $args) use ($visit, $location): void {
$firstCallback = array_shift($args);
$firstCallback($visit);
$secondCallback = array_shift($args);
$secondCallback($location, $visit);
}
},
);
$resolveIpLocation = $this->ipResolver->resolveIpLocation(Argument::any())->willThrow(WrongIpException::class);
@@ -161,7 +161,7 @@ class LocateVisitsCommandTest extends TestCase
{
$this->lock->acquire(false)->willReturn(false);
$locateVisits = $this->visitService->locateUnlocatedVisits(Argument::cetera())->will(function () {
$locateVisits = $this->visitService->locateUnlocatedVisits(Argument::cetera())->will(function (): void {
});
$resolveIpLocation = $this->ipResolver->resolveIpLocation(Argument::any())->willReturn([]);
@@ -170,7 +170,7 @@ class LocateVisitsCommandTest extends TestCase
$this->assertStringContainsString(
sprintf('Command "%s" is already in progress. Skipping.', LocateVisitsCommand::NAME),
$output
$output,
);
$locateVisits->shouldNotHaveBeenCalled();
$resolveIpLocation->shouldNotHaveBeenCalled();
@@ -182,17 +182,17 @@ class LocateVisitsCommandTest extends TestCase
*/
public function showsProperMessageWhenGeoLiteUpdateFails(bool $olderDbExists, string $expectedMessage): void
{
$locateVisits = $this->visitService->locateUnlocatedVisits(Argument::cetera())->will(function () {
$locateVisits = $this->visitService->locateUnlocatedVisits(Argument::cetera())->will(function (): void {
});
$checkDbUpdate = $this->dbUpdater->checkDbUpdate(Argument::cetera())->will(
function (array $args) use ($olderDbExists) {
function (array $args) use ($olderDbExists): void {
[$mustBeUpdated, $handleProgress] = $args;
$mustBeUpdated($olderDbExists);
$handleProgress(100, 50);
throw GeolocationDbUpdateFailedException::create($olderDbExists);
}
},
);
$this->commandTester->execute([]);
@@ -200,7 +200,7 @@ class LocateVisitsCommandTest extends TestCase
$this->assertStringContainsString(
sprintf('%s GeoLite2 database...', $olderDbExists ? 'Updating' : 'Downloading'),
$output
$output,
);
$this->assertStringContainsString($expectedMessage, $output);
$locateVisits->shouldHaveBeenCalledTimes((int) $olderDbExists);

View File

@@ -17,7 +17,7 @@ class ConfigProviderTest extends TestCase
}
/** @test */
public function confiIsProperlyReturned()
public function confiIsProperlyReturned(): void
{
$config = ($this->configProvider)();

View File

@@ -23,7 +23,7 @@ class GeolocationDbUpdateFailedExceptionTest extends TestCase
$this->assertEquals($olderDbExists, $e->olderDbExists());
$this->assertEquals(
'An error occurred while updating geolocation database, and an older version could not be found',
$e->getMessage()
$e->getMessage(),
);
$this->assertEquals(0, $e->getCode());
$this->assertEquals($prev, $e->getPrevious());

View File

@@ -59,7 +59,7 @@ class ApplicationFactoryTest extends TestCase
$command->getDefinition()->willReturn($name);
$command->isEnabled()->willReturn(true);
$command->getAliases()->willReturn([]);
$command->setApplication(Argument::type(Application::class))->willReturn(function () {
$command->setApplication(Argument::type(Application::class))->willReturn(function (): void {
});
return $command;

View File

@@ -36,14 +36,14 @@ class GeolocationDbUpdaterTest extends TestCase
$this->locker = $this->prophesize(Lock\LockFactory::class);
$this->lock = $this->prophesize(Lock\LockInterface::class);
$this->lock->acquire(true)->willReturn(true);
$this->lock->release()->will(function () {
$this->lock->release()->will(function (): void {
});
$this->locker->createLock(Argument::type('string'))->willReturn($this->lock->reveal());
$this->geolocationDbUpdater = new GeolocationDbUpdater(
$this->dbUpdater->reveal(),
$this->geoLiteDbReader->reveal(),
$this->locker->reveal()
$this->locker->reveal(),
);
}
@@ -134,7 +134,7 @@ class GeolocationDbUpdaterTest extends TestCase
'node_count' => 1,
'record_size' => 4,
]));
$download = $this->dbUpdater->downloadFreshCopy(null)->will(function () {
$download = $this->dbUpdater->downloadFreshCopy(null)->will(function (): void {
});
$this->geolocationDbUpdater->checkDbUpdate();

View File

@@ -33,7 +33,7 @@ class ShlinkTableTest extends TestCase
$footerTitle = 'Footer';
$setStyle = $this->baseTable->setStyle(Argument::type(TableStyle::class))->willReturn(
$this->baseTable->reveal()
$this->baseTable->reveal(),
);
$setHeaders = $this->baseTable->setHeaders($headers)->willReturn($this->baseTable->reveal());
$setRows = $this->baseTable->setRows($rows)->willReturn($this->baseTable->reveal());