diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index a7c44dd..0000000 --- a/.editorconfig +++ /dev/null @@ -1,15 +0,0 @@ -root = true - -[*] -charset = utf-8 -indent_size = 4 -indent_style = space -end_of_line = lf -insert_final_newline = true -trim_trailing_whitespace = true - -[*.md] -trim_trailing_whitespace = false - -[*.{yml,yaml}] -indent_size = 2 diff --git a/.github/workflows/dependabot-auto-merge.yml b/.github/workflows/dependabot-auto-merge.yml deleted file mode 100644 index b4979d6..0000000 --- a/.github/workflows/dependabot-auto-merge.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: dependabot-auto-merge -on: pull_request_target - -permissions: - pull-requests: write - contents: write - -jobs: - dependabot: - runs-on: ubuntu-latest - timeout-minutes: 5 - if: ${{ github.actor == 'dependabot[bot]' }} - steps: - - - name: Dependabot metadata - id: metadata - uses: dependabot/fetch-metadata@v2.3.0 - with: - github-token: "${{ secrets.GITHUB_TOKEN }}" - - - name: Auto-merge Dependabot PRs for semver-minor updates - if: ${{steps.metadata.outputs.update-type == 'version-update:semver-minor'}} - run: gh pr merge --auto --merge "$PR_URL" - env: - PR_URL: ${{github.event.pull_request.html_url}} - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} - - - name: Auto-merge Dependabot PRs for semver-patch updates - if: ${{steps.metadata.outputs.update-type == 'version-update:semver-patch'}} - run: gh pr merge --auto --merge "$PR_URL" - env: - PR_URL: ${{github.event.pull_request.html_url}} - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/.gitignore b/.gitignore index dc8d529..38a0e27 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,7 @@ yarn-error.log /.idea /.fleet /.vscode +.editorconfig # Code sniffer .php_cs diff --git a/rector.php b/rector.php index ead3c6f..c1cbd7b 100644 --- a/rector.php +++ b/rector.php @@ -9,8 +9,4 @@ __DIR__.'/src', __DIR__.'/tests', ]) - // uncomment to reach your current PHP version - // ->withPhpSets() - ->withTypeCoverageLevel(0) - ->withDeadCodeLevel(0) - ->withCodeQualityLevel(0); + ->withPhpSets(); diff --git a/src/Client/HttpClientService.php b/src/Client/HttpClientService.php index 45e7798..f1221a1 100644 --- a/src/Client/HttpClientService.php +++ b/src/Client/HttpClientService.php @@ -26,17 +26,14 @@ class HttpClientService private bool $verifySsl = false; - private bool $test_mode; - - private HttpClientInterface $httpClient; + private readonly HttpClientInterface $httpClient; /** * @param bool $test_mode Whether to use the test API or not. * @param HttpClientInterface|null $httpClient Injected HTTP client for testing (optional). */ - public function __construct(bool $test_mode = false, ?HttpClientInterface $httpClient = null) + public function __construct(private readonly bool $test_mode = false, ?HttpClientInterface $httpClient = null) { - $this->test_mode = $test_mode; $this->httpClient = $httpClient ?? new RetryableHttpClient(HttpClient::create($this->getClientOptions()), null, $this->maxRetries); } diff --git a/src/SatimConfig.php b/src/SatimConfig.php index 318177c..ca45818 100644 --- a/src/SatimConfig.php +++ b/src/SatimConfig.php @@ -64,7 +64,7 @@ abstract class SatimConfig * * @var non-empty-string|null */ - protected ?string $failUrl; + protected ?string $failUrl = null; /** * The URL to redirect to after the payment is processed. diff --git a/src/SatimStatusChecker.php b/src/SatimStatusChecker.php index b48c869..4a1d79b 100644 --- a/src/SatimStatusChecker.php +++ b/src/SatimStatusChecker.php @@ -64,7 +64,7 @@ public function isRejected(): bool return false; } - if (! empty($response['ErrorMessage']) && str_contains($response['ErrorMessage'], 'Payment is declined')) { + if (! empty($response['ErrorMessage']) && str_contains((string) $response['ErrorMessage'], 'Payment is declined')) { return true; } @@ -154,7 +154,7 @@ public function isCancelled(): bool return false; } - if (! empty($this->getResponse()['ErrorMessage']) && str_contains($this->getResponse()['ErrorMessage'], 'Payment is cancelled')) { + if (! empty($this->getResponse()['ErrorMessage']) && str_contains((string) $this->getResponse()['ErrorMessage'], 'Payment is cancelled')) { return true; } diff --git a/tests/Unit/SatimTest.php b/tests/Unit/SatimTest.php index 06b4fa6..4f46ced 100644 --- a/tests/Unit/SatimTest.php +++ b/tests/Unit/SatimTest.php @@ -130,7 +130,7 @@ $requestData = $method->invoke($this->satim); // Decode JSON `jsonParams` - $jsonParams = json_decode($requestData['jsonParams'], true); + $jsonParams = json_decode((string) $requestData['jsonParams'], true); expect($jsonParams)->toHaveKeys(['force_terminal_id', 'custom_field_1', 'custom_field_2']) ->and($jsonParams['force_terminal_id'])->toBe('123456') @@ -157,7 +157,7 @@ $requestData = $method->invoke($this->satim); // Decode JSON `jsonParams` - $jsonParams = json_decode($requestData['jsonParams'], true); + $jsonParams = json_decode((string) $requestData['jsonParams'], true); expect($jsonParams)->toHaveKey('force_terminal_id') ->and($jsonParams)->not()->toHaveKeys(['custom_field_1', 'custom_field_2']); @@ -185,7 +185,7 @@ $requestData = $method->invoke($this->satim); // Decode JSON `jsonParams` - $jsonParams = json_decode($requestData['jsonParams'], true); + $jsonParams = json_decode((string) $requestData['jsonParams'], true); expect($jsonParams)->toHaveKey('force_terminal_id') ->and($jsonParams['force_terminal_id'])->toBe('OVERWRITTEN_VALUE')