Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: drop support for php < 8.1, drop support for symfony < 5.4 (WIP) #243

Open
wants to merge 4 commits into
base: 2.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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
3 changes: 0 additions & 3 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Remove phpspec
run: composer remove --dev friends-of-phpspec/phpspec-code-coverage phpspec/phpspec

- name: PHPStan
uses: docker://oskarstark/phpstan-ga
Chris53897 marked this conversation as resolved.
Show resolved Hide resolved
env:
Expand Down
14 changes: 6 additions & 8 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: tests

on:
push:
branches:
- '*.x'
branches:
- '*.x'
pull_request:

jobs:
Expand All @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
php: ['8.1', '8.2', '8.3']

steps:
- name: Checkout code
Expand All @@ -36,7 +36,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php: ['7.1', '7.4', '8.2', '8.3']
php: ['8.1']

steps:
- name: Checkout code
Expand All @@ -61,10 +61,8 @@ jobs:
strategy:
matrix:
include:
- symfony: '4.4.*'
php-version: '7.1'
- symfony: '5.4.*'
php-version: '7.4'
php-version: '8.1'
- symfony: '6.4.*'
php-version: '8.2'
- symfony: '7.0.*'
Expand Down Expand Up @@ -103,7 +101,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
php-version: 8.1
tools: composer:v2
coverage: xdebug

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
/vendor/

.phpunit.result.cache
Chris53897 marked this conversation as resolved.
Show resolved Hide resolved
.phpunit.cache
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## unreleased

- drop support for php < 8.1
- drop support for symfony < 5.4
- Cleaned up phpdoc.

## 2.7.1 - 2023-11-30
Expand Down
22 changes: 11 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@
}
],
"require": {
"php": "^7.1 || ^8.0",
"php-http/httplug": "^2.0",
"php": "^8.1",
"php-http/httplug": "^2.4",
"php-http/message": "^1.6",
"psr/http-client": "^1.0",
"psr/http-factory": "^1.0",
"psr/http-message": "^1.0 || ^2.0",
"symfony/options-resolver": "~4.0.15 || ~4.1.9 || ^4.2.1 || ^5.0 || ^6.0 || ^7.0",
"symfony/polyfill-php80": "^1.17"
"psr/http-message": "^2.0",
"symfony/options-resolver": "^5.4 || ^6.0 || ^7.0"
},
"require-dev": {
"doctrine/instantiator": "^1.1",
"guzzlehttp/psr7": "^1.4",
"nyholm/psr7": "^1.2",
"phpspec/phpspec": "^5.1 || ^6.3 || ^7.1",
"phpspec/prophecy": "^1.10.2",
"phpunit/phpunit": "^7.5.20 || ^8.5.33 || ^9.6.7"
"doctrine/instantiator": "^2.0",
Chris53897 marked this conversation as resolved.
Show resolved Hide resolved
"guzzlehttp/psr7": "^2.6",
dbu marked this conversation as resolved.
Show resolved Hide resolved
"nyholm/psr7": "^1.8",
"phpspec/phpspec": "^7.5",
"phpspec/prophecy": "^1.18",
"phpunit/phpunit": "^10.5.8",
"phpspec/prophecy-phpunit": "^2.1"
},
"suggest": {
"ext-json": "To detect JSON responses with the ContentTypePlugin",
Expand Down
21 changes: 11 additions & 10 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit bootstrap="./vendor/autoload.php"
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="./vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true">
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
cacheDirectory=".phpunit.cache"
>

<testsuites>
<testsuite name="HTTPlug unit tests">
<directory>./tests</directory>
</testsuite>
</testsuites>

<testsuites>
<testsuite name="HTTPlug unit tests">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
</phpunit>
2 changes: 1 addition & 1 deletion tests/Plugin/RedirectPluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function (RequestInterface $request) {
$this->assertSame('https://example.com/other', $response->getHeaderLine('uri'));
}

public function provideRedirections(): array
public static function provideRedirections(): array
{
return [
'no path on target' => ['https://example.com/path?query=value', 'https://example.com?query=value', 'https://example.com?query=value'],
Expand Down
3 changes: 3 additions & 0 deletions tests/PluginChainTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@
use Http\Client\Common\PluginChain;
use Http\Promise\Promise;
use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Psr\Http\Message\RequestInterface;

class PluginChainTest extends TestCase
{
use ProphecyTrait;

private function createPlugin(callable $func): Plugin
{
return new class($func) implements Plugin {
Expand Down
5 changes: 4 additions & 1 deletion tests/PluginClientBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@
use Http\Client\HttpAsyncClient;
use Http\Client\HttpClient;
use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;

class PluginClientBuilderTest extends TestCase
{
use ProphecyTrait;

/** @dataProvider clientProvider */
public function testPriority(string $client): void
{
Expand Down Expand Up @@ -71,7 +74,7 @@ function (): array {
$this->assertSame(5, $options['max_restarts']);
}

public function clientProvider(): iterable
public static function clientProvider(): iterable
{
yield 'sync\'d http client' => [HttpClient::class];
yield 'async\'d http client' => [HttpAsyncClient::class];
Expand Down
2 changes: 1 addition & 1 deletion tests/PluginClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function testRestartChain(PluginClient $client, string $method, string $r
$this->assertInstanceOf($returnType, $result);
}

public function clientAndMethodProvider()
public static function clientAndMethodProvider()
{
$syncClient = new class() implements ClientInterface {
public function sendRequest(RequestInterface $request): ResponseInterface
Expand Down
Loading