From d9d8d53d6818b64d53e3933fbd3bca2c25fbbaef Mon Sep 17 00:00:00 2001 From: Gilles Gauthier Date: Mon, 2 Jun 2025 09:03:47 +0200 Subject: [PATCH 1/4] start support SF7 --- .github/workflows/ci.yaml | 119 +++++++++++++++++--------------------- 1 file changed, 53 insertions(+), 66 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4f12e78..dc8c8cf 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,71 +1,58 @@ name: "CI Tests" on: - pull_request: - push: + pull_request: + push: -jobs: - tests: - runs-on: ubuntu-latest - continue-on-error: ${{ matrix.can-fail }} - strategy: - fail-fast: false - matrix: - include: - # Lowest Deps - - php: 7.1 - symfony: 4.4.* - composer-flags: '--prefer-stable --prefer-lowest' - can-fail: false - # LTS with latest stable PHP - - php: 8.1 - symfony: 5.4.* - composer-flags: '--prefer-stable' - can-fail: false - # Stable Symfony branches - - php: 7.4 - symfony: 4.4.* - composer-flags: '--prefer-stable' - can-fail: false - - php: 8.0 - symfony: 6.0.* - composer-flags: '--prefer-stable' - can-fail: false - # Development Symfony branches - - php: 8.1 - symfony: 6.1.*@dev - composer-flags: '' - can-fail: false - - name: "PHP ${{ matrix.php }} - Symfony ${{ matrix.symfony }}${{ matrix.composer-flags != '' && format(' - Composer {0}', matrix.composer-flags) || '' }}" - - steps: - - name: "Checkout" - uses: "actions/checkout@v2" - with: - fetch-depth: 2 - - - name: "Cache Composer packages" - uses: "actions/cache@v2" - with: - path: "~/.composer/cache" - key: "php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer-${{ hashFiles('composer.json') }}-flags-${{ matrix.composer-flags }}" - restore-keys: "php-" +env: + fail-fast: true + PHPUNIT_FLAGS: "-v" + SYMFONY_DEPRECATIONS_HELPER: weak - - name: "Install PHP" - uses: "shivammathur/setup-php@v2" - with: - php-version: "${{ matrix.php }}" - tools: "composer:v2,flex" - - - name: "Set Composer stability" - if: "matrix.symfony == '6.1.*@dev'" - run: "composer config minimum-stability dev" - - - name: "Install dependencies" - run: "composer update ${{ matrix.composer-flags }} --prefer-dist" - env: - SYMFONY_REQUIRE: "${{ matrix.symfony }}" - - - name: "Run PHPUnit Tests" - run: "composer test" +jobs: + build: + runs-on: ubuntu-latest + name: PHP v${{ matrix.php }}, Symfony v${{ matrix.symfony }} + strategy: + fail-fast: false + matrix: + include: + - { php: 8.2, symfony: "6.4.*", composer-flags: '--prefer-dist' } # Lowest deps + - { php: 8.3, symfony: "6.4.*", composer-flags: '--prefer-dist' } # LTS with last stable PHP + - { php: 8.3, symfony: "7.1.*", composer-flags: '--prefer-dist' } # Stable Symfony branches + - { php: 8.4, symfony: "7.2.*", composer-flags: '--prefer-dist' } # Stable Symfony branches + + steps: + - name: "Checkout" + uses: "actions/checkout@v4" + with: + fetch-depth: 2 + + - name: "Install PHP" + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: curl,mbstring,xdebug + ini-values: date.timezone="Europe/Paris" + coverage: xdebug + tools: "composer:v2,flex" + + - name: "Show PHP version" + run: php -v && composer -V + + - name: "Cache Composer packages" + uses: "actions/cache@v4" + with: + path: "~/.composer/cache" + key: "php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer-${{ hashFiles('composer.json') }}-flags-${{ matrix.composer-flags }}" + restore-keys: "php-" + + - name: "Install dependencies" + run: | + perl -pi -e 's/^}$/,"minimum-stability":"dev"}/' composer.json + composer update ${{ matrix.composer-flags }} --prefer-dist + env: + SYMFONY_REQUIRE: "${{ matrix.symfony }}" + + - name: "Run PHPUnit Tests" + run: "composer test" \ No newline at end of file From 14b835ca58b95ec01aa4e2f5e98705261e56623e Mon Sep 17 00:00:00 2001 From: Gilles Gauthier Date: Mon, 2 Jun 2025 09:08:46 +0200 Subject: [PATCH 2/4] add rector, ecs --- composer.json | 24 ++++++++---------- ecs.php | 34 +++++++++++++++++++++++++ phpunit.xml.dist | 31 +++++++++++++---------- psalm.xml | 66 ------------------------------------------------ rector.php | 35 +++++++++++++++++++++++++ 5 files changed, 97 insertions(+), 93 deletions(-) create mode 100644 ecs.php delete mode 100644 psalm.xml create mode 100644 rector.php diff --git a/composer.json b/composer.json index 308e1ee..59db3db 100644 --- a/composer.json +++ b/composer.json @@ -6,15 +6,15 @@ "license": "MIT", "authors": [ { - "name": "Dev Choosit", - "email": "dev@choosit.com" + "name": "Dev Spiriit", + "email": "dev@spiriit.com" } ], "require": { - "php": ">=7.1", - "symfony/http-client": "^4.4|^5.4|^6.0", + "php": "^8.1", "ext-dom": "*", - "symfony/serializer": "^4.4|^5.4|^6.0" + "symfony/http-client": "^5.4|^6.4|^7.0", + "symfony/serializer": "^5.4|^6.4|^7.0" }, "autoload": { "psr-4": { @@ -27,18 +27,14 @@ } }, "require-dev": { - "symfony/yaml": "^4.4|^5.4|^6.0", - "symfony/phpunit-bridge": "^4.4|^5.1|^6.0", + "symfony/yaml": "^5.4|^6.4|^7.0", "friendsofphp/php-cs-fixer": "*", - "symfony/framework-bundle": "^4.4|^5.4|^6.0", + "symfony/phpunit-bridge": "^5.4|^6.4|^7.0", "phpstan/phpstan": "*", + "rector/rector": "^2.0", "ekino/phpstan-banned-code": "*", - "vimeo/psalm": "*", - "psalm/plugin-symfony": "*", - "infection/infection": "*" - }, - "conflict": { - "symfony/framework-bundle": "<4.4" + "infection/infection": "*", + "symplify/easy-coding-standard": "^12.5" }, "scripts": { "test": [ diff --git a/ecs.php b/ecs.php new file mode 100644 index 0000000..63da601 --- /dev/null +++ b/ecs.php @@ -0,0 +1,34 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer; +use PhpCsFixer\Fixer\Import\OrderedImportsFixer; +use PhpCsFixer\Fixer\Phpdoc\PhpdocScalarFixer; +use Symplify\EasyCodingStandard\Config\ECSConfig; +use Symplify\EasyCodingStandard\ValueObject\Set\SetList; + +return static function (ECSConfig $config): void { + $config->sets([SetList::PSR_12]); + $config->rule(OrderedImportsFixer::class); + $config->ruleWithConfiguration(ArraySyntaxFixer::class, [ + 'syntax' => 'short', + ]); + + $config->parallel(); + $config->paths([__DIR__]); + $config->skip([ + __DIR__ . '/.github', + __DIR__ . '/vendor', + PhpdocScalarFixer::class + ]); +}; \ No newline at end of file diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 06ff48d..7dd9b83 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,20 +1,26 @@ - - src/ + ./ + + ./Resources + ./Tests + ./vendor + @@ -24,7 +30,6 @@ - diff --git a/psalm.xml b/psalm.xml deleted file mode 100644 index 3a22bca..0000000 --- a/psalm.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/rector.php b/rector.php new file mode 100644 index 0000000..bfb84e1 --- /dev/null +++ b/rector.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Rector\Config\RectorConfig; +use Rector\Set\ValueObject\SetList; +use Rector\ValueObject\PhpVersion; + +return RectorConfig::configure() + ->withSkip([ + __DIR__ . '/.github', + __DIR__ . '/DependencyInjection/Configuration.php', + __DIR__ . '/vendor', + ]) + ->withPaths([ + __DIR__ + ]) + ->withPhpVersion(PhpVersion::PHP_84) + ->withSets([SetList::PHP_84]) + ->withImportNames() + ->withPreparedSets( + deadCode: true, + typeDeclarations: true, + privatization: true, + earlyReturn: true + ); \ No newline at end of file From 735bcc5d4cae56feed1ad900afdee159428a94df Mon Sep 17 00:00:00 2001 From: Gilles Gauthier Date: Mon, 2 Jun 2025 09:11:24 +0200 Subject: [PATCH 3/4] add framework --- .gitattributes | 7 +++++++ composer.json | 1 + 2 files changed, 8 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..003d45d --- /dev/null +++ b/.gitattributes @@ -0,0 +1,7 @@ +* text=auto + +/.github export-ignore +/Tests export-ignore +/.gitattributes export-ignore +/.gitignore export-ignore +/phpunit.xml.dist export-ignore \ No newline at end of file diff --git a/composer.json b/composer.json index 59db3db..7295875 100644 --- a/composer.json +++ b/composer.json @@ -30,6 +30,7 @@ "symfony/yaml": "^5.4|^6.4|^7.0", "friendsofphp/php-cs-fixer": "*", "symfony/phpunit-bridge": "^5.4|^6.4|^7.0", + "symfony/framework-bundle": "^5.4|^6.4|^7.0", "phpstan/phpstan": "*", "rector/rector": "^2.0", "ekino/phpstan-banned-code": "*", From 4f0115cd83598db4a60282d9cbe208da67791656 Mon Sep 17 00:00:00 2001 From: Gilles Gauthier Date: Mon, 2 Jun 2025 09:14:13 +0200 Subject: [PATCH 4/4] test --- .../ModeloExtensionTest.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/tests/DependencyInjection/ModeloExtensionTest.php b/tests/DependencyInjection/ModeloExtensionTest.php index 4ac5a7f..37cda9d 100644 --- a/tests/DependencyInjection/ModeloExtensionTest.php +++ b/tests/DependencyInjection/ModeloExtensionTest.php @@ -94,22 +94,27 @@ public function testLoadMinimalConfiguration(): void private function createContainer(array $configs = []): ContainerBuilder { $container = new ContainerBuilder(new ParameterBag([ + 'kernel.bundles_metadata' => [], 'kernel.cache_dir' => __DIR__, + 'kernel.debug' => false, + 'kernel.environment' => 'test', + 'kernel.name' => 'kernel', 'kernel.root_dir' => __DIR__, 'kernel.project_dir' => __DIR__, - 'kernel.build_dir' => __DIR__, - 'kernel.runtime_environment' => 'test', - 'kernel.charset' => 'UTF-8', - 'kernel.environment' => 'test', - 'kernel.debug' => false, - 'kernel.bundles_metadata' => [], 'kernel.container_class' => 'AutowiringTestContainer', + 'kernel.charset' => 'utf8', + 'kernel.runtime_environment' => 'test', + 'env(base64:default::SYMFONY_DECRYPTION_SECRET)' => 'dummy', + 'kernel.build_dir' => __DIR__, 'debug.file_link_format' => null, + 'env(bool:default::SYMFONY_TRUST_X_SENDFILE_TYPE_HEADER)' => true, + 'env(default::SYMFONY_TRUSTED_HOSTS)' => [], + 'env(default::SYMFONY_TRUSTED_PROXIES)' => [], + 'env(default::SYMFONY_TRUSTED_HEADERS)' => [], 'kernel.bundles' => [ 'FrameworkBundle' => FrameworkBundle::class, 'ModeloBundle' => ModeloBundle::class, ], - 'env(base64:default::SYMFONY_DECRYPTION_SECRET)' => 'dummy', ])); $container->set('kernel', function()