Skip to content

Commit fdc1503

Browse files
authored
Merge pull request #19 from gregurco/update-dependencies
Update dependencies, switch to github actions
2 parents 4e4f0fd + b0878e4 commit fdc1503

File tree

8 files changed

+116
-185
lines changed

8 files changed

+116
-185
lines changed

.github/workflows/phpunit.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: PHPUnit
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [ master ]
7+
8+
jobs:
9+
build:
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
os: [ubuntu-latest]
14+
php:
15+
- '7.2'
16+
- '8.3'
17+
symfony:
18+
- '5.0.*'
19+
- '5.4.*' # LTS
20+
- '6.0.*'
21+
- '7.0.*'
22+
exclude:
23+
- php: '7.2'
24+
symfony: '6.0.*' # requires PHP >=8.1
25+
- php: '7.2'
26+
symfony: '7.0.*' # requires PHP >=8.2
27+
28+
runs-on: ${{ matrix.os }}
29+
30+
env:
31+
SYMFONY: ${{ matrix.symfony }}
32+
33+
steps:
34+
- uses: actions/checkout@v4
35+
36+
- name: Install PHP
37+
uses: shivammathur/setup-php@v2
38+
with:
39+
php-version: ${{ matrix.php }}
40+
ini-values: date.timezone='UTC'
41+
tools: composer:v2
42+
43+
- name: Require symfony
44+
run: composer --no-update require symfony/symfony:"${SYMFONY}"
45+
46+
- name: Install dependencies
47+
run: |
48+
composer update
49+
vendor/bin/simple-phpunit install
50+
51+
- name: Test
52+
run: |
53+
composer validate --strict --no-check-lock
54+
vendor/bin/simple-phpunit --coverage-text --verbose

.travis.yml

Lines changed: 0 additions & 49 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
This plugin integrates cache functionality into Guzzle Bundle, a bundle for building RESTful web service clients.
88

99
## Requirements
10-
- PHP 7.0 or above
10+
- PHP 7.2 or above
1111
- [Guzzle Bundle][1]
1212
- [Guzzle Cache middleware][2]
1313

composer.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,18 @@
1919
],
2020

2121
"require": {
22-
"php": "^7.0 || ^8.0",
23-
"guzzlehttp/guzzle": "~6.0 || ^7.5.0",
22+
"php": ">=7.2",
23+
"guzzlehttp/guzzle": "^6.5.8|^7.4.5",
2424
"eightpoints/guzzle-bundle": "~8.0",
25-
"symfony/http-kernel": "~4.0 || ~5.0|| ~6.0",
26-
"symfony/config": "~4.0 || ~5.0|| ~6.0",
27-
"symfony/dependency-injection": "~4.0 || ~5.0|| ~6.0",
28-
"symfony/expression-language": "~4.0 || ~5.0|| ~6.0",
29-
"kevinrob/guzzle-cache-middleware": "~4.0"
25+
"symfony/http-kernel": "~5.0|~6.0|~7.0",
26+
"symfony/config": "~5.0|~6.0|~7.0",
27+
"symfony/dependency-injection": "~5.0|~6.0|~7.0",
28+
"symfony/expression-language": "~5.0|~6.0|~7.0",
29+
"kevinrob/guzzle-cache-middleware": "~4.0|~5.0"
3030
},
3131

3232
"require-dev": {
33-
"symfony/phpunit-bridge": "~4.0|~5.0",
33+
"symfony/phpunit-bridge": "~5.0|~6.0|~7.0",
3434
"php-coveralls/php-coveralls": "~2.2"
3535
},
3636

phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.1/phpunit.xsd"
77
>
88
<php>
9-
<env name="SYMFONY_PHPUNIT_VERSION" value="7.5" />
9+
<env name="SYMFONY_DEPRECATIONS_HELPER" value="max[self]=0" />
1010
</php>
1111

1212
<testsuites>

src/DependencyInjection/GuzzleCacheExtension.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,7 @@
99

1010
class GuzzleCacheExtension extends Extension
1111
{
12-
/**
13-
* @param array $configs
14-
* @param ContainerBuilder $container
15-
*/
16-
public function load(array $configs, ContainerBuilder $container)
12+
public function load(array $configs, ContainerBuilder $container): void
1713
{
1814
$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
1915

src/Event/InvalidateRequestEvent.php

Lines changed: 51 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -3,140 +3,71 @@
33
namespace Gregurco\Bundle\GuzzleBundleCachePlugin\Event;
44

55
use Psr\Http\Message\UriInterface;
6-
use Symfony\Component\EventDispatcher\Event as BaseEvent;
7-
use Symfony\Component\EventDispatcher\EventDispatcher;
8-
use Symfony\Contracts\EventDispatcher\Event as ContractsBaseEvent;
9-
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
6+
use Symfony\Contracts\EventDispatcher\Event;
107
use GuzzleHttp\Client;
118
use GuzzleHttp\Psr7;
129
use GuzzleHttp\Psr7\Request;
1310

14-
if (is_subclass_of(EventDispatcher::class, EventDispatcherInterface::class)) {
15-
class InvalidateRequestEvent extends ContractsBaseEvent
16-
{
17-
/** @var Client */
18-
protected $client;
19-
20-
/** @var string */
21-
protected $method;
22-
23-
/** @var string */
24-
protected $uri;
25-
26-
/**
27-
* @param Client $client
28-
* @param string $method
29-
* @param string $uri
30-
*/
31-
public function __construct(Client $client, string $method, string $uri)
32-
{
33-
$this->client = $client;
34-
$this->method = $method;
35-
$this->uri = $uri;
36-
}
37-
38-
/**
39-
* @return Client
40-
*/
41-
public function getClient(): Client
42-
{
43-
return $this->client;
44-
}
11+
class InvalidateRequestEvent extends Event
12+
{
13+
/** @var Client */
14+
protected $client;
4515

46-
/**
47-
* @return string
48-
*/
49-
public function getMethod(): string
50-
{
51-
return $this->method;
52-
}
53-
54-
/**
55-
* @return string
56-
*/
57-
public function getUri(): string
58-
{
59-
return $this->uri;
60-
}
61-
62-
/**
63-
* @return Request
64-
*/
65-
public function getRequest(): Request
66-
{
67-
$baseUri = $this->client->getConfig('base_uri');
16+
/** @var string */
17+
protected $method;
6818

69-
if ($baseUri instanceof UriInterface) {
70-
$uri = Psr7\UriResolver::resolve($baseUri, Psr7\Utils::uriFor($this->uri));
71-
} else {
72-
$uri = $this->uri;
73-
}
19+
/** @var string */
20+
protected $uri;
7421

75-
return new Request($this->method, $uri);
76-
}
77-
}
78-
} else {
79-
class InvalidateRequestEvent extends BaseEvent
22+
/**
23+
* @param Client $client
24+
* @param string $method
25+
* @param string $uri
26+
*/
27+
public function __construct(Client $client, string $method, string $uri)
8028
{
81-
/** @var Client */
82-
protected $client;
83-
84-
/** @var string */
85-
protected $method;
29+
$this->client = $client;
30+
$this->method = $method;
31+
$this->uri = $uri;
32+
}
8633

87-
/** @var string */
88-
protected $uri;
34+
/**
35+
* @return Client
36+
*/
37+
public function getClient(): Client
38+
{
39+
return $this->client;
40+
}
8941

90-
/**
91-
* @param Client $client
92-
* @param string $method
93-
* @param string $uri
94-
*/
95-
public function __construct(Client $client, string $method, string $uri)
96-
{
97-
$this->client = $client;
98-
$this->method = $method;
99-
$this->uri = $uri;
100-
}
42+
/**
43+
* @return string
44+
*/
45+
public function getMethod(): string
46+
{
47+
return $this->method;
48+
}
10149

102-
/**
103-
* @return Client
104-
*/
105-
public function getClient(): Client
106-
{
107-
return $this->client;
108-
}
50+
/**
51+
* @return string
52+
*/
53+
public function getUri(): string
54+
{
55+
return $this->uri;
56+
}
10957

110-
/**
111-
* @return string
112-
*/
113-
public function getMethod(): string
114-
{
115-
return $this->method;
116-
}
58+
/**
59+
* @return Request
60+
*/
61+
public function getRequest(): Request
62+
{
63+
$baseUri = $this->client->getConfig('base_uri');
11764

118-
/**
119-
* @return string
120-
*/
121-
public function getUri(): string
122-
{
123-
return $this->uri;
65+
if ($baseUri instanceof UriInterface) {
66+
$uri = Psr7\UriResolver::resolve($baseUri, Psr7\Utils::uriFor($this->uri));
67+
} else {
68+
$uri = $this->uri;
12469
}
12570

126-
/**
127-
* @return Request
128-
*/
129-
public function getRequest(): Request
130-
{
131-
$baseUri = $this->client->getConfig('base_uri');
132-
133-
if ($baseUri instanceof UriInterface) {
134-
$uri = Psr7\UriResolver::resolve($baseUri, Psr7\Utils::uriFor($this->uri));
135-
} else {
136-
$uri = $this->uri;
137-
}
138-
139-
return new Request($this->method, $uri);
140-
}
71+
return new Request($this->method, $uri);
14172
}
14273
}

src/EventListener/InvalidateRequestSubscriber.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,4 @@ protected function getClientIdentifier(Client $client): string
6161
{
6262
return spl_object_hash($client);
6363
}
64-
6564
}

0 commit comments

Comments
 (0)