From 2833ceb41f524a192f3eb8359d5eed96bc9b519f Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 31 Mar 2026 16:37:32 +0200 Subject: [PATCH] Update project requirements to PHP 8.5 and Symfony 8.0 --- .github/workflows/ci.yml | 2 +- composer.json | 28 ++++++++++---------- phpunit.xml.dist | 23 ++++------------ src/Service/CodeValidator/PhpValidator.php | 2 +- tests/Service/Validator/PhpValidatorTest.php | 7 +++-- 5 files changed, 24 insertions(+), 38 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2fa0d2d..4319040 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: - 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/composer.json b/composer.json index cc461a1..9bd5db4 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", + "doctrine/rst-parser": "^0.5", + "nikic/php-parser": "^5.7", + "symfony-tools/docs-builder": "^0.27.6", + "symfony/console": "^8.0", + "symfony/dotenv": "^8.0", + "symfony/event-dispatcher": "^8.0", + "symfony/filesystem": "^8.0", + "symfony/finder": "^8.0", "symfony/flex": "^1.3.1", - "symfony/framework-bundle": "^5.2", - "symfony/process": "^5.2", - "symfony/twig-bridge": "^5.4", - "symfony/yaml": "^5.2", + "symfony/framework-bundle": "^8.0", + "symfony/process": "^8.0", + "symfony/twig-bridge": "^8.0", + "symfony/yaml": "^8.0", "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": "*", 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;