Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -13,7 +15,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v6

- name: PHPStan
uses: docker://oskarstark/phpstan-ga
Expand Down
23 changes: 12 additions & 11 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -59,7 +60,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php: ['7.3']
php: ['8.1']

steps:
- name: Checkout code
Expand Down Expand Up @@ -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

Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
13 changes: 3 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -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"
}
}
9 changes: 5 additions & 4 deletions src/StopwatchPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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());
}
Expand Down