Skip to content

Commit

Permalink
Merge pull request #89 from Lustmored/symfony-7
Browse files Browse the repository at this point in the history
Allow Symfony 7
  • Loading branch information
peter-gribanov authored Dec 22, 2023
2 parents 947ba5d + 9b7b6c8 commit ae2a9e8
Show file tree
Hide file tree
Showing 9 changed files with 67 additions and 54 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/qa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
55 changes: 29 additions & 26 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -58,16 +58,19 @@ 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
uses: actions/checkout@v2

- 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
Expand All @@ -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
Expand All @@ -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 }}
8 changes: 8 additions & 0 deletions .phpstan/symfony_4.neon
Original file line number Diff line number Diff line change
@@ -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.#'
18 changes: 9 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions src/Command/UpdateDatabaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ class UpdateDatabaseCommand extends Command
private $downloader;

/**
* @var array[]
* @var array<string, ?array{url?: string|false, path?: string|false, locales?: string[], license?: ?string, edition?: string}>
*/
private $databases;

/**
* @param Downloader $downloader
* @param array[] $databases
* @param Downloader $downloader
* @param array<string, ?array{url?: string|false, path?: string|false, locales?: string[], license?: ?string, edition?: string}> $databases
*/
public function __construct(Downloader $downloader, array $databases)
{
Expand Down
10 changes: 6 additions & 4 deletions src/DependencyInjection/GpsLabGeoIP2Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ class GpsLabGeoIP2Extension extends Extension
private const SERVICE_NAME = 'geoip2.database.%s_reader';

/**
* @param array[] $configs
* @param ContainerBuilder $container
* @param array<array<mixed>> $configs
* @param ContainerBuilder $container
*
* @return void
*/
public function load(array $configs, ContainerBuilder $container): void
{
Expand Down Expand Up @@ -102,8 +104,8 @@ public function load(array $configs, ContainerBuilder $container): void
}

/**
* @param array[] $config
* @param ContainerBuilder $container
* @param array<array<mixed>> $config
* @param ContainerBuilder $container
*
* @return Configuration
*/
Expand Down
8 changes: 4 additions & 4 deletions src/Reader/ReaderFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@
class ReaderFactory
{
/**
* @var array[]
* @var array<string, ?array{url?: string|false, path?: string|false, locales?: string[], license?: ?string, edition?: string}>
*/
private $databases;

/**
* @var string
* @var class-string<Reader>
*/
private $reader_class;

/**
* @param array[] $databases
* @param string $reader_class
* @param array<string, ?array{url?: string|false, path?: string|false, locales?: string[], license?: ?string, edition?: string}> $databases
* @param class-string<Reader> $reader_class
*/
public function __construct(array $databases, string $reader_class = Reader::class)
{
Expand Down
12 changes: 6 additions & 6 deletions tests/DependencyInjection/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<array<mixed>> $configs
*/
public function testBadConfigs(?string $cache_dir, array $configs): void
{
Expand All @@ -177,7 +177,7 @@ public function testBadConfigs(?string $cache_dir, array $configs): void
}

/**
* @return mixed[]
* @return array<array<mixed>>
*/
public function getConfigs(): iterable
{
Expand Down Expand Up @@ -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<array<mixed>> $configs
* @param array<array<mixed>> $expected
*/
public function testConfigs(?string $cache_dir, array $configs, array $expected): void
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Reader/ReaderFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
class ReaderFactoryTest extends TestCase
{
/**
* @return array[]
* @return list<list<?list<string>>>
*/
public function getLocales(): array
{
Expand Down

0 comments on commit ae2a9e8

Please sign in to comment.