diff --git a/phpstan.neon b/phpstan.neon index 036a26e..4fbe348 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -5,6 +5,18 @@ includes: - vendor/phpstan/phpstan-strict-rules/rules.neon parameters: + level: 9 + phpVersion: 80000 + + scanDirectories: + - src + + fileExtensions: + - php + + paths: + - src + ignoreErrors: - message: "#^Call to deprecated method validateConfig\\(\\) of class Nette\\\\DI\\\\CompilerExtension\\:\nuse getConfigSchema\\(\\)$#" diff --git a/src/DI/ComgateExtension.php b/src/DI/ComgateExtension.php index 134ba74..7125043 100644 --- a/src/DI/ComgateExtension.php +++ b/src/DI/ComgateExtension.php @@ -7,7 +7,7 @@ use Contributte\Comgate\Http\HttpClient; use GuzzleHttp\Client; use Nette\DI\CompilerExtension; -use Nette\DI\Statement; +use Nette\DI\Definitions\Statement; use Nette\Schema\Expect; use Nette\Schema\Schema; use stdClass; diff --git a/src/DI/ComgateExtension24.php b/src/DI/ComgateExtension24.php index bd3a0f7..401e4b1 100644 --- a/src/DI/ComgateExtension24.php +++ b/src/DI/ComgateExtension24.php @@ -7,7 +7,7 @@ use Contributte\Comgate\Http\HttpClient; use GuzzleHttp\Client; use Nette\DI\CompilerExtension; -use Nette\DI\Statement; +use Nette\DI\Definitions\Statement; class ComgateExtension24 extends CompilerExtension { diff --git a/src/Entity/Refund.php b/src/Entity/Refund.php index 250e87c..a8797f7 100644 --- a/src/Entity/Refund.php +++ b/src/Entity/Refund.php @@ -17,8 +17,8 @@ class Refund extends AbstractEntity /** @var string */ private $transId; - /** @var null|string */ - private $refId; + /** @var string|null */ + private $refId; final private function __construct() { @@ -27,14 +27,14 @@ final private function __construct() public static function of( Money $money, string $transId, - string $refId = null + ?string $refId = null ): self { $p = new static(); $p->amount = $money->multipliedBy(100, RoundingMode::UNNECESSARY)->getAmount()->toInt(); $p->curr = $money->getCurrency()->getCurrencyCode(); $p->transId = $transId; - $p->refId = $refId; + $p->refId = $refId; return $p; } @@ -54,11 +54,10 @@ public function getTransId(): string return $this->transId; } - public function getRefId(): string - { - return $this->refId; - } - + public function getRefId(): ?string + { + return $this->refId; + } /** * @return mixed[] @@ -69,7 +68,7 @@ public function toArray(): array 'amount' => $this->amount, 'curr' => $this->curr, 'transId' => $this->transId, - 'refId' => $this->refId, + 'refId' => $this->refId, ]; } diff --git a/src/Gateway/PaymentService.php b/src/Gateway/PaymentService.php index a16acc7..80ddb85 100644 --- a/src/Gateway/PaymentService.php +++ b/src/Gateway/PaymentService.php @@ -32,17 +32,18 @@ public function status(PaymentStatus $status): Response return $this->client->post('status', $status->toArray()); } - public function refund(Refund $payment): Response - { - $data = $payment->toArray(); + public function refund(Refund $payment): Response + { + $data = $payment->toArray(); - return $this->client->post('refund', $data); - } + return $this->client->post('refund', $data); + } - public function storno(Storno $payment): Response - { - $data = $payment->toArray(); + public function storno(Storno $payment): Response + { + $data = $payment->toArray(); + + return $this->client->post('cancel', $data); + } - return $this->client->post('cancel', $data); - } }