Skip to content

Commit 15805f1

Browse files
authored
Merge pull request #9 from answear/support-symfony-7
Support symfony 7
2 parents 8b8b857 + 9d08674 commit 15805f1

39 files changed

+224
-416
lines changed

.github/workflows/phpunit.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,10 @@ jobs:
1111
strategy:
1212
matrix:
1313
php-version:
14-
- "7.4"
15-
- "8.0"
16-
- "8.1"
14+
- "8.2"
1715
deps:
1816
- "normal"
19-
include:
20-
- deps: "low"
21-
php-version: "7.4"
17+
- "low"
2218

2319
steps:
2420
- name: "Checkout"

.github/workflows/static-analysis.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ jobs:
1111
strategy:
1212
matrix:
1313
php-version:
14-
- "7.4"
15-
- "8.0"
16-
- "8.1"
14+
- "8.2"
1715

1816
steps:
1917
- name: "Checkout"

composer.json

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,22 @@
44
"type": "symfony-bundle",
55
"license": "MIT",
66
"require": {
7-
"php": ">=7.4|^8.0",
7+
"php": "^8.2",
88
"ext-json": "*",
99
"guzzlehttp/guzzle": "^6.0|^7.0",
10-
"marc-mabe/php-enum": "^3.0|^4.3",
11-
"symfony/http-kernel": "^5.4|^6.0",
12-
"symfony/property-access": "^5.4|^6.0",
13-
"symfony/serializer": "^5.4|^6.0",
14-
"webmozart/assert": "^1.3"
10+
"symfony/http-kernel": "^6.0|^7.0",
11+
"symfony/property-access": "^6.0|^7.0",
12+
"symfony/serializer": "^6.0|^7.0",
13+
"webmozart/assert": "^1.11"
1514
},
1615
"require-dev": {
17-
"friendsofphp/php-cs-fixer": "^3.4",
18-
"phpro/grumphp": "^1.5.0",
19-
"phpstan/phpstan": "^1.4",
20-
"phpstan/phpstan-webmozart-assert": "^1.0",
21-
"phpunit/phpunit": "^9.5",
16+
"friendsofphp/php-cs-fixer": "^3.64",
17+
"phpro/grumphp": "^2.8",
18+
"phpstan/phpstan": "^1.12",
19+
"phpstan/phpstan-webmozart-assert": "^1.2",
20+
"phpunit/phpunit": "^10.5",
2221
"roave/security-advisories": "dev-master",
23-
"symfony/phpunit-bridge": "6.1.*"
22+
"symfony/phpunit-bridge": "6.1.*|^7.0"
2423
},
2524
"autoload": {
2625
"psr-4": {

phpunit.xml.dist

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,21 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.1/phpunit.xsd"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
44
bootstrap="./vendor/autoload.php"
55
backupGlobals="false"
6-
beStrictAboutCoversAnnotation="true"
76
beStrictAboutOutputDuringTests="true"
87
beStrictAboutTestsThatDoNotTestAnything="true"
9-
beStrictAboutTodoAnnotatedTests="true"
108
colors="true"
11-
convertErrorsToExceptions="true"
12-
convertNoticesToExceptions="true"
13-
convertWarningsToExceptions="true"
14-
verbose="true"
9+
cacheDirectory=".phpunit.cache"
10+
beStrictAboutCoverageMetadata="true"
1511
>
1612
<php>
1713
<ini name="error_reporting" value="-1"/>
14+
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak"/>
1815
</php>
19-
2016
<testsuites>
2117
<testsuite name="Answear.com SpeedyBundle Test Suite">
2218
<directory>./tests</directory>
2319
</testsuite>
2420
</testsuites>
25-
26-
<listeners>
27-
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener"/>
28-
</listeners>
2921
</phpunit>

src/Client/AuthenticationDecorator.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,15 @@
99

1010
class AuthenticationDecorator
1111
{
12-
private ConfigProvider $configuration;
13-
14-
public function __construct(ConfigProvider $configuration)
12+
public function __construct(private ConfigProvider $configuration)
1513
{
16-
$this->configuration = $configuration;
1714
}
1815

1916
public function decorate(Request $request): void
2017
{
21-
$request->setUserName($this->configuration->getUsername());
22-
$request->setPassword($this->configuration->getPassword());
23-
$request->setLanguage($this->configuration->getLanguage());
24-
$request->setClientSystemId($this->configuration->getClientSystemId());
18+
$request->userName = $this->configuration->username;
19+
$request->password = $this->configuration->password;
20+
$request->language = $this->configuration->language;
21+
$request->clientSystemId = $this->configuration->clientSystemId;
2522
}
2623
}

src/Client/Client.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,16 @@ class Client
1616
{
1717
private const CONNECTION_TIMEOUT = 10;
1818
private const TIMEOUT = 30;
19-
20-
private ConfigProvider $configuration;
21-
private ClientInterface $client;
2219

2320
public function __construct(
24-
ConfigProvider $configuration,
25-
?ClientInterface $client = null
21+
private ConfigProvider $configuration,
22+
private ?ClientInterface $client = null,
2623
) {
27-
$this->configuration = $configuration;
2824
$this->client = $client ?? new GuzzleClient(
2925
[
3026
'base_uri' => $configuration->getUrl(),
3127
'timeout' => self::TIMEOUT,
32-
'connect_timeout' => self::CONNECTION_TIMEOUT
28+
'connect_timeout' => self::CONNECTION_TIMEOUT,
3329
]
3430
);
3531
}

src/Client/RequestTransformer.php

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,11 @@
1111

1212
class RequestTransformer
1313
{
14-
private Serializer $serializer;
15-
private AuthenticationDecorator $decorator;
16-
private ConfigProvider $configuration;
17-
1814
public function __construct(
19-
Serializer $serializer,
20-
AuthenticationDecorator $decorator,
21-
ConfigProvider $configuration
15+
private Serializer $serializer,
16+
private AuthenticationDecorator $decorator,
17+
private ConfigProvider $configuration,
2218
) {
23-
$this->serializer = $serializer;
24-
$this->decorator = $decorator;
25-
$this->configuration = $configuration;
2619
}
2720

2821
public function transform(Request $request): HttpRequest

src/Command/FindOffice.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,10 @@
1111

1212
class FindOffice extends AbstractCommand
1313
{
14-
private Client $client;
15-
private RequestTransformer $transformer;
16-
17-
public function __construct(Client $client, RequestTransformer $transformer)
18-
{
19-
$this->client = $client;
20-
$this->transformer = $transformer;
14+
public function __construct(
15+
private Client $client,
16+
private RequestTransformer $transformer,
17+
) {
2118
}
2219

2320
public function findOffice(FindOfficeRequest $request): FindOfficeResponse

src/Command/GetAllPostCodes.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,10 @@
1212

1313
class GetAllPostCodes extends AbstractCommand
1414
{
15-
private Client $client;
16-
private RequestTransformer $transformer;
17-
18-
public function __construct(Client $client, RequestTransformer $transformer)
19-
{
20-
$this->client = $client;
21-
$this->transformer = $transformer;
15+
public function __construct(
16+
private Client $client,
17+
private RequestTransformer $transformer,
18+
) {
2219
}
2320

2421
public function getAllPostCodes(GetAllPostCodesRequest $request): GetAllPostCodesResponse

src/Command/GetAllSites.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,10 @@
1212

1313
class GetAllSites extends AbstractCommand
1414
{
15-
private Client $client;
16-
private RequestTransformer $transformer;
17-
18-
public function __construct(Client $client, RequestTransformer $transformer)
19-
{
20-
$this->client = $client;
21-
$this->transformer = $transformer;
15+
public function __construct(
16+
private Client $client,
17+
private RequestTransformer $transformer,
18+
) {
2219
}
2320

2421
public function getAllSites(GetAllSitesRequest $request): GetAllSitesResponse

0 commit comments

Comments
 (0)