diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index 4e821aa..889cc33 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -3,7 +3,9 @@ name: Static analysis on: push: branches: - - master + - '[0-9]+.x' + - '[0-9]+.[0-9]+' + - '[0-9]+.[0-9]+.x' pull_request: jobs: @@ -13,7 +15,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v6 - name: PHPStan uses: docker://oskarstark/phpstan-ga diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index aa3953a..30516a4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -3,7 +3,9 @@ name: tests on: push: branches: - - master + - '[0-9]+.x' + - '[0-9]+.[0-9]+' + - '[0-9]+.[0-9]+.x' pull_request: jobs: @@ -13,23 +15,22 @@ jobs: strategy: fail-fast: false matrix: - php: ['7.3', '7.4', '8.0', '8.2'] + php: ['8.1', '8.2', '8.3', '8.4', '8.5'] symfony-version: ['*'] include: - - php: '7.4' - symfony-version: 3.4.* - - php: '7.4' - symfony-version: 4.4.* - - php: '8.0' + - php: '8.1' symfony-version: 5.4.* - - php: '8.0' + - php: '8.1' symfony-version: 6.0.* - php: '8.2' symfony-version: 7.0.* + - php: '8.5' + symfony-version: 8.0.* + steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v6 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -59,7 +60,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php: ['7.3'] + php: ['8.1'] steps: - name: Checkout code @@ -89,7 +90,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: 7.4 + php-version: "8.5" tools: composer:v2 coverage: xdebug diff --git a/CHANGELOG.md b/CHANGELOG.md index cbe445b..51119e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Change Log +## 1.5.0 + +- Support Symfony 8 +- Test with PHP 8.5 +- Remove support for PHP < 8.1 + ## 1.4.2 - 2023-12-05 - Support Symfony 7 diff --git a/composer.json b/composer.json index d34e5ef..7446055 100644 --- a/composer.json +++ b/composer.json @@ -11,8 +11,8 @@ } ], "require": { - "php": "^7.3 || ^8.0", - "symfony/stopwatch": "^3.4 || ^4.0 || ^5.0 || ^6.0 || ^7.0", + "php": "^8.1", + "symfony/stopwatch": "^3.4 || ^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0", "php-http/client-common": "^1.9 || ^2.0" }, "require-dev": { @@ -32,16 +32,9 @@ "scripts": { "test": "vendor/bin/simple-phpunit" }, - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, "config": { "allow-plugins": { "symfony/flex": true } - }, - "prefer-stable": true, - "minimum-stability": "dev" + } } diff --git a/src/StopwatchPlugin.php b/src/StopwatchPlugin.php index 01c2b52..da623ef 100644 --- a/src/StopwatchPlugin.php +++ b/src/StopwatchPlugin.php @@ -31,9 +31,12 @@ public function __construct(Stopwatch $stopwatch) } /** + * @param callable(RequestInterface): Promise $next Next middleware in the chain, the request is passed as the first argument + * @param callable(RequestInterface): Promise $first First middleware in the chain, used to restart a request + * * @return Promise Resolves a PSR-7 Response or fails with an Http\Client\Exception (The same as HttpAsyncClient) */ - protected function doHandleRequest(RequestInterface $request, callable $next, callable $first) + protected function doHandleRequest(RequestInterface $request, callable $next, callable $first): Promise { $eventName = $this->getStopwatchEventName($request); $this->stopwatch->start($eventName, self::CATEGORY); @@ -51,10 +54,8 @@ protected function doHandleRequest(RequestInterface $request, callable $next, ca /** * Generates the event name. - * - * @return string */ - private function getStopwatchEventName(RequestInterface $request) + private function getStopwatchEventName(RequestInterface $request): string { return sprintf('%s %s', $request->getMethod(), $request->getUri()->__toString()); }