diff --git a/.github/workflows/code_checks.yaml b/.github/workflows/code_checks.yaml index 104ca89..b8fa110 100644 --- a/.github/workflows/code_checks.yaml +++ b/.github/workflows/code_checks.yaml @@ -10,7 +10,7 @@ jobs: fail-fast: false matrix: include: - - php: '8.2' + - php: '8.5' stability: prefer-stable name: PHP ${{ matrix.php }} tests - ${{ matrix.stability }} diff --git a/.github/workflows/code_coverage.yaml b/.github/workflows/code_coverage.yaml index 0088707..7b344e9 100644 --- a/.github/workflows/code_coverage.yaml +++ b/.github/workflows/code_coverage.yaml @@ -10,7 +10,7 @@ jobs: - uses: actions/checkout@v4 - uses: shivammathur/setup-php@v2 with: - php-version: 8.2 + php-version: 8.5 coverage: pcov # Implicitly runs `composer tests` in post update cmd. So PHPCS, MD and other static analysis is executed at diff --git a/.github/workflows/tests-upcoming-symfony.yaml b/.github/workflows/tests-upcoming-symfony.yaml index d13e6d0..cd24085 100644 --- a/.github/workflows/tests-upcoming-symfony.yaml +++ b/.github/workflows/tests-upcoming-symfony.yaml @@ -18,21 +18,21 @@ jobs: uses: shivammathur/setup-php@2.22.0 with: coverage: none - php-version: '8.2' + php-version: '8.5' tools: composer:v2 extensions: mbstring ini-values: date.timezone=UTC - name: 'Install project dependencies' env: - SYMFONY_REQUIRE: '6.4.x@dev' + SYMFONY_REQUIRE: '8.*' run: | composer global config --no-plugins allow-plugins.symfony/flex true composer global require --no-progress --no-scripts --no-plugins symfony/flex composer config minimum-stability dev composer config prefer-stable false - composer update --no-interaction --optimize-autoloader - composer require symfony/phpunit-bridge + composer update --no-interaction --optimize-autoloader --no-scripts + composer require --no-scripts symfony/phpunit-bridge - name: 'Run tests' env: diff --git a/CHANGELOG.md b/CHANGELOG.md index 65d1384..56d8a84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ # Changelog +# Unreleased +- Raise the Composer platform to PHP 8.5. +- Update the code checks, code coverage and upcoming Symfony workflows to run on PHP 8.5. + # 4.0.0 - Drop SF4 support, Allow SF7. - Raise minimum PHP requirement to 8.2 diff --git a/composer.json b/composer.json index 3040a38..8d94053 100644 --- a/composer.json +++ b/composer.json @@ -17,6 +17,7 @@ "php-parallel-lint/php-parallel-lint": "^1.3", "phpmd/phpmd": "^2.13", "phpunit/phpunit": "^9.6|^10.4", + "rector/rector": "^2.4", "sebastian/phpcpd": "^4.1|^5.0|^6.0", "squizlabs/php_codesniffer": "^3.6", "malukenho/docheader": "^1.0", @@ -38,15 +39,17 @@ "phpcs": "vendor/bin/phpcs src tests --report=full --standard=phpcs.xml --extensions=php --warning-severity=0", "phpcpd": "vendor/bin/phpcpd src", "phpunit": "vendor/bin/phpunit --coverage-text", - "phpmd": "vendor/bin/phpmd src text phpmd.xml" + "phpmd": "@php -d \"error_reporting=E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED\" vendor/bin/phpmd src text phpmd.xml" }, + "rector": "vendor/bin/rector process --dry-run", + "rector-fix": "vendor/bin/rector process", "post-update-cmd": [ "@tests" ] }, "config": { "platform": { - "php": "8.2" + "php": "8.5" }, "preferred-install": { "*": "dist" diff --git a/rector.php b/rector.php new file mode 100644 index 0000000..70bd6fc --- /dev/null +++ b/rector.php @@ -0,0 +1,14 @@ +withPaths([__DIR__.'/config', __DIR__.'/src', __DIR__.'/tests']) + ->withPhpSets() + ->withComposerBased(doctrine: true, symfony: true, phpunit: true) + ->withAttributesSets(doctrine: true, symfony: true, phpunit: true) + ->withSkip([ + \Rector\Php84\Rector\MethodCall\NewMethodCallWithoutParenthesesRector::class, + ]); diff --git a/src/HealthCheck/SessionHealthCheck.php b/src/HealthCheck/SessionHealthCheck.php index d980a8b..bda6cdf 100644 --- a/src/HealthCheck/SessionHealthCheck.php +++ b/src/HealthCheck/SessionHealthCheck.php @@ -42,7 +42,7 @@ public function check(HealthReportInterface $report): HealthReportInterface if ($sessionStatus !== PHP_SESSION_DISABLED && $sessionStatus === PHP_SESSION_NONE) { try { session_start(); - } catch (Exception $e) { + } catch (Exception) { return HealthReport::buildStatusDown('Session support is enabled but no session could be started.'); } // Destroy the session diff --git a/src/Value/HealthReport.php b/src/Value/HealthReport.php index 3d0516e..07b65b5 100644 --- a/src/Value/HealthReport.php +++ b/src/Value/HealthReport.php @@ -26,21 +26,6 @@ */ class HealthReport implements HealthReportInterface, JsonSerializable { - /** - * @var string - */ - private $status; - - /** - * @var int - */ - private $code; - - /** - * @var string - */ - private $message = ''; - public static function buildStatusUp(): HealthReportInterface { return new self(HealthReportInterface::STATUS_UP, HealthReportInterface::STATUS_CODE_UP); @@ -51,11 +36,11 @@ public static function buildStatusDown($message = ''): HealthReportInterface return new self(HealthReportInterface::STATUS_DOWN, HealthReportInterface::STATUS_CODE_DOWN, $message); } - private function __construct(string $status, $code, string $message = '') + /** + * @param int $code + */ + private function __construct(private readonly string $status, private $code, private readonly string $message = '') { - $this->status = $status; - $this->code = $code; - $this->message = $message; } public function isDown(): bool