From cae9239e023c951a2b02af0fdadd76881e2821e1 Mon Sep 17 00:00:00 2001 From: Lynh Date: Sun, 29 Sep 2024 22:52:39 +0700 Subject: [PATCH 1/2] feat: Update generic --- .gitignore | 1 + src/Contracts/ConnectorInterface.php | 1 + src/Response.php | 5 +++-- src/Traits/ConnectorTrait.php | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index e135543..b7bde0a 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ composer.lock coverage phpunit.xml psalm.xml +.php-cs-fixer.php vendor .php-cs-fixer.cache diff --git a/src/Contracts/ConnectorInterface.php b/src/Contracts/ConnectorInterface.php index 569cd83..9c60180 100644 --- a/src/Contracts/ConnectorInterface.php +++ b/src/Contracts/ConnectorInterface.php @@ -27,6 +27,7 @@ public function middleware(): Middleware; * The request and response should be processed through middleware. * * @template T of object + * * @param Request $request * @return Response */ diff --git a/src/Response.php b/src/Response.php index d2270e3..224a46d 100644 --- a/src/Response.php +++ b/src/Response.php @@ -75,11 +75,12 @@ public function data(): array */ public function object(): ?object { - if (! $this->decoder instanceof MapperInterface) { + if (! ($decoder = $this->decoder) instanceof MapperInterface) { return null; } - return $this->decoder->map($this->response); // @phpstan-ignore-line + /** @var MapperInterface $decoder */ + return $decoder->map($this->response); } /** diff --git a/src/Traits/ConnectorTrait.php b/src/Traits/ConnectorTrait.php index a49627f..d830169 100644 --- a/src/Traits/ConnectorTrait.php +++ b/src/Traits/ConnectorTrait.php @@ -31,7 +31,7 @@ public function send(Request $request): Response Util::request($request, static::baseUri()) ); - return new Response($response, $request->decoder()); // @phpstan-ignore-line + return new Response($response, $request->decoder()); } public function sendRequest(RequestInterface $request): ResponseInterface From c0d55a03693d7d71c4fb2c49607ed49cad423dc7 Mon Sep 17 00:00:00 2001 From: Lynh Date: Mon, 30 Sep 2024 16:10:28 +0700 Subject: [PATCH 2/2] update workflows --- .github/workflows/retype-action.yml | 2 +- .github/workflows/testing.yml | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/retype-action.yml b/.github/workflows/retype-action.yml index 35ca6fd..374fcff 100644 --- a/.github/workflows/retype-action.yml +++ b/.github/workflows/retype-action.yml @@ -16,7 +16,7 @@ jobs: contents: write steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: retypeapp/action-build@latest diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index a2e5531..77f8352 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -39,4 +39,6 @@ jobs: run: vendor/bin/phpunit --coverage-text --coverage-clover=coverage.xml - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }}