From 3f4c2ffe9f2d190811817b87da04359981a60561 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 23 Jun 2026 16:10:12 +0200 Subject: [PATCH 1/2] Update dependencies to PHP 8.5 and Symfony 8.1 --- .github/workflows/ci.yml | 6 +-- .github/workflows/static.yml | 41 ++++++-------------- composer.json | 36 +++++++++-------- phpunit.xml.dist | 23 +++-------- src/Service/CodeValidator/PhpValidator.php | 2 +- tests/Service/Validator/PhpValidatorTest.php | 7 ++-- 6 files changed, 44 insertions(+), 71 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2fa0d2d..6dac287 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,16 +6,16 @@ on: jobs: build: name: Test - runs-on: Ubuntu-20.04 + runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v6 - name: Set up PHP uses: shivammathur/setup-php@v2 with: - php-version: 8.0 + php-version: 8.5 coverage: none - name: Download dependencies diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index 6d69fca..65a393d 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -6,14 +6,14 @@ on: jobs: phpstan: name: PHPStan - runs-on: Ubuntu-20.04 + runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v6 - name: Cache PHPStan - uses: actions/cache@v2 + uses: actions/cache@v5 with: path: .github/.cache/phpstan/ key: phpstan-${{ github.sha }} @@ -22,7 +22,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: 8.0 + php-version: 8.5 coverage: none - name: Download dependencies @@ -38,14 +38,14 @@ jobs: php-cs-fixer: name: PHP-CS-Fixer - runs-on: Ubuntu-20.04 + runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v6 - name: Cache PhpCsFixer - uses: actions/cache@v2 + uses: actions/cache@v5 with: path: .github/.cache/php-cs-fixer/ key: php-cs-fixer-${{ github.sha }} @@ -54,7 +54,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: 8.0 + php-version: 8.5 coverage: none - name: Download dependencies @@ -70,14 +70,14 @@ jobs: psalm: name: Psalm - runs-on: Ubuntu-20.04 + runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v6 - name: Cache Psalm - uses: actions/cache@v2 + uses: actions/cache@v5 with: path: .github/.cache/psalm/ key: psalm-${{ github.sha }} @@ -86,7 +86,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: 8.0 + php-version: 8.5 coverage: none - name: Download dependencies @@ -100,20 +100,3 @@ jobs: - name: Execute Psalm run: vendor/bin/psalm.phar --no-progress --output-format=github - composer-normalize: - name: Composer Normalize - runs-on: Ubuntu-20.04 - - steps: - - name: Set up PHP - uses: shivammathur/setup-php@v2 - with: - php-version: 8.2 - coverage: none - tools: composer-normalize - - - name: Checkout code - uses: actions/checkout@v2 - - - name: Normalize - run: composer-normalize --dry-run diff --git a/composer.json b/composer.json index cc461a1..c4f7deb 100644 --- a/composer.json +++ b/composer.json @@ -3,28 +3,28 @@ "license": "proprietary", "type": "project", "require": { - "php": ">=8.0", + "php": ">=8.5", "ext-ctype": "*", "ext-iconv": "*", "ext-libxml": "*", - "doctrine/rst-parser": "^0.4", - "nikic/php-parser": "^4.10", - "symfony-tools/docs-builder": "^0.15.0", - "symfony/console": "^5.2", - "symfony/dotenv": "^5.2", - "symfony/event-dispatcher": "^5.2", - "symfony/filesystem": "^5.2", - "symfony/finder": "^5.2", - "symfony/flex": "^1.3.1", - "symfony/framework-bundle": "^5.2", - "symfony/process": "^5.2", - "symfony/twig-bridge": "^5.4", - "symfony/yaml": "^5.2", + "doctrine/rst-parser": "^0.5", + "nikic/php-parser": "^5.7", + "symfony-tools/docs-builder": "^0.27.8", + "symfony/console": "^8.1", + "symfony/dotenv": "^8.1", + "symfony/event-dispatcher": "^8.1", + "symfony/filesystem": "^8.1", + "symfony/finder": "^8.1", + "symfony/flex": "^2", + "symfony/framework-bundle": "^8.1", + "symfony/process": "^8.1", + "symfony/twig-bridge": "^8.1", + "symfony/yaml": "^8.1", "twig/twig": "^3.3" }, "require-dev": { "bamarni/composer-bin-plugin": "^1.4.1", - "phpunit/phpunit": "^9.3.10" + "phpunit/phpunit": "^13.0" }, "replace": { "symfony/polyfill-ctype": "*", @@ -51,7 +51,11 @@ "preferred-install": { "*": "dist" }, - "sort-packages": true + "sort-packages": true, + "allow-plugins": { + "bamarni/composer-bin-plugin": true, + "symfony/flex": true + } }, "extra": { "symfony": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 4b9029b..7b68a72 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -16,26 +16,13 @@ tests + tests/Service/CodeRunner/BaseCodeRunnerTest.php - - + + src - - - - - - - - + + diff --git a/src/Service/CodeValidator/PhpValidator.php b/src/Service/CodeValidator/PhpValidator.php index 4476edb..411ddba 100644 --- a/src/Service/CodeValidator/PhpValidator.php +++ b/src/Service/CodeValidator/PhpValidator.php @@ -32,7 +32,7 @@ public function validate(CodeNode $node, IssueCollection $issues): void private function getParser(): Parser { if (null === $this->parser) { - $this->parser = (new ParserFactory())->create(ParserFactory::ONLY_PHP7); + $this->parser = (new ParserFactory())->createForNewestSupportedVersion(); } return $this->parser; diff --git a/tests/Service/Validator/PhpValidatorTest.php b/tests/Service/Validator/PhpValidatorTest.php index c39bc3c..8ab3e26 100644 --- a/tests/Service/Validator/PhpValidatorTest.php +++ b/tests/Service/Validator/PhpValidatorTest.php @@ -5,6 +5,7 @@ use Doctrine\RST\Configuration; use Doctrine\RST\Environment; use Doctrine\RST\Nodes\CodeNode; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use SymfonyTools\CodeBlockChecker\Issue\IssueCollection; use SymfonyTools\CodeBlockChecker\Service\CodeValidator\PhpValidator; @@ -53,9 +54,7 @@ public function testLocalLine() $this->assertEquals(5, $issues->first()->getLocalLine()); } - /** - * @dataProvider getCodeExamples - */ + #[DataProvider('getCodeExamples')] public function testCodeExamples(int $errors, string $code, ?string $language = null) { $node = new CodeNode(explode(PHP_EOL, $code)); @@ -65,7 +64,7 @@ public function testCodeExamples(int $errors, string $code, ?string $language = $this->assertCount($errors, $issues); } - public function getCodeExamples(): iterable + public static function getCodeExamples(): iterable { yield [0, ' namespace Symfony\Component\HttpKernel; From 18a03bba385e382f4f84d2253b5d3c4c7d0ae9bf Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 24 Jun 2026 10:31:59 +0200 Subject: [PATCH 2/2] Update GitHub CI config --- .github/workflows/ci.yml | 2 +- .github/workflows/static.yml | 37 ++------------------------- vendor-bin/php-cs-fixer/composer.json | 4 +-- vendor-bin/phpstan/composer.json | 4 +-- vendor-bin/psalm/composer.json | 9 ------- 5 files changed, 7 insertions(+), 49 deletions(-) delete mode 100644 vendor-bin/psalm/composer.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6dac287..38f37c8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: coverage: none - name: Download dependencies - uses: ramsey/composer-install@v1 + uses: ramsey/composer-install@v4 - name: Run tests run: ./vendor/bin/phpunit diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index 65a393d..64d7432 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -26,7 +26,7 @@ jobs: coverage: none - name: Download dependencies - uses: ramsey/composer-install@v1 + uses: ramsey/composer-install@v4 with: composer-options: --no-interaction --prefer-dist --optimize-autoloader @@ -58,7 +58,7 @@ jobs: coverage: none - name: Download dependencies - uses: ramsey/composer-install@v1 + uses: ramsey/composer-install@v4 with: composer-options: --no-interaction --prefer-dist --optimize-autoloader @@ -67,36 +67,3 @@ jobs: - name: Execute PHP CS Fixer run: vendor/bin/php-cs-fixer fix --diff-format udiff --dry-run - - psalm: - name: Psalm - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v6 - - - name: Cache Psalm - uses: actions/cache@v5 - with: - path: .github/.cache/psalm/ - key: psalm-${{ github.sha }} - restore-keys: psalm- - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: 8.5 - coverage: none - - - name: Download dependencies - uses: ramsey/composer-install@v1 - with: - composer-options: --no-interaction --prefer-dist --optimize-autoloader - - - name: Download Psalm - run: composer bin psalm update --no-interaction --no-progress - - - name: Execute Psalm - run: vendor/bin/psalm.phar --no-progress --output-format=github - diff --git a/vendor-bin/php-cs-fixer/composer.json b/vendor-bin/php-cs-fixer/composer.json index 3adf5f5..c00c986 100644 --- a/vendor-bin/php-cs-fixer/composer.json +++ b/vendor-bin/php-cs-fixer/composer.json @@ -1,7 +1,7 @@ { "require": { - "php": "^7.2.5 || ^8.0", - "friendsofphp/php-cs-fixer": "2.18.3" + "php": "^8.5", + "friendsofphp/php-cs-fixer": "3.95.10" }, "config": { "preferred-install": "dist" diff --git a/vendor-bin/phpstan/composer.json b/vendor-bin/phpstan/composer.json index d39b4c2..b18300c 100644 --- a/vendor-bin/phpstan/composer.json +++ b/vendor-bin/phpstan/composer.json @@ -1,7 +1,7 @@ { "require": { - "php": "^7.2.5 || ^8.0", - "phpstan/phpstan": "0.12.81" + "php": "^8.5", + "phpstan/phpstan": "2.2.2" }, "config": { "preferred-install": "dist" diff --git a/vendor-bin/psalm/composer.json b/vendor-bin/psalm/composer.json deleted file mode 100644 index 535a079..0000000 --- a/vendor-bin/psalm/composer.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "require": { - "php": "^7.2.5 || ^8.0", - "psalm/phar": "4.6.2" - }, - "config": { - "preferred-install": "dist" - } -}