From eb00a335e35aa83b1e14a412a6d0fecfaa9e82e3 Mon Sep 17 00:00:00 2001 From: Damien Lagae Date: Fri, 13 Mar 2026 12:24:05 +0100 Subject: [PATCH 1/2] fix: replace addCommand() with add() for symfony/console 7.x compatibility --- src/Application.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Application.php b/src/Application.php index cdec268..a0cd881 100644 --- a/src/Application.php +++ b/src/Application.php @@ -25,9 +25,9 @@ public function __construct() { parent::__construct(self::NAME, self::VERSION); - $this->addCommand(new InitCommand()); - $this->addCommand(new CiUpdateCommand()); - $this->addCommand(new CiAddCommand()); + $this->add(new InitCommand()); + $this->add(new CiUpdateCommand()); + $this->add(new CiAddCommand()); $this->setDefaultCommand('init'); } } From 3c1c8a04ca724074309b20d53a17874de1af9858 Mon Sep 17 00:00:00 2001 From: Damien LAGAE Date: Fri, 13 Mar 2026 12:34:53 +0100 Subject: [PATCH 2/2] fix: use getDefaultCommands() for proper Symfony 7/8 compatibility Replace add() calls with getDefaultCommands() override, which is the correct hook point for Application subclasses and avoids PHPStan issues with inherited method resolution. Add bootstrapFiles to phpstan.neon to ensure symfony/console types are loaded when PHPStan runs from the isolated tools/phpstan/ directory. Add Symfony version matrix (^7.0, ^8.0) to CI test job to verify compatibility across both supported major versions. --- .github/workflows/ci.yml | 13 ++++++++++++- phpstan.neon | 2 ++ src/Application.php | 13 +++++++++---- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cd99a6a..7ee32d6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -82,6 +82,10 @@ jobs: test: needs: build runs-on: ubuntu-latest + strategy: + matrix: + symfony-version: ['^7.0', '^8.0'] + name: test (Symfony ${{ matrix.symfony-version }}) steps: - uses: actions/checkout@v4 @@ -91,8 +95,15 @@ jobs: php-version: '8.4' extensions: intl, zip + - name: Require Symfony ${{ matrix.symfony-version }} + run: | + composer require \ + symfony/console:${{ matrix.symfony-version }} \ + symfony/filesystem:${{ matrix.symfony-version }} \ + --no-update --no-interaction + - name: Install dependencies - run: composer install --prefer-dist --no-progress + run: composer update --prefer-dist --no-progress - name: Run tests run: vendor/bin/phpunit --testdox diff --git a/phpstan.neon b/phpstan.neon index 7d4449f..1cf5cab 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -3,6 +3,8 @@ parameters: paths: - src - tests + bootstrapFiles: + - vendor/autoload.php excludePaths: - tests/bootstrap.php diff --git a/src/Application.php b/src/Application.php index a0cd881..5f6348b 100644 --- a/src/Application.php +++ b/src/Application.php @@ -24,10 +24,15 @@ final class Application extends BaseApplication public function __construct() { parent::__construct(self::NAME, self::VERSION); - - $this->add(new InitCommand()); - $this->add(new CiUpdateCommand()); - $this->add(new CiAddCommand()); $this->setDefaultCommand('init'); } + + protected function getDefaultCommands(): array + { + return array_merge(parent::getDefaultCommands(), [ + new InitCommand(), + new CiUpdateCommand(), + new CiAddCommand(), + ]); + } }