diff --git a/.github/workflows/qa.yaml b/.github/workflows/qa.yaml index 0b4b81f..0455409 100644 --- a/.github/workflows/qa.yaml +++ b/.github/workflows/qa.yaml @@ -17,7 +17,7 @@ jobs: - name: Install PHP with extensions uses: shivammathur/setup-php@v2 with: - php-version: 7.4 + php-version: 8.1 coverage: none tools: composer:v2, cs2pr, php-cs-fixer diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 41e7c27..7b23fd6 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -13,37 +13,37 @@ jobs: fail-fast: false matrix: include: - - php: '7.1' + - php: '7.2' symfony: '2.8.*' - phpstan: .phpstan/default.neon - - php: '7.1' + phpstan: .phpstan/symfony_4.neon + - php: '7.2' symfony: '3.0.*' - phpstan: .phpstan/default.neon - - php: '7.1' + phpstan: .phpstan/symfony_4.neon + - php: '7.2' symfony: '3.1.*' - phpstan: .phpstan/default.neon - - php: '7.1' + phpstan: .phpstan/symfony_4.neon + - php: '7.2' symfony: '3.2.*' - phpstan: .phpstan/default.neon - - php: '7.1' + phpstan: .phpstan/symfony_4.neon + - php: '7.2' symfony: '3.3.*' - phpstan: .phpstan/default.neon - - php: '7.1' + phpstan: .phpstan/symfony_4.neon + - php: '7.2' symfony: '3.4.*' - phpstan: .phpstan/default.neon - - php: '7.1' + phpstan: .phpstan/symfony_4.neon + - php: '7.2' symfony: '4.0.*' - phpstan: .phpstan/default.neon - - php: '7.1' + phpstan: .phpstan/symfony_4.neon + - php: '7.2' symfony: '4.1.*' - phpstan: .phpstan/default.neon - - php: '7.1' + phpstan: .phpstan/symfony_4.neon + - php: '7.2' symfony: '4.2.*' phpstan: .phpstan/default.neon - - php: '7.1' + - php: '7.2' symfony: '4.3.*' phpstan: .phpstan/default.neon - - php: '7.1' + - php: '7.2' symfony: '4.4.*' phpstan: .phpstan/default.neon - php: '7.2' @@ -58,8 +58,11 @@ jobs: - php: '8.0' symfony: '5.2.*' phpstan: .phpstan/symfony_5.neon - - php: '8.0' - symfony: '6.0.*' + - php: '8.1' + symfony: '6.4.*' + phpstan: .phpstan/symfony_6.neon + - php: '8.2' + symfony: '7.0.*' phpstan: .phpstan/symfony_6.neon steps: - name: Checkout @@ -67,7 +70,7 @@ jobs: - name: Configure coverage driver id: coverage - run: echo ::set-output name=driver::$([ "${{ matrix.php }}" = "7.1" ] && echo "xdebug" || echo "pcov") + run: echo ::set-output name=driver::pcov - name: Install PHP with extensions uses: shivammathur/setup-php@v2 @@ -88,7 +91,7 @@ jobs: run: vendor/bin/phpunit --coverage-clover build/coverage-clover.xml - name: Send coverage results to Scrutinizer CI - if: matrix.php != '8.0' + if: matrix.php != '8.0' && matrix.php != '8.1' && matrix.php != '8.2' run: | wget https://scrutinizer-ci.com/ocular.phar php ocular.phar code-coverage:upload --format=php-clover build/coverage-clover.xml @@ -98,15 +101,15 @@ jobs: COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} COVERALLS_PARALLEL: true COVERALLS_FLAG_NAME: 'PHP ${{ matrix.php }} + ${{ matrix.symfony }}' - if: matrix.php != '8.0' + if: matrix.php != '8.0' && matrix.php != '8.1' && matrix.php != '8.2' run: | composer global require php-coveralls/php-coveralls php-coveralls -x build/coverage-clover.xml -o build/coveralls-upload.json -v - name: Install PHPStan run: | - composer global require phpstan/phpstan:"0.12.*" - composer global require phpstan/phpstan-phpunit:"0.12.*" + composer global require phpstan/phpstan:"1.10.*" + composer global require phpstan/phpstan-phpunit:"1.3.*" - name: Run PHPStan run: phpstan --memory-limit=1G analyse -c ${{ matrix.phpstan }} diff --git a/.phpstan/symfony_4.neon b/.phpstan/symfony_4.neon new file mode 100644 index 0000000..04134cd --- /dev/null +++ b/.phpstan/symfony_4.neon @@ -0,0 +1,8 @@ +# config for Symfony 2.8-4.1 + +includes: + - default.neon + +parameters: + ignoreErrors: + - '#Class Symfony\\Component\\Config\\Definition\\Builder\\TreeBuilder does not have a constructor and must be instantiated without any parameters.#' \ No newline at end of file diff --git a/composer.json b/composer.json index 4e9d4a4..26875ad 100644 --- a/composer.json +++ b/composer.json @@ -17,19 +17,19 @@ "require": { "ext-phar": "*", "ext-zlib": "*", - "php": ">=7.1.0", + "php": ">=7.2.0", "geoip2/geoip2": "~2.0", - "symfony/http-kernel": "~2.8|~3.0|~4.0|~5.0|~6.0", - "symfony/dependency-injection": "~2.8|~3.0|~4.0|~5.0|~6.0", - "symfony/expression-language": "~2.8|~3.0|~4.0|~5.0|~6.0", - "symfony/config": "~2.8|~3.0|~4.0|~5.0|~6.0", - "symfony/console": "~2.8|~3.0|~4.0|~5.0|~6.0", - "symfony/filesystem": "~2.8|~3.0|~4.0|~5.0|~6.0" + "symfony/http-kernel": "~2.8|~3.0|~4.0|~5.0|~6.0|~7.0", + "symfony/dependency-injection": "~2.8|~3.0|~4.0|~5.0|~6.0|~7.0", + "symfony/expression-language": "~2.8|~3.0|~4.0|~5.0|~6.0|~7.0", + "symfony/config": "~2.8|~3.0|~4.0|~5.0|~6.0|~7.0", + "symfony/console": "~2.8|~3.0|~4.0|~5.0|~6.0|~7.0", + "symfony/filesystem": "~2.8|~3.0|~4.0|~5.0|~6.0|~7.0" }, "require-dev": { "phpunit/phpunit": "~7.0|~8.0|~9.0", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-phpunit": "^0.12" + "phpstan/phpstan": "^1.10", + "phpstan/phpstan-phpunit": "^1.3" }, "suggest": { "splitbrain/php-archive": "Greatly reduces memory usage for the geoip2:update command" diff --git a/src/Command/UpdateDatabaseCommand.php b/src/Command/UpdateDatabaseCommand.php index e3ad51f..0471de8 100644 --- a/src/Command/UpdateDatabaseCommand.php +++ b/src/Command/UpdateDatabaseCommand.php @@ -26,13 +26,13 @@ class UpdateDatabaseCommand extends Command private $downloader; /** - * @var array[] + * @var array */ private $databases; /** - * @param Downloader $downloader - * @param array[] $databases + * @param Downloader $downloader + * @param array $databases */ public function __construct(Downloader $downloader, array $databases) { diff --git a/src/DependencyInjection/GpsLabGeoIP2Extension.php b/src/DependencyInjection/GpsLabGeoIP2Extension.php index e09fe1a..791c1cf 100644 --- a/src/DependencyInjection/GpsLabGeoIP2Extension.php +++ b/src/DependencyInjection/GpsLabGeoIP2Extension.php @@ -30,8 +30,10 @@ class GpsLabGeoIP2Extension extends Extension private const SERVICE_NAME = 'geoip2.database.%s_reader'; /** - * @param array[] $configs - * @param ContainerBuilder $container + * @param array> $configs + * @param ContainerBuilder $container + * + * @return void */ public function load(array $configs, ContainerBuilder $container): void { @@ -102,8 +104,8 @@ public function load(array $configs, ContainerBuilder $container): void } /** - * @param array[] $config - * @param ContainerBuilder $container + * @param array> $config + * @param ContainerBuilder $container * * @return Configuration */ diff --git a/src/Reader/ReaderFactory.php b/src/Reader/ReaderFactory.php index 067bdbc..a8847d6 100644 --- a/src/Reader/ReaderFactory.php +++ b/src/Reader/ReaderFactory.php @@ -16,18 +16,18 @@ class ReaderFactory { /** - * @var array[] + * @var array */ private $databases; /** - * @var string + * @var class-string */ private $reader_class; /** - * @param array[] $databases - * @param string $reader_class + * @param array $databases + * @param class-string $reader_class */ public function __construct(array $databases, string $reader_class = Reader::class) { diff --git a/tests/DependencyInjection/ConfigurationTest.php b/tests/DependencyInjection/ConfigurationTest.php index 004066e..0f6c584 100644 --- a/tests/DependencyInjection/ConfigurationTest.php +++ b/tests/DependencyInjection/ConfigurationTest.php @@ -162,8 +162,8 @@ public function getBadConfigs(): iterable /** * @dataProvider getBadConfigs * - * @param string|null $cache_dir - * @param array[] $configs + * @param string|null $cache_dir + * @param array> $configs */ public function testBadConfigs(?string $cache_dir, array $configs): void { @@ -177,7 +177,7 @@ public function testBadConfigs(?string $cache_dir, array $configs): void } /** - * @return mixed[] + * @return array> */ public function getConfigs(): iterable { @@ -430,9 +430,9 @@ public function getConfigs(): iterable /** * @dataProvider getConfigs * - * @param string|null $cache_dir - * @param array[] $configs - * @param array[] $expected + * @param string|null $cache_dir + * @param array> $configs + * @param array> $expected */ public function testConfigs(?string $cache_dir, array $configs, array $expected): void { diff --git a/tests/Reader/ReaderFactoryTest.php b/tests/Reader/ReaderFactoryTest.php index 7988b9c..2614b8b 100644 --- a/tests/Reader/ReaderFactoryTest.php +++ b/tests/Reader/ReaderFactoryTest.php @@ -18,7 +18,7 @@ class ReaderFactoryTest extends TestCase { /** - * @return array[] + * @return list>> */ public function getLocales(): array {