Skip to content

Commit

Permalink
Merge pull request #337 from 8p/support-symfony-7
Browse files Browse the repository at this point in the history
Support Symfony 7
  • Loading branch information
gregurco authored Dec 4, 2023
2 parents b890cc8 + 50eb924 commit 31df3ad
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 72 deletions.
22 changes: 8 additions & 14 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,18 @@ jobs:
matrix:
os: [ubuntu-latest]
php:
- '7.1'
- '7.4'
- '8.0'
- '8.1'
- '7.2'
- '8.3'
symfony:
- '4.4.*'
- '5.0.*'
- '5.4.*'
- '5.4.*' # LTS
- '6.0.*'
- '7.0.*'
exclude:
- php: '7.1'
symfony: '5.0.*' # requires PHP ^7.2.5
- php: '7.1'
symfony: '5.4.*' # requires PHP ^7.2.5
- php: '7.1'
symfony: '6.0.*' # requires PHP ^7.2.5
- php: '7.4'
symfony: '6.0.*' # requires PHP ^8.0.2
- php: '7.2'
symfony: '6.0.*' # requires PHP >=8.1
- php: '7.2'
symfony: '7.0.*' # requires PHP >=8.2

runs-on: ${{ matrix.os }}

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ GuzzleBundle follows semantic versioning. Read more on [semver.org][2].

## Prerequisites
- PHP 7.1 or higher
- Symfony 4.x or 5.x or 6.x
- Symfony 5.x or 6.x or 7.x

----

Expand Down
18 changes: 9 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "eightpoints/guzzle-bundle",
"type": "symfony-bundle",
"description": "Integrates Guzzle 6.x, a PHP HTTP Client, into Symfony 2/3/4. Comes with easy and powerful configuration options and optional plugins.",
"description": "Integrates Guzzle 6.x, a PHP HTTP Client, into Symfony. Comes with easy and powerful configuration options and optional plugins.",
"keywords": [
"bundle",
"guzzle",
Expand All @@ -26,20 +26,20 @@
}
],
"require": {
"php": ">=7.1",
"php": ">=7.2",
"guzzlehttp/guzzle": "^6.5.8|^7.4.5",
"guzzlehttp/promises": "^1.5.3|^2.0",
"guzzlehttp/psr7": "^1.9.1|^2.5",
"symfony/framework-bundle": "~4.0|~5.0|~6.0",
"symfony/expression-language": "~4.0|~5.0|~6.0",
"symfony/stopwatch": "~4.0|~5.0|~6.0",
"symfony/framework-bundle": "~5.0|~6.0|~7.0",
"symfony/expression-language": "~5.0|~6.0|~7.0",
"symfony/stopwatch": "~5.0|~6.0|~7.0",
"psr/log": "~1.0|~2.0|~3.0"
},
"require-dev": {
"symfony/phpunit-bridge": "~4.0|~5.0|~6.0",
"symfony/twig-bundle": "~4.0|~5.0|~6.0",
"symfony/var-dumper": "~4.0|~5.0|~6.0",
"symfony/yaml": "~4.0|~5.0|~6.0"
"symfony/phpunit-bridge": "~5.0|~6.0|~7.0",
"symfony/twig-bundle": "~5.0|~6.0|~7.0",
"symfony/var-dumper": "~5.0|~6.0|~7.0",
"symfony/yaml": "~5.0|~6.0|~7.0"
},
"suggest": {
"namshi/cuzzle": "Outputs Curl command on profiler's page for debugging purposes"
Expand Down
44 changes: 12 additions & 32 deletions src/DataCollector/DataCollectorSymfonyCompatibilityTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,20 @@

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Kernel;

/**
* @TODO remove this trait with dropping of support Symfony < 4.4
*/
trait DataCollectorSymfonyCompatibilityTrait
{
abstract protected function doCollect(Request $request, Response $response, \Throwable $exception = null);

if (Kernel::VERSION_ID >= 40308) {
trait DataCollectorSymfonyCompatibilityTrait
/**
* @param Request $request
* @param Response $response
* @param \Throwable|null $exception
*
* @return void
*/
public function collect(Request $request, Response $response, \Throwable $exception = null)
{
abstract protected function doCollect(Request $request, Response $response, \Throwable $exception = null);

/**
* @param Request $request
* @param Response $response
* @param \Throwable|null $exception
*/
public function collect(Request $request, Response $response, \Throwable $exception = null)
{
$this->doCollect($request, $response, $exception);
}
}
} else {
trait DataCollectorSymfonyCompatibilityTrait
{
abstract protected function doCollect(Request $request, Response $response, \Throwable $exception = null);

/**
* @param Request $request
* @param Response $response
* @param \Exception|null $exception
*/
public function collect(Request $request, Response $response, \Exception $exception = null)
{
$this->doCollect($request, $response, $exception);
}
$this->doCollect($request, $response, $exception);
}
}
1 change: 0 additions & 1 deletion src/DataCollector/HttpDataCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace EightPoints\Bundle\GuzzleBundle\DataCollector;

use EightPoints\Bundle\GuzzleBundle\Log\LogGroup;
use EightPoints\Bundle\GuzzleBundle\Log\LoggerInterface;
use EightPoints\Bundle\GuzzleBundle\Log\LogMessage;
use Psr\Log\LogLevel;
use Symfony\Component\HttpKernel\DataCollector\DataCollector;
Expand Down
5 changes: 3 additions & 2 deletions src/EightPointsGuzzleBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace EightPoints\Bundle\GuzzleBundle;

use EightPoints\Bundle\GuzzleBundle\DependencyInjection\EightPointsGuzzleExtension;
use EightPoints\Bundle\GuzzleBundle\DependencyInjection\Compiler\EventHandlerCompilerPass;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\DependencyInjection\ContainerBuilder;
Expand Down Expand Up @@ -57,7 +56,9 @@ public function getContainerExtension() : ExtensionInterface
}

/**
* @inheritdoc
* {@inheritdoc}
*
* @return void
*/
public function boot()
{
Expand Down
17 changes: 5 additions & 12 deletions src/Events/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,17 @@

namespace EightPoints\Bundle\GuzzleBundle\Events;

use Symfony\Component\EventDispatcher\Event as BaseEvent;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Contracts\EventDispatcher\Event as ContractsBaseEvent;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
use Symfony\Contracts\EventDispatcher\Event as BaseEvent;

/**
* @see: https://github.com/8p/EightPointsGuzzleBundle/pull/261
* @see: https://github.com/8p/EightPointsGuzzleBundle/pull/265
*
* SF 4.3 introduced Contracts and deprecated interfaces used before.
* This file is a layer to support different versions and don't cause deprecation messages.
*
* @TODO remove that file in the next major release
*/
if (is_subclass_of(EventDispatcher::class, EventDispatcherInterface::class)) {
class Event extends ContractsBaseEvent
{
}
} else {
class Event extends BaseEvent
{
}
class Event extends BaseEvent
{
}
2 changes: 1 addition & 1 deletion src/Log/DevNullLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class DevNullLogger implements LoggerInterface
use LoggerTrait;

/**
* @inheritDoc
* {@inheritdoc}
*/
public function log($level, $message, array $context = []): void
{
Expand Down

0 comments on commit 31df3ad

Please sign in to comment.