Skip to content

Commit 884c77e

Browse files
committed
Support symfony 7
1 parent a210d11 commit 884c77e

20 files changed

+125
-330
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
steps:
1816
- name: "Checkout"
1917
uses: "actions/checkout@v2"

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
.phpunit.result.cache
44
composer.lock
55
.php-cs-fixer.cache
6+
/.phpunit.cache
7+
.idea

.php-cs-fixer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
'strict_param' => false,
1818
'array_syntax' => ['syntax' => 'short'],
1919
'concat_space' => ['spacing' => 'one'],
20-
'phpdoc_align' => [],
20+
'phpdoc_align' => ['align' => 'left'],
2121
'phpdoc_summary' => false,
2222
'void_return' => false,
2323
'phpdoc_var_without_name' => false,

composer.json

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,20 @@
44
"type": "symfony-bundle",
55
"license": "MIT",
66
"require": {
7-
"php": "^7.4 || ^8.0",
7+
"php": "^8.2",
88
"ext-simplexml": "*",
99
"guzzlehttp/guzzle": "^6.0|^7.0",
10-
"marc-mabe/php-enum": "^4.3",
11-
"symfony/http-kernel": "^5.4|^6.0",
12-
"webmozart/assert": "^1.3"
10+
"symfony/http-kernel": "^6.4|^7.0",
11+
"webmozart/assert": "^1.11"
1312
},
1413
"require-dev": {
15-
"friendsofphp/php-cs-fixer": "^3.4",
16-
"phpstan/phpstan": "^1.4",
17-
"phpstan/phpstan-webmozart-assert": "^1.0",
18-
"phpro/grumphp": "^1.5.0",
19-
"phpunit/phpunit": "^9.5",
14+
"friendsofphp/php-cs-fixer": "^3.64",
15+
"phpstan/phpstan": "^1.12",
16+
"phpstan/phpstan-webmozart-assert": "^1.2",
17+
"phpro/grumphp": "^2.6",
18+
"phpunit/phpunit": "^10.5",
2019
"roave/security-advisories": "dev-master",
21-
"symfony/phpunit-bridge": "6.1.*"
20+
"symfony/phpunit-bridge": "6.4|^7.0"
2221
},
2322
"autoload": {
2423
"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 DpdPlPickupServicesBundle 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/Enum/Day.php

Lines changed: 8 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -4,50 +4,13 @@
44

55
namespace Answear\DpdPlPickupServicesBundle\Enum;
66

7-
use MabeEnum\Enum;
8-
9-
class Day extends Enum
7+
enum Day: string
108
{
11-
public const MONDAY = '1';
12-
public const TUESDAY = '2';
13-
public const WEDNESDAY = '3';
14-
public const THURSDAY = '4';
15-
public const FRIDAY = '5';
16-
public const SATURDAY = '6';
17-
public const SUNDAY = '7';
18-
19-
public static function monday(): self
20-
{
21-
return static::get(static::MONDAY);
22-
}
23-
24-
public static function tuesday(): self
25-
{
26-
return static::get(static::TUESDAY);
27-
}
28-
29-
public static function wednesday(): self
30-
{
31-
return static::get(static::WEDNESDAY);
32-
}
33-
34-
public static function thursday(): self
35-
{
36-
return static::get(static::THURSDAY);
37-
}
38-
39-
public static function friday(): self
40-
{
41-
return static::get(static::FRIDAY);
42-
}
43-
44-
public static function saturday(): self
45-
{
46-
return static::get(static::SATURDAY);
47-
}
48-
49-
public static function sunday(): self
50-
{
51-
return static::get(static::SUNDAY);
52-
}
9+
case Monday = '1';
10+
case Tuesday = '2';
11+
case Wednesday = '3';
12+
case Thursday = '4';
13+
case Friday = '5';
14+
case Saturday = '6';
15+
case Sunday = '7';
5316
}

src/Enum/Service.php

Lines changed: 11 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -4,68 +4,16 @@
44

55
namespace Answear\DpdPlPickupServicesBundle\Enum;
66

7-
use MabeEnum\Enum;
8-
9-
class Service extends Enum
7+
enum Service: string
108
{
11-
public const DELIVERY = '100';
12-
public const COD = '101';
13-
public const SWAP = '300';
14-
public const DROPOFF_ONLINE = '200';
15-
public const DROPOFF_OFFLINE = '201';
16-
public const MONITORED_DOCUMENTS = 'P10';
17-
public const ROD = 'P20';
18-
public const TYRES = 'P30';
19-
public const PALLET = 'P90';
20-
public const DRESSING_ROOM = '10001';
21-
22-
public static function delivery(): self
23-
{
24-
return static::get(static::DELIVERY);
25-
}
26-
27-
public static function cod(): self
28-
{
29-
return static::get(static::COD);
30-
}
31-
32-
public static function swap(): self
33-
{
34-
return static::get(static::SWAP);
35-
}
36-
37-
public static function dropoffOnline(): self
38-
{
39-
return static::get(static::DROPOFF_ONLINE);
40-
}
41-
42-
public static function dropoffOffline(): self
43-
{
44-
return static::get(static::DROPOFF_OFFLINE);
45-
}
46-
47-
public static function monitoredDocuments(): self
48-
{
49-
return static::get(static::MONITORED_DOCUMENTS);
50-
}
51-
52-
public static function rod(): self
53-
{
54-
return static::get(static::ROD);
55-
}
56-
57-
public static function tyres(): self
58-
{
59-
return static::get(static::TYRES);
60-
}
61-
62-
public static function pallet(): self
63-
{
64-
return static::get(static::PALLET);
65-
}
66-
67-
public static function dressingRoom(): self
68-
{
69-
return static::get(static::DRESSING_ROOM);
70-
}
9+
case Delivery = '100';
10+
case COD = '101';
11+
case Swap = '300';
12+
case DropoffOnline = '200';
13+
case DropoffOffline = '201';
14+
case MonitoredDocuments = 'P10';
15+
case Rod = 'P20';
16+
case Tyres = 'P30';
17+
case Pallet = 'P90';
18+
case DressingRoom = '10001';
7119
}

src/Enum/Type.php

Lines changed: 9 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -4,56 +4,14 @@
44

55
namespace Answear\DpdPlPickupServicesBundle\Enum;
66

7-
use MabeEnum\Enum;
8-
9-
class Type extends Enum
7+
enum Type: string
108
{
11-
public const STANDARD = '100';
12-
public const CHAIN = '200';
13-
public const DPD = '300';
14-
public const SWIP_BOX_1 = '400401';
15-
public const SWIP_BOX_2 = '400402';
16-
public const POINT_PACK = '500501';
17-
public const FOREIGN_LOCKER = '400';
18-
public const FOREIGN_EXTERNAL_LOCKER = '501';
19-
20-
public static function standard(): self
21-
{
22-
return self::get(self::STANDARD);
23-
}
24-
25-
public static function chain(): self
26-
{
27-
return self::get(self::CHAIN);
28-
}
29-
30-
public static function dpd(): self
31-
{
32-
return self::get(self::DPD);
33-
}
34-
35-
public static function swipBox1(): self
36-
{
37-
return self::get(self::SWIP_BOX_1);
38-
}
39-
40-
public static function swipBox2(): self
41-
{
42-
return self::get(self::SWIP_BOX_2);
43-
}
44-
45-
public static function pointPack(): self
46-
{
47-
return self::get(self::POINT_PACK);
48-
}
49-
50-
public static function foreignLocker(): self
51-
{
52-
return self::get(self::FOREIGN_LOCKER);
53-
}
54-
55-
public static function foreignExternalLocker(): self
56-
{
57-
return self::get(self::FOREIGN_EXTERNAL_LOCKER);
58-
}
9+
case Standard = '100';
10+
case Chain = '200';
11+
case Dpd = '300';
12+
case SwipBox1 = '400401';
13+
case SwipBox2 = '400402';
14+
case PointPack = '500501';
15+
case ForeignLocker = '400';
16+
case ForeignExternalLocker = '501';
5917
}

src/Exception/MalformedResponseException.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,8 @@
66

77
class MalformedResponseException extends \RuntimeException
88
{
9-
private string $response;
10-
11-
public function __construct(string $response)
9+
public function __construct(public string $response)
1210
{
1311
parent::__construct('Response is not a valid XML');
14-
$this->response = $response;
15-
}
16-
17-
public function getResponse(): string
18-
{
19-
return $this->response;
2012
}
2113
}

0 commit comments

Comments
 (0)