Skip to content

[2.x] Min PHP version 8.1, Symfony 6.4 / 7.1+ #463

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

Merged
merged 19 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
60d7869
:arrow_up: [#458] Update min PHP version to 8.1
andrew-demb Aug 25, 2024
f896933
:package: Add typehint to parameter in private method
andrew-demb Aug 25, 2024
3c37a86
:package: [#458] Update min Symfony version to `^6.4 || ^7.1`
andrew-demb Aug 25, 2024
606257f
:package: Hint about always non-null return type
andrew-demb Aug 25, 2024
053c8c5
:package: Avoid deprecated DI extension class
andrew-demb Aug 25, 2024
7ff923b
:package: Fix property type in phpdoc
andrew-demb Aug 25, 2024
8a11bd0
:package: Avoid invalid argument - cast possible float to the integer
andrew-demb Aug 25, 2024
c51791a
:package: Fix property type in phpdoc - there's should be an intersec…
andrew-demb Aug 25, 2024
82f8822
:bug: Fix property type and return type for parent - can be nullable
andrew-demb Aug 25, 2024
7d82664
:package: [#458] Introduce property types, use PHP 8.1 features (CPP,…
andrew-demb Aug 25, 2024
6548642
:package: [#458] Switch to `php-cs-fixer-ga` 3.26 and run it
andrew-demb Aug 25, 2024
0725be7
:package: Require phpunit 9 because `simple-phpunit` is not compatibl…
andrew-demb Aug 25, 2024
86bdeae
:lipstick: Multiline constructor parameters
andrew-demb Sep 1, 2024
a2d6c99
:package: Safe property types - property can be uninitialized. Explic…
andrew-demb Sep 1, 2024
0c522c1
:package: Explicitly specify possible null in type
andrew-demb Sep 1, 2024
3d60ca8
:package: Use native union type for parameter
andrew-demb Sep 1, 2024
c8ec829
:package: Use CPP
andrew-demb Sep 1, 2024
2491a83
:package: Multiline CPP, apply readonly
andrew-demb Sep 1, 2024
8bd3369
:package: Enforce installing `matthiasnoback/symfony-config-test` to …
andrew-demb Sep 1, 2024
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
29 changes: 10 additions & 19 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,12 @@ jobs:
include:
# Minimum supported Symfony version and lowest PHP version
- dependencies: "php-http/guzzle7-adapter php-http/discovery:^1.12"
php-version: "7.3"
php-version: "8.1"
dependency-versions: "lowest"
symfony-deprecations-helper: "weak"
stability: "stable"

# Test the latest stable release
- dependencies: "php-http/guzzle7-adapter php-http/vcr-plugin:^1.0@dev"
php-version: "7.3"
symfony-deprecations-helper: "weak"
- dependencies: "php-http/guzzle6-adapter"
php-version: "7.4"
symfony-deprecations-helper: "weak"
- dependencies: "php-http/guzzle7-adapter"
php-version: "8.0"
symfony-deprecations-helper: "weak"
- dependencies: "php-http/guzzle7-adapter"
php-version: "8.1"
symfony-deprecations-helper: "weak"
Expand All @@ -49,7 +40,7 @@ jobs:

# Test with httplug 2.x clients
- dependencies: "php-http/guzzle7-adapter php-http/curl-client:^2.0.0 php-http/vcr-plugin:^1.0@dev php-http/socket-client:^2.0"
php-version: "7.3"
php-version: "8.1"
symfony-deprecations-helper: "weak"

# Latest commit to master
Expand All @@ -63,17 +54,17 @@ jobs:
symfony-deprecations-helper: "weak"

# Test maintained versions of Symfony
- dependencies: "php-http/guzzle7-adapter symfony/http-client:^5.4"
symfony-require: "5.4.*"
php-version: "7.3"
- dependencies: "php-http/guzzle7-adapter symfony/http-client:^6.4"
symfony-require: "6.4.*"
php-version: "8.1"
symfony-deprecations-helper: "weak"
- dependencies: "php-http/guzzle7-adapter symfony/http-client:^6.0"
symfony-require: "6.3.*"
- dependencies: "php-http/guzzle7-adapter symfony/http-client:^6.4"
symfony-require: "6.4.*"
php-version: "8.2"
symfony-deprecations-helper: "weak"
- dependencies: "php-http/guzzle7-adapter symfony/http-client:^6.0"
symfony-require: "6.4.*"
php-version: "8.1"
- dependencies: "php-http/guzzle7-adapter symfony/http-client:^7.1"
symfony-require: "7.1.*"
php-version: "8.2"
symfony-deprecations-helper: "weak"

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/php-cs-fixer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ jobs:
- name: "Checkout"
uses: "actions/checkout@v3"
- name: "PHP-CS-Fixer"
uses: "docker://oskarstark/php-cs-fixer-ga:2.19.0"
uses: "docker://oskarstark/php-cs-fixer-ga:3.26.0"
with:
args: --diff --dry-run
5 changes: 3 additions & 2 deletions .php_cs.dist → .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
<?php

$finder = PhpCsFixer\Finder::create()
$finder = (new PhpCsFixer\Finder())
->exclude('src/Resources')
->exclude('vendor')
->in(__DIR__)
;

return PhpCsFixer\Config::create()
return (new PhpCsFixer\Config())
->setRiskyAllowed(true)
->setRules([
'@Symfony' => true,
'array_syntax' => ['syntax' => 'short'],
'declare_strict_types' => true,
'single_line_throw' => false,
'nullable_type_declaration_for_default_null_value' => true,
'visibility_required' => [
'elements' => [
'const',
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ The change log describes what is "Added", "Removed", "Changed" or "Fixed" betwee
# Version 2

# 2.0.0 - (unreleased)
- Increased min PHP version to 8.1
- Fixed a deprecation when creating a `HttpMethodsClient` via `http_methods_client: true`. Only PSR-17 factories are now passed as constructor arguments.
- Changed the default stream factory argument for the cache plugin. This now requires a PSR-17 StreamFactoryInterface instance.
- Creating a client using the `BuzzFactory` no longer accepts `verify_peer` and `verify_host` config options. Only a boolean `verify` flag is accepted, covering both previous options.
Expand Down
32 changes: 17 additions & 15 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
}
],
"require": {
"php": "^7.3 || ^8.0",
"php": "^8.1",
"php-http/client-common": "^2.0",
"php-http/client-implementation": "^1.0",
"php-http/discovery": "^1.14",
Expand All @@ -35,11 +35,11 @@
"php-http/stopwatch-plugin": "^1.2",
"psr/http-factory-implementation": "^1.0",
"psr/http-message": "^1.0 || ^2.0",
"symfony/config": "^5.4 || ^6.0 || ^7.0",
"symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0",
"symfony/event-dispatcher": "^5.4 || ^6.0 || ^7.0",
"symfony/http-kernel": "^5.4 || ^6.0 || ^7.0",
"symfony/options-resolver": "^5.4 || ^6.0 || ^7.0"
"symfony/config": "^6.4 || ^7.1",
"symfony/dependency-injection": "^6.4 || ^7.1",
"symfony/event-dispatcher": "^6.4 || ^7.1",
"symfony/http-kernel": "^6.4 || ^7.1",
"symfony/options-resolver": "^6.4 || ^7.1"
},
"conflict": {
"php-http/guzzle6-adapter": "<1.1",
Expand All @@ -51,21 +51,23 @@
},
"require-dev": {
"guzzlehttp/psr7": "^1.7 || ^2.0",
"matthiasnoback/symfony-config-test": "^5.2",
"matthiasnoback/symfony-dependency-injection-test": "^4.0 || ^5.0",
"nyholm/nsa": "^1.1",
"nyholm/psr7": "^1.2.1",
"php-http/cache-plugin": "^1.7",
"php-http/mock-client": "^1.2",
"php-http/promise": "^1.0",
"symfony/browser-kit": "^5.4 || ^6.0 || ^7.0",
"symfony/cache": "^5.4 || ^6.0 || ^7.0",
"symfony/dom-crawler": "^5.4 || ^6.0 || ^7.0",
"symfony/framework-bundle": "^5.4 || ^6.0 || ^7.0",
"symfony/http-foundation": "^5.4 || ^6.0 || ^7.0",
"symfony/phpunit-bridge": "^7.0.3",
"symfony/stopwatch": "^5.4 || ^6.0 || ^7.0",
"symfony/twig-bundle": "^5.4 || ^6.0 || ^7.0",
"symfony/web-profiler-bundle": "^5.4 || ^6.0 || ^7.0",
"phpunit/phpunit": "^9",
"symfony/browser-kit": "^6.4 || ^7.1",
"symfony/cache": "^6.4 || ^7.1",
"symfony/dom-crawler": "^6.4 || ^7.1",
"symfony/framework-bundle": "^6.4 || ^7.1",
"symfony/http-foundation": "^6.4 || ^7.1",
"symfony/phpunit-bridge": "^7.1",
"symfony/stopwatch": "^6.4 || ^7.1",
"symfony/twig-bundle": "^6.4 || ^7.1",
"symfony/web-profiler-bundle": "^6.4 || ^7.1",
"twig/twig": "^1.41 || ^2.10 || ^3.0"
},
"suggest": {
Expand Down
3 changes: 0 additions & 3 deletions src/ClientFactory/AutoDiscoveryFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
*/
class AutoDiscoveryFactory implements ClientFactory
{
/**
* {@inheritdoc}
*/
public function createClient(array $config = [])
{
return Psr18ClientDiscovery::find();
Expand Down
17 changes: 4 additions & 13 deletions src/ClientFactory/BuzzFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,10 @@
*/
class BuzzFactory implements ClientFactory
{
/**
* @var ResponseFactoryInterface
*/
private $responseFactory;

public function __construct(ResponseFactoryInterface $responseFactory)
public function __construct(private readonly ResponseFactoryInterface $responseFactory)
{
$this->responseFactory = $responseFactory;
}

/**
* {@inheritdoc}
*/
public function createClient(array $config = [])
{
if (!class_exists('Buzz\Client\FileGetContents')) {
Expand All @@ -43,9 +34,9 @@ private function getOptions(array $config = [])
$resolver = new OptionsResolver();

$resolver->setDefaults([
'timeout' => 5,
'verify' => true,
'proxy' => null,
'timeout' => 5,
'verify' => true,
'proxy' => null,
]);

$resolver->setAllowedTypes('timeout', 'int');
Expand Down
21 changes: 4 additions & 17 deletions src/ClientFactory/CurlFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,12 @@
*/
class CurlFactory implements ClientFactory
{
/**
* @var ResponseFactoryInterface
*/
private $responseFactory;

/**
* @var StreamFactoryInterface
*/
private $streamFactory;

public function __construct(ResponseFactoryInterface $responseFactory, StreamFactoryInterface $streamFactory)
{
$this->responseFactory = $responseFactory;
$this->streamFactory = $streamFactory;
public function __construct(
private readonly ResponseFactoryInterface $responseFactory,
private readonly StreamFactoryInterface $streamFactory
) {
}

/**
* {@inheritdoc}
*/
public function createClient(array $config = [])
{
if (!class_exists('Http\Client\Curl\Client')) {
Expand Down
3 changes: 0 additions & 3 deletions src/ClientFactory/Guzzle6Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
*/
class Guzzle6Factory implements ClientFactory
{
/**
* {@inheritdoc}
*/
public function createClient(array $config = [])
{
if (!class_exists('Http\Adapter\Guzzle6\Client')) {
Expand Down
3 changes: 0 additions & 3 deletions src/ClientFactory/Guzzle7Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
*/
class Guzzle7Factory implements ClientFactory
{
/**
* {@inheritdoc}
*/
public function createClient(array $config = [])
{
if (!class_exists('Http\Adapter\Guzzle7\Client')) {
Expand Down
8 changes: 1 addition & 7 deletions src/ClientFactory/MockFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@
*/
final class MockFactory implements ClientFactory
{
/**
* @var ClientInterface
*/
private $client;
private ?ClientInterface $client = null;

/**
* Set the client instance that this factory should return.
Expand All @@ -27,9 +24,6 @@ public function setClient(ClientInterface $client)
$this->client = $client;
}

/**
* {@inheritdoc}
*/
public function createClient(array $config = [])
{
if (!class_exists(Client::class)) {
Expand Down
9 changes: 4 additions & 5 deletions src/ClientFactory/PluginClientFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,13 @@
final class PluginClientFactory
{
/**
* @param Plugin[] $plugins
* @param ClientFactory|callable $factory
* @param array $config config to the client factory
* @param array $pluginClientOptions config forwarded to the PluginClient
* @param Plugin[] $plugins
* @param array $config config to the client factory
* @param array $pluginClientOptions config forwarded to the PluginClient
*
* @return PluginClient
*/
public static function createPluginClient(array $plugins, $factory, array $config, array $pluginClientOptions = [])
public static function createPluginClient(array $plugins, ClientFactory|callable $factory, array $config, array $pluginClientOptions = [])
{
if ($factory instanceof ClientFactory) {
$client = $factory->createClient($config);
Expand Down
3 changes: 0 additions & 3 deletions src/ClientFactory/ReactFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
*/
class ReactFactory implements ClientFactory
{
/**
* {@inheritdoc}
*/
public function createClient(array $config = [])
{
if (!class_exists('Http\Adapter\React\Client')) {
Expand Down
3 changes: 0 additions & 3 deletions src/ClientFactory/SocketFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
*/
class SocketFactory implements ClientFactory
{
/**
* {@inheritdoc}
*/
public function createClient(array $config = [])
{
if (!class_exists('Http\Client\Socket\Client')) {
Expand Down
21 changes: 4 additions & 17 deletions src/ClientFactory/SymfonyFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,12 @@
*/
class SymfonyFactory implements ClientFactory
{
/**
* @var ResponseFactoryInterface
*/
private $responseFactory;

/**
* @var StreamFactoryInterface
*/
private $streamFactory;

public function __construct(ResponseFactoryInterface $responseFactory, StreamFactoryInterface $streamFactory)
{
$this->responseFactory = $responseFactory;
$this->streamFactory = $streamFactory;
public function __construct(
private readonly ResponseFactoryInterface $responseFactory,
private readonly StreamFactoryInterface $streamFactory
) {
}

/**
* {@inheritdoc}
*/
public function createClient(array $config = [])
{
if (!class_exists(HttplugClient::class)) {
Expand Down
Loading
Loading