From d1c35d14651bad63d25ba158a3722f7260723cf4 Mon Sep 17 00:00:00 2001 From: Jordan Partridge Date: Thu, 23 Jul 2026 17:31:01 +0000 Subject: [PATCH] fix: address CodeRabbit review nits on PR #119 --- src/Resources/ChecksResource.php | 4 ++-- src/Resources/FileResource.php | 4 +++- tests/AuthenticationTest.php | 3 ++- tests/CommitResourceTest.php | 3 ++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Resources/ChecksResource.php b/src/Resources/ChecksResource.php index 43621bc..c53f4d6 100644 --- a/src/Resources/ChecksResource.php +++ b/src/Resources/ChecksResource.php @@ -12,10 +12,10 @@ * * @return array{total_count: int, check_runs: array>} */ - public function forRef(string $owner, string $repo, string $ref): array + public function forRef(string $owner, string $repo, string $ref, ?int $perPage = null, ?int $page = null): array { $response = $this->github()->connector()->send( - new GetCheckRunsForRef($owner, $repo, $ref), + new GetCheckRunsForRef($owner, $repo, $ref, $perPage, $page), ); return $response->json(); diff --git a/src/Resources/FileResource.php b/src/Resources/FileResource.php index 9ab5c3e..cfdeb66 100644 --- a/src/Resources/FileResource.php +++ b/src/Resources/FileResource.php @@ -24,7 +24,9 @@ public function all(string $repo_name, string $commit_sha): Response /** * Get the contents of a file at a specific ref (branch, tag, or SHA). * - * @return array{name: string, path: string, sha: string, size: int, content: string, encoding: string} + * Note: If the path is a directory, GitHub returns an array of entries instead. + * + * @return array{name: string, path: string, sha: string, size: int, content: string, encoding: string}|array> */ public function contents(string $owner, string $repo, string $path, ?string $ref = null): array { diff --git a/tests/AuthenticationTest.php b/tests/AuthenticationTest.php index 9459e94..1be39cd 100644 --- a/tests/AuthenticationTest.php +++ b/tests/AuthenticationTest.php @@ -3,6 +3,7 @@ use JordanPartridge\GithubClient\Auth\TokenResolver; use JordanPartridge\GithubClient\Connectors\GithubConnector; use JordanPartridge\GithubClient\Facades\Github; +use JordanPartridge\GithubClient\Github as GithubClient; use Saloon\Http\Faking\MockClient; use Saloon\Http\Faking\MockResponse; use JordanPartridge\GithubClient\Data\Repos\RepoData; @@ -169,7 +170,7 @@ $connector->withMockClient($mockClient); // Create Github instance with unauthenticated connector - $github = new JordanPartridge\GithubClient\Github($connector); + $github = new GithubClient($connector); // Should be able to get public repo without auth $repo = $github->getRepo('owner/public-repo'); diff --git a/tests/CommitResourceTest.php b/tests/CommitResourceTest.php index 48bfcbf..0297dc0 100644 --- a/tests/CommitResourceTest.php +++ b/tests/CommitResourceTest.php @@ -2,6 +2,7 @@ use Carbon\Carbon; use JordanPartridge\GithubClient\Facades\Github; +use JordanPartridge\GithubClient\Github as GithubClient; use JordanPartridge\GithubClient\Resources\CommitResource; use JordanPartridge\GithubClient\ValueObjects\Repo; use Saloon\Http\Faking\MockClient; @@ -16,7 +17,7 @@ ]); Github::connector()->withMockClient($mockClient); - $this->resource = new CommitResource(app(JordanPartridge\GithubClient\Github::class)); + $this->resource = new CommitResource(app(GithubClient::class)); }); it('can fetch all commits for a repository', function () {