Skip to content

Commit 8145a43

Browse files
committed
Config: add native type hints, fix PHP 8.2 compatibility
1 parent 0f0d07c commit 8145a43

File tree

8 files changed

+27
-39
lines changed

8 files changed

+27
-39
lines changed

src/DI/ExtensionConfiguration.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,11 @@
55
final class ExtensionConfiguration
66
{
77

8-
/** @var bool */
9-
public $demo;
10-
11-
/** @var MerchantConfiguration */
12-
public $merchant;
13-
14-
public function __construct()
8+
public function __construct(
9+
public bool $demo = false,
10+
public MerchantConfiguration $merchant = new MerchantConfiguration(),
11+
)
1512
{
16-
$this->merchant = new MerchantConfiguration();
1713
}
1814

1915
public function setDemoMerchant(): void

src/DI/MerchantConfiguration.php

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,18 @@
55
final class MerchantConfiguration
66
{
77

8-
/** @var string */
9-
public $gateUrl = 'https://www.thepay.cz/gate/';
8+
public string $gateUrl = 'https://www.thepay.cz/gate/';
109

11-
/** @var int */
12-
public $merchantId;
10+
public int $merchantId;
1311

14-
/** @var int */
15-
public $accountId;
12+
public int $accountId;
1613

17-
/** @var string */
18-
public $password;
14+
public string $password;
1915

20-
/** @var string */
21-
public $dataApiPassword;
16+
public string $dataApiPassword;
2217

23-
/** @var string */
24-
public $webServicesWsdl = 'https://www.thepay.cz/gate/api/gate-api.wsdl';
18+
public string $webServicesWsdl = 'https://www.thepay.cz/gate/api/gate-api.wsdl';
2519

26-
/** @var string */
27-
public $dataWebServicesWsdl = 'https://www.thepay.cz/gate/api/data.wsdl';
20+
public string $dataWebServicesWsdl = 'https://www.thepay.cz/gate/api/data.wsdl';
2821

2922
}

src/DI/ThePayExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class ThePayExtension extends CompilerExtension
1818
{
1919

2020
/** @var ExtensionConfiguration */
21-
protected $config;
21+
protected $config; // phpcs:ignore SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint
2222

2323
public function __construct()
2424
{

src/Helper/DataApi.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
class DataApi
1818
{
1919

20-
/** @var MerchantConfig */
21-
protected $config;
20+
protected MerchantConfig $config;
2221

2322
public function __construct(MerchantConfig $config)
2423
{
@@ -68,12 +67,11 @@ public function getPayments(
6867
}
6968

7069
/**
71-
* @param mixed $type
7270
* @throws InvalidSignatureException
7371
* @throws SoapException
7472
*/
7573
public function setPaymentMethods(
76-
$type,
74+
mixed $type,
7775
?array $paymentMethods = null
7876
): SetPaymentMethodsResponse
7977
{

src/MerchantConfig.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@
77
class MerchantConfig extends TpMerchantConfig
88
{
99

10-
/** @var bool */
11-
public $isDemo = false;
10+
public bool $isDemo = false;
1211

13-
/** @var string */
14-
public $resourceUrl = 'https://www.thepay.cz/gate';
12+
public string $resourceUrl = 'https://www.thepay.cz/gate';
1513

1614
public function isDemo(): bool
1715
{

src/Payment.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
class Payment extends TpPayment
1111
{
1212

13-
/** @var LinkGenerator */
14-
protected $linkGenerator;
13+
protected LinkGenerator $linkGenerator;
1514

1615
public function __construct(
1716
MerchantConfig $config,
@@ -24,6 +23,7 @@ public function __construct(
2423
}
2524

2625
/**
26+
* @param mixed[] $params
2727
* @throws InvalidLinkException
2828
*/
2929
public function setReturnUrl(
@@ -39,6 +39,7 @@ public function setReturnUrl(
3939
}
4040

4141
/**
42+
* @param mixed[] $params
4243
* @throws InvalidLinkException
4344
*/
4445
public function setBackToEshopUrl(

src/PermanentPayment.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
class PermanentPayment extends Tp\PermanentPayment
99
{
1010

11-
/** @var LinkGenerator */
12-
protected $linkGenerator;
11+
protected LinkGenerator $linkGenerator;
1312

1413
public function __construct(
1514
MerchantConfig $config,
@@ -48,6 +47,9 @@ public function getReturnUrl(): string
4847
return $this->returnUrl;
4948
}
5049

50+
/**
51+
* @param mixed[] $params
52+
*/
5153
public function setReturnUrl(string $returnUrl, array $params = []): void
5254
{
5355
if (preg_match('~^([\w:]+):(\w*+)(#.*)?()\z~', $returnUrl) === 1) {

src/ReturnedPayment.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,9 @@
1010
class ReturnedPayment extends Tp\ReturnedPayment
1111
{
1212

13-
/** @var IRequest */
14-
protected $request;
13+
protected IRequest $request;
1514

16-
/** @var LinkGenerator */
17-
protected $linkGenerator;
15+
protected LinkGenerator $linkGenerator;
1816

1917
public function __construct(
2018
MerchantConfig $config,
@@ -30,6 +28,7 @@ public function __construct(
3028
}
3129

3230
/**
31+
* @param mixed[] $params
3332
* @throws InvalidLinkException
3433
*/
3534
public function setReturnUrl(
@@ -45,6 +44,7 @@ public function setReturnUrl(
4544
}
4645

4746
/**
47+
* @param mixed[] $params
4848
* @throws InvalidLinkException
4949
*/
5050
public function setBackToEshopUrl(

0 commit comments

Comments
 (0)