diff --git a/.travis.yml b/.travis.yml index 6b2a861a..19aece15 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,10 +9,6 @@ php: - '7.3' - '7.4snapshot' -matrix: - allow_failures: - - php: '7.4snapshot' - services: - mysql - postgresql @@ -43,7 +39,8 @@ script: after_success: - rm -f build/clover.xml - - phpdbg -qrr vendor/bin/phpcov merge build --clover build/clover.xml + - wget https://phar.phpunit.de/phpcov-6.0.1.phar + - phpdbg -qrr phpcov-6.0.1.phar merge build --clover build/clover.xml - wget https://scrutinizer-ci.com/ocular.phar - php ocular.phar code-coverage:upload --format=php-clover build/clover.xml diff --git a/composer.json b/composer.json index 5d035b60..fd3840bb 100644 --- a/composer.json +++ b/composer.json @@ -28,20 +28,20 @@ "guzzlehttp/guzzle": "^6.3", "lstrojny/functional-php": "^1.9", "mikehaertl/phpwkhtmltopdf": "^2.2", - "monolog/monolog": "^1.24", + "monolog/monolog": "^2.0", + "nikolaposa/monolog-factory": "^3.0", "ocramius/proxy-manager": "~2.2.2", "phly/phly-event-dispatcher": "^1.0", "predis/predis": "^1.1", "pugx/shortid-php": "^0.5", - "shlinkio/shlink-common": "^2.3", - "shlinkio/shlink-event-dispatcher": "^1.0", - "shlinkio/shlink-installer": "^3.1", - "shlinkio/shlink-ip-geolocation": "^1.1", - "symfony/console": "^4.3", - "symfony/filesystem": "^4.3", - "symfony/lock": "^4.3", - "symfony/process": "^4.3", - "theorchard/monolog-cascade": "^0.5", + "shlinkio/shlink-common": "^2.4", + "shlinkio/shlink-event-dispatcher": "^1.1", + "shlinkio/shlink-installer": "^3.2", + "shlinkio/shlink-ip-geolocation": "^1.2", + "symfony/console": "^5.0", + "symfony/filesystem": "^5.0", + "symfony/lock": "^5.0", + "symfony/process": "^5.0", "zendframework/zend-config": "^3.3", "zendframework/zend-config-aggregator": "^1.1", "zendframework/zend-diactoros": "^2.1.3", @@ -59,17 +59,14 @@ "require-dev": { "devster/ubench": "^2.0", "eaglewu/swoole-ide-helper": "dev-master", - "infection/infection": "^0.14.2", - "phpstan/phpstan": "^0.11.16", - "phpunit/phpcov": "^6.0", + "infection/infection": "^0.15.0", + "phpstan/phpstan-shim": "^0.11.16", "phpunit/phpunit": "^8.3", "roave/security-advisories": "dev-master", "shlinkio/php-coding-standard": "~2.0.0", - "shlinkio/shlink-test-utils": "^1.1", - "symfony/dotenv": "^4.3", - "symfony/var-dumper": "^4.3", - "zendframework/zend-component-installer": "^2.1", - "zendframework/zend-expressive-tooling": "^1.2" + "shlinkio/shlink-test-utils": "^1.2", + "symfony/dotenv": "^5.0", + "symfony/var-dumper": "^5.0" }, "autoload": { "psr-4": { @@ -115,7 +112,7 @@ "@test:api" ], "test:unit": "phpdbg -qrr vendor/bin/phpunit --order-by=random --colors=always --coverage-php build/coverage-unit.cov --testdox", - "test:unit:ci": "phpdbg -qrr vendor/bin/phpunit --order-by=random --colors=always --coverage-php build/coverage-unit.cov --coverage-clover=build/clover.xml --coverage-xml=build/coverage-xml --log-junit=build/phpunit.junit.xml --testdox", + "test:unit:ci": "phpdbg -qrr vendor/bin/phpunit --order-by=random --colors=always --coverage-php build/coverage-unit.cov --coverage-clover=build/clover.xml --coverage-xml=build/coverage-xml --log-junit=build/junit.xml --testdox", "test:db": [ "@test:db:sqlite", "@test:db:mysql", @@ -132,10 +129,6 @@ "test:db:maria": "DB_DRIVER=maria composer test:db:sqlite", "test:db:postgres": "DB_DRIVER=postgres composer test:db:sqlite", "test:api": "bin/test/run-api-tests.sh", - "test:pretty": [ - "@test", - "phpdbg -qrr vendor/bin/phpcov merge build --html build/html" - ], "test:unit:pretty": "phpdbg -qrr vendor/bin/phpunit --order-by=random --colors=always --coverage-html build/coverage", "infect": "infection --threads=4 --min-msi=75 --log-verbosity=default --only-covered", "infect:ci": "infection --threads=4 --min-msi=75 --log-verbosity=default --only-covered --coverage=build", @@ -162,7 +155,6 @@ "test:db:maria": "Runs database test suites on a MariaDB database", "test:db:postgres": "Runs database test suites on a PostgreSQL database", "test:api": "Runs API test suites", - "test:pretty": "Runs all test suites and generates an HTML code coverage report", "test:unit:pretty": "Runs unit test suites and generates an HTML code coverage report", "infect": "Checks unit tests quality applying mutation testing", "infect:ci": "Checks unit tests quality applying mutation testing with existing reports and logs", diff --git a/config/autoload/locks.global.php b/config/autoload/locks.global.php index db64e187..e8c39338 100644 --- a/config/autoload/locks.global.php +++ b/config/autoload/locks.global.php @@ -10,7 +10,7 @@ use Zend\ServiceManager\AbstractFactory\ConfigAbstractFactory; // This class alias tricks the ConfigAbstractFactory to return Lock\Factory instances even with a different service name $localLockFactory = 'Shlinkio\Shlink\LocalLockFactory'; -class_alias(Lock\Factory::class, $localLockFactory); +class_alias(Lock\LockFactory::class, $localLockFactory); return [ @@ -22,7 +22,7 @@ return [ 'factories' => [ Lock\Store\FlockStore::class => ConfigAbstractFactory::class, Lock\Store\RedisStore::class => ConfigAbstractFactory::class, - Lock\Factory::class => ConfigAbstractFactory::class, + Lock\LockFactory::class => ConfigAbstractFactory::class, $localLockFactory => ConfigAbstractFactory::class, ], 'aliases' => [ @@ -36,7 +36,7 @@ return [ Lock\Store\RedisStore::class => [ RetryLockStoreDelegatorFactory::class, ], - Lock\Factory::class => [ + Lock\LockFactory::class => [ LoggerAwareDelegatorFactory::class, ], ], @@ -45,7 +45,7 @@ return [ ConfigAbstractFactory::class => [ Lock\Store\FlockStore::class => ['config.locks.locks_dir'], Lock\Store\RedisStore::class => [RedisFactory::SERVICE_NAME], - Lock\Factory::class => ['lock_store'], + Lock\LockFactory::class => ['lock_store'], $localLockFactory => ['local_lock_store'], ], diff --git a/module/CLI/config/dependencies.config.php b/module/CLI/config/dependencies.config.php index a7f7e90e..c89a0ad7 100644 --- a/module/CLI/config/dependencies.config.php +++ b/module/CLI/config/dependencies.config.php @@ -15,7 +15,7 @@ use Shlinkio\Shlink\IpGeolocation\Resolver\IpLocationResolverInterface; use Shlinkio\Shlink\PreviewGenerator\Service\PreviewGenerator; use Shlinkio\Shlink\Rest\Service\ApiKeyService; use Symfony\Component\Console as SymfonyCli; -use Symfony\Component\Lock\Factory as Locker; +use Symfony\Component\Lock\LockFactory; use Symfony\Component\Process\PhpExecutableFinder; use Zend\ServiceManager\AbstractFactory\ConfigAbstractFactory; use Zend\ServiceManager\Factory\InvokableFactory; @@ -70,7 +70,7 @@ return [ Command\Visit\LocateVisitsCommand::class => [ Service\VisitService::class, IpLocationResolverInterface::class, - Locker::class, + LockFactory::class, GeolocationDbUpdater::class, ], Command\Visit\UpdateDbCommand::class => [DbUpdater::class], @@ -85,14 +85,14 @@ return [ Command\Tag\DeleteTagsCommand::class => [Service\Tag\TagService::class], Command\Db\CreateDatabaseCommand::class => [ - Locker::class, + LockFactory::class, SymfonyCli\Helper\ProcessHelper::class, PhpExecutableFinder::class, Connection::class, NoDbNameConnectionFactory::SERVICE_NAME, ], Command\Db\MigrateDatabaseCommand::class => [ - Locker::class, + LockFactory::class, SymfonyCli\Helper\ProcessHelper::class, PhpExecutableFinder::class, ], diff --git a/module/CLI/src/Command/Db/AbstractDatabaseCommand.php b/module/CLI/src/Command/Db/AbstractDatabaseCommand.php index 3ab12b3b..bf99de9b 100644 --- a/module/CLI/src/Command/Db/AbstractDatabaseCommand.php +++ b/module/CLI/src/Command/Db/AbstractDatabaseCommand.php @@ -8,7 +8,7 @@ use Shlinkio\Shlink\CLI\Command\Util\AbstractLockedCommand; use Shlinkio\Shlink\CLI\Command\Util\LockedCommandConfig; use Symfony\Component\Console\Helper\ProcessHelper; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Lock\Factory as Locker; +use Symfony\Component\Lock\LockFactory; use Symfony\Component\Process\PhpExecutableFinder; use function array_unshift; @@ -20,7 +20,7 @@ abstract class AbstractDatabaseCommand extends AbstractLockedCommand /** @var string */ private $phpBinary; - public function __construct(Locker $locker, ProcessHelper $processHelper, PhpExecutableFinder $phpFinder) + public function __construct(LockFactory $locker, ProcessHelper $processHelper, PhpExecutableFinder $phpFinder) { parent::__construct($locker); $this->processHelper = $processHelper; diff --git a/module/CLI/src/Command/Db/CreateDatabaseCommand.php b/module/CLI/src/Command/Db/CreateDatabaseCommand.php index 36bb9de4..54cd27ea 100644 --- a/module/CLI/src/Command/Db/CreateDatabaseCommand.php +++ b/module/CLI/src/Command/Db/CreateDatabaseCommand.php @@ -10,7 +10,7 @@ use Symfony\Component\Console\Helper\ProcessHelper; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; -use Symfony\Component\Lock\Factory as Locker; +use Symfony\Component\Lock\LockFactory; use Symfony\Component\Process\PhpExecutableFinder; use function Functional\contains; @@ -27,7 +27,7 @@ class CreateDatabaseCommand extends AbstractDatabaseCommand private $noDbNameConn; public function __construct( - Locker $locker, + LockFactory $locker, ProcessHelper $processHelper, PhpExecutableFinder $phpFinder, Connection $conn, diff --git a/module/CLI/src/Command/ShortUrl/GeneratePreviewCommand.php b/module/CLI/src/Command/ShortUrl/GeneratePreviewCommand.php index 7483e890..081fa94f 100644 --- a/module/CLI/src/Command/ShortUrl/GeneratePreviewCommand.php +++ b/module/CLI/src/Command/ShortUrl/GeneratePreviewCommand.php @@ -69,7 +69,7 @@ class GeneratePreviewCommand extends Command } catch (PreviewGenerationException $e) { $output->writeln(' Error'); if ($output->isVerbose()) { - $this->getApplication()->renderException($e, $output); + $this->getApplication()->renderThrowable($e, $output); } } } diff --git a/module/CLI/src/Command/Util/AbstractLockedCommand.php b/module/CLI/src/Command/Util/AbstractLockedCommand.php index 0e206cbe..59ea74fa 100644 --- a/module/CLI/src/Command/Util/AbstractLockedCommand.php +++ b/module/CLI/src/Command/Util/AbstractLockedCommand.php @@ -8,16 +8,16 @@ use Shlinkio\Shlink\CLI\Util\ExitCodes; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Lock\Factory as Locker; +use Symfony\Component\Lock\LockFactory; use function sprintf; abstract class AbstractLockedCommand extends Command { - /** @var Locker */ + /** @var LockFactory */ private $locker; - public function __construct(Locker $locker) + public function __construct(LockFactory $locker) { parent::__construct(); $this->locker = $locker; diff --git a/module/CLI/src/Command/Visit/LocateVisitsCommand.php b/module/CLI/src/Command/Visit/LocateVisitsCommand.php index 21012480..710c4a3a 100644 --- a/module/CLI/src/Command/Visit/LocateVisitsCommand.php +++ b/module/CLI/src/Command/Visit/LocateVisitsCommand.php @@ -22,7 +22,7 @@ use Symfony\Component\Console\Helper\ProgressBar; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; -use Symfony\Component\Lock\Factory as Locker; +use Symfony\Component\Lock\LockFactory; use Throwable; use function sprintf; @@ -47,7 +47,7 @@ class LocateVisitsCommand extends AbstractLockedCommand public function __construct( VisitServiceInterface $visitService, IpLocationResolverInterface $ipLocationResolver, - Locker $locker, + LockFactory $locker, GeolocationDbUpdaterInterface $dbUpdater ) { parent::__construct($locker); @@ -87,7 +87,7 @@ class LocateVisitsCommand extends AbstractLockedCommand } catch (Throwable $e) { $this->io->error($e->getMessage()); if ($e instanceof Exception && $this->io->isVerbose()) { - $this->getApplication()->renderException($e, $this->io); + $this->getApplication()->renderThrowable($e, $this->io); } return ExitCodes::EXIT_FAILURE; @@ -116,7 +116,7 @@ class LocateVisitsCommand extends AbstractLockedCommand } catch (WrongIpException $e) { $this->io->writeln(' [An error occurred while locating IP. Skipped]'); if ($this->io->isVerbose()) { - $this->getApplication()->renderException($e, $this->io); + $this->getApplication()->renderThrowable($e, $this->io); } throw IpCannotBeLocatedException::forError($e); diff --git a/module/CLI/src/Command/Visit/UpdateDbCommand.php b/module/CLI/src/Command/Visit/UpdateDbCommand.php index c138372b..367423fd 100644 --- a/module/CLI/src/Command/Visit/UpdateDbCommand.php +++ b/module/CLI/src/Command/Visit/UpdateDbCommand.php @@ -84,7 +84,7 @@ class UpdateDbCommand extends Command $io->error($baseErrorMsg); if ($io->isVerbose()) { - $this->getApplication()->renderException($e, $io); + $this->getApplication()->renderThrowable($e, $io); } return ExitCodes::EXIT_FAILURE; } diff --git a/module/CLI/src/Util/GeolocationDbUpdater.php b/module/CLI/src/Util/GeolocationDbUpdater.php index 2e530a34..25b49c37 100644 --- a/module/CLI/src/Util/GeolocationDbUpdater.php +++ b/module/CLI/src/Util/GeolocationDbUpdater.php @@ -9,7 +9,7 @@ use GeoIp2\Database\Reader; use Shlinkio\Shlink\CLI\Exception\GeolocationDbUpdateFailedException; use Shlinkio\Shlink\IpGeolocation\Exception\RuntimeException; use Shlinkio\Shlink\IpGeolocation\GeoLite2\DbUpdaterInterface; -use Symfony\Component\Lock\Factory as Locker; +use Symfony\Component\Lock\LockFactory; class GeolocationDbUpdater implements GeolocationDbUpdaterInterface { @@ -19,10 +19,10 @@ class GeolocationDbUpdater implements GeolocationDbUpdaterInterface private $dbUpdater; /** @var Reader */ private $geoLiteDbReader; - /** @var Locker */ + /** @var LockFactory */ private $locker; - public function __construct(DbUpdaterInterface $dbUpdater, Reader $geoLiteDbReader, Locker $locker) + public function __construct(DbUpdaterInterface $dbUpdater, Reader $geoLiteDbReader, LockFactory $locker) { $this->dbUpdater = $dbUpdater; $this->geoLiteDbReader = $geoLiteDbReader;