Skip to content

Commit

Permalink
Support symfony 7
Browse files Browse the repository at this point in the history
  • Loading branch information
Wiktor6 committed Sep 30, 2024
1 parent ee2e358 commit dbb6178
Show file tree
Hide file tree
Showing 56 changed files with 270 additions and 356 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@ jobs:
strategy:
matrix:
php-version:
- "8.1"
- "8.2"
deps:
- "normal"
include:
- deps: "low"
php-version: "8.1"
- "low"

steps:
- name: "Checkout"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
matrix:
php-version:
- "8.1"
- "8.2"
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
composer.lock
/.idea
/.env*
/.phpunit.cache
2 changes: 1 addition & 1 deletion .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
'strict_param' => false,
'array_syntax' => ['syntax' => 'short'],
'concat_space' => ['spacing' => 'one'],
'phpdoc_align' => [],
'phpdoc_align' => ['align' => 'left'],
'phpdoc_summary' => false,
'void_return' => false,
'phpdoc_var_without_name' => false,
Expand Down
20 changes: 10 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,24 @@
],
"license": "MIT",
"require": {
"php": "^8.1",
"php": "^8.2",
"ext-json": "*",
"guzzlehttp/guzzle": "^6.5.8 || ^7.0",
"guzzlehttp/guzzle": "^6.5.8|^7.0",
"payum/core": "^1.7.3",
"php-http/message": "<1.16.0",
"symfony/http-kernel": "^5.4|^6.0",
"symfony/http-kernel": "^6.0|^7.0",
"webmozart/assert": "^1.11"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^v3.13",
"matthiasnoback/symfony-config-test": "^4.3",
"friendsofphp/php-cs-fixer": "^v3.64",
"matthiasnoback/symfony-config-test": "^5.2",
"php-http/guzzle6-adapter": "^1.1.1",
"phpro/grumphp": "^1.15",
"phpstan/phpstan": "^1.10.6",
"phpstan/phpstan-webmozart-assert": "^1.2.4",
"phpunit/phpunit": "^9.6.5",
"phpro/grumphp": "^1.16",
"phpstan/phpstan": "^1.12",
"phpstan/phpstan-webmozart-assert": "^1.2",
"phpunit/phpunit": "^10.5",
"roave/security-advisories": "dev-latest",
"symfony/phpunit-bridge": "^6.2.7"
"symfony/phpunit-bridge": "^6.2.7|^7.0"
},
"autoload": {
"psr-4": {
Expand Down
4 changes: 2 additions & 2 deletions core/Action/Request/SyncPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
use Payum\Core\Model\ModelAggregateInterface;
use Payum\Core\Model\PaymentInterface;

class SyncPayment implements ModelAggregateInterface
readonly class SyncPayment implements ModelAggregateInterface
{
public function __construct(private readonly PaymentInterface $model)
public function __construct(private PaymentInterface $model)
{
}

Expand Down
11 changes: 3 additions & 8 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
backupGlobals="false"
colors="true"
convertDeprecationsToExceptions="false"
cacheDirectory=".phpunit.cache"
>
<php>
<ini name="display_errors" value="1"/>
<ini name="error_reporting" value="-1"/>
<env name="SYMFONY_DEPRECATIONS_HELPER" value="disabled" />
<env name="SYMFONY_DEPRECATIONS_HELPER" value="disabled"/>
</php>

<testsuites>
<testsuite name="Answear.com Payum PayU Test Suite">
<directory>./tests</directory>
</testsuite>
</testsuites>

<listeners>
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener"/>
</listeners>
</phpunit>
4 changes: 2 additions & 2 deletions src/Authorization/AuthType/OAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

namespace Answear\Payum\PayU\Authorization\AuthType;

class OAuth implements AuthType
readonly class OAuth implements AuthType
{
public function __construct(private readonly string $accessToken)
public function __construct(private string $accessToken)
{
}

Expand Down
12 changes: 6 additions & 6 deletions src/ValueObject/Auth/OAuthResultClientCredentials.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
use Psr\Http\Message\ResponseInterface;
use Webmozart\Assert\Assert;

class OAuthResultClientCredentials
readonly class OAuthResultClientCredentials
{
public function __construct(
public readonly string $accessToken,
public readonly string $tokenType,
public readonly int $expiresIn,
public readonly OAuthGrantType $grantType,
public readonly \DateTimeImmutable $expireDate
public string $accessToken,
public string $tokenType,
public int $expiresIn,
public OAuthGrantType $grantType,
public \DateTimeImmutable $expireDate,
) {
}

Expand Down
20 changes: 10 additions & 10 deletions src/ValueObject/Buyer.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@

namespace Answear\Payum\PayU\ValueObject;

class Buyer
readonly class Buyer
{
public function __construct(
public readonly string $email,
public readonly string $firstName,
public readonly string $lastName,
public readonly ?string $phone = null,
public readonly ?string $customerId = null,
public readonly ?string $extCustomerId = null,
public readonly ?string $nin = null,
public readonly ?string $language = null,
public readonly ?Delivery $delivery = null,
public string $email,
public string $firstName,
public string $lastName,
public ?string $phone = null,
public ?string $customerId = null,
public ?string $extCustomerId = null,
public ?string $nin = null,
public ?string $language = null,
public ?Delivery $delivery = null,
) {
}

Expand Down
12 changes: 6 additions & 6 deletions src/ValueObject/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

namespace Answear\Payum\PayU\ValueObject;

class Configuration
readonly class Configuration
{
public function __construct(
public readonly string $publicShopId,
public readonly string $posId,
public readonly string $signatureKey,
public readonly string $oauthClientId,
public readonly string $oauthClientSecret,
public string $publicShopId,
public string $posId,
public string $signatureKey,
public string $oauthClientId,
public string $oauthClientSecret,
) {
}
}
22 changes: 11 additions & 11 deletions src/ValueObject/Delivery.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@

namespace Answear\Payum\PayU\ValueObject;

class Delivery
readonly class Delivery
{
public function __construct(
public readonly string $street,
public readonly string $postalCode,
public readonly string $city,
public readonly ?string $countryCode = null,
public readonly ?string $name = null,
public readonly ?string $recipientName = null,
public readonly ?string $recipientEmail = null,
public readonly ?string $recipientPhone = null,
public readonly ?string $postalBox = null,
public readonly ?string $state = null,
public string $street,
public string $postalCode,
public string $city,
public ?string $countryCode = null,
public ?string $name = null,
public ?string $recipientName = null,
public ?string $recipientEmail = null,
public ?string $recipientPhone = null,
public ?string $postalBox = null,
public ?string $state = null,
) {
}

Expand Down
6 changes: 3 additions & 3 deletions src/ValueObject/PayMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

use Answear\Payum\PayU\Enum\PayMethodType;

class PayMethod
readonly class PayMethod
{
public function __construct(
public readonly ?PayMethodType $type,
public readonly ?string $value = null
public ?PayMethodType $type,
public ?string $value = null,
) {
if (null === $this->type && null === $this->value) {
throw new \InvalidArgumentException('Type or value are required.');
Expand Down
12 changes: 6 additions & 6 deletions src/ValueObject/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
use Answear\Payum\PayU\Util\BooleanTransformer;
use Webmozart\Assert\Assert;

class Product
readonly class Product
{
public function __construct(
public readonly string $name,
public readonly int $unitPrice,
public readonly int $quantity,
public readonly ?bool $virtual = null,
public readonly ?\DateTimeImmutable $listingDate = null,
public string $name,
public int $unitPrice,
public int $quantity,
public ?bool $virtual = null,
public ?\DateTimeImmutable $listingDate = null,
) {
}

Expand Down
10 changes: 5 additions & 5 deletions src/ValueObject/Request/Order/PayMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@

use Answear\Payum\PayU\Enum\PayMethodType;

class PayMethod
readonly class PayMethod
{
public function __construct(
public readonly PayMethodType $type,
public readonly ?string $value = null,
public readonly ?string $authorizationCode = null,
public readonly ?array $specificData = null,
public PayMethodType $type,
public ?string $value = null,
public ?string $authorizationCode = null,
public ?array $specificData = null,
) {
if (PayMethodType::PaymentWall !== $this->type && empty($value)) {
throw new \InvalidArgumentException(sprintf('Value is required for type %s.', $this->type->value));
Expand Down
4 changes: 2 additions & 2 deletions src/ValueObject/Request/Order/ThreeDsAuthentication.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

use Answear\Payum\PayU\Enum\ChallengeRequestedType;

class ThreeDsAuthentication
readonly class ThreeDsAuthentication
{
public function __construct(
public readonly ChallengeRequestedType $challengeRequested,
public ChallengeRequestedType $challengeRequested,
) {
}

Expand Down
10 changes: 5 additions & 5 deletions src/ValueObject/Request/Refund/Refund.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

namespace Answear\Payum\PayU\ValueObject\Request\Refund;

class Refund
readonly class Refund
{
public function __construct(
public readonly string $description,
public readonly ?int $amount,
public readonly ?string $extCustomerId = null,
public readonly ?string $extRefundId = null,
public string $description,
public ?int $amount,
public ?string $extCustomerId = null,
public ?string $extRefundId = null,
) {
}

Expand Down
4 changes: 2 additions & 2 deletions src/ValueObject/Request/RefundRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
use Answear\Payum\PayU\Enum\AuthType;
use Answear\Payum\PayU\ValueObject\Request\Refund\Refund;

class RefundRequest
readonly class RefundRequest
{
public const METHOD = 'POST';
public const AUTH_TYPE = AuthType::Basic;

public function __construct(
public readonly Refund $refund
public Refund $refund,
) {
}

Expand Down
20 changes: 10 additions & 10 deletions src/ValueObject/Response/Notify/NotifyRefund.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@
use Answear\Payum\PayU\Enum\RefundStatus;
use Webmozart\Assert\Assert;

class NotifyRefund
readonly class NotifyRefund
{
public function __construct(
public readonly string $refundId,
public readonly ?string $extRefundId,
public readonly int $amount,
public readonly string $currencyCode,
public readonly RefundStatus $status,
public readonly \DateTimeImmutable $statusDateTime,
public readonly string $reason,
public readonly string $reasonDescription,
public readonly \DateTimeImmutable $refundDate,
public string $refundId,
public ?string $extRefundId,
public int $amount,
public string $currencyCode,
public RefundStatus $status,
public \DateTimeImmutable $statusDateTime,
public string $reason,
public string $reasonDescription,
public \DateTimeImmutable $refundDate,
) {
}

Expand Down
Loading

0 comments on commit dbb6178

Please sign in to comment.