Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/Downloading/GithubPackageReleaseAssets.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,14 @@
Assert::notNull($package->downloadUrl());

try {
$decodedRepsonse = $httpDownloader->get(
$authOptions = $authHelper->addAuthenticationOptions([], $this->githubApiBaseUrl, $package->downloadUrl());

Check failure on line 80 in src/Downloading/GithubPackageReleaseAssets.php

View workflow job for this annotation

GitHub Actions / static-analysis

UndefinedMethod

src/Downloading/GithubPackageReleaseAssets.php:80:53: UndefinedMethod: Method Composer\Util\AuthHelper::addAuthenticationOptions does not exist (see https://psalm.dev/022)

Check failure on line 80 in src/Downloading/GithubPackageReleaseAssets.php

View workflow job for this annotation

GitHub Actions / static-analysis

MixedAssignment

src/Downloading/GithubPackageReleaseAssets.php:80:13: MixedAssignment: Unable to determine the type that $authOptions is being assigned to (see https://psalm.dev/032)
$decodedRepsonse = $httpDownloader->get(
$this->githubApiBaseUrl . '/repos/' . $package->githubOrgAndRepository() . '/releases/tags/' . $package->version(),
[
'retry-auth-failure' => true,
'http' => [
'method' => 'GET',
'header' => $authHelper->addAuthenticationHeader([], $this->githubApiBaseUrl, $package->downloadUrl()),
'header' => $authOptions['http']['header'],

Check failure on line 87 in src/Downloading/GithubPackageReleaseAssets.php

View workflow job for this annotation

GitHub Actions / static-analysis

MixedArrayAccess

src/Downloading/GithubPackageReleaseAssets.php:87:37: MixedArrayAccess: Cannot access array value on mixed variable $authOptions['http'] (see https://psalm.dev/051)

Check failure on line 87 in src/Downloading/GithubPackageReleaseAssets.php

View workflow job for this annotation

GitHub Actions / static-analysis

MixedArrayAccess

src/Downloading/GithubPackageReleaseAssets.php:87:37: MixedArrayAccess: Cannot access array value on mixed variable $authOptions (see https://psalm.dev/051)
],
],
)->decodeJson();
Expand Down
8 changes: 5 additions & 3 deletions src/SelfManage/Update/FetchPieReleaseFromGitHub.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,14 @@
{
$url = $this->githubApiBaseUrl . self::PIE_LATEST_RELEASE_URL;

$decodedRepsonse = $this->httpDownloader->get(
$authOptions = $this->authHelper->addAuthenticationOptions([], $this->githubApiBaseUrl, $url);

Check failure on line 37 in src/SelfManage/Update/FetchPieReleaseFromGitHub.php

View workflow job for this annotation

GitHub Actions / static-analysis

UndefinedMethod

src/SelfManage/Update/FetchPieReleaseFromGitHub.php:37:43: UndefinedMethod: Method Composer\Util\AuthHelper::addAuthenticationOptions does not exist (see https://psalm.dev/022)

Check failure on line 37 in src/SelfManage/Update/FetchPieReleaseFromGitHub.php

View workflow job for this annotation

GitHub Actions / static-analysis

MixedAssignment

src/SelfManage/Update/FetchPieReleaseFromGitHub.php:37:9: MixedAssignment: Unable to determine the type that $authOptions is being assigned to (see https://psalm.dev/032)
$decodedRepsonse = $this->httpDownloader->get(
$url,
[
'retry-auth-failure' => true,
'http' => [
'method' => 'GET',
'header' => $this->authHelper->addAuthenticationHeader([], $this->githubApiBaseUrl, $url),
'header' => $authOptions['http']['header'],

Check failure on line 44 in src/SelfManage/Update/FetchPieReleaseFromGitHub.php

View workflow job for this annotation

GitHub Actions / static-analysis

MixedArrayAccess

src/SelfManage/Update/FetchPieReleaseFromGitHub.php:44:33: MixedArrayAccess: Cannot access array value on mixed variable $authOptions['http'] (see https://psalm.dev/051)

Check failure on line 44 in src/SelfManage/Update/FetchPieReleaseFromGitHub.php

View workflow job for this annotation

GitHub Actions / static-analysis

MixedArrayAccess

src/SelfManage/Update/FetchPieReleaseFromGitHub.php:44:33: MixedArrayAccess: Cannot access array value on mixed variable $authOptions (see https://psalm.dev/051)
],
],
)->decodeJson();
Expand Down Expand Up @@ -78,13 +79,14 @@

public function downloadContent(ReleaseMetadata $releaseMetadata): BinaryFile
{
$authOptions = $this->authHelper->addAuthenticationOptions([], $this->githubApiBaseUrl, $releaseMetadata->downloadUrl);

Check failure on line 82 in src/SelfManage/Update/FetchPieReleaseFromGitHub.php

View workflow job for this annotation

GitHub Actions / static-analysis

UndefinedMethod

src/SelfManage/Update/FetchPieReleaseFromGitHub.php:82:43: UndefinedMethod: Method Composer\Util\AuthHelper::addAuthenticationOptions does not exist (see https://psalm.dev/022)

Check failure on line 82 in src/SelfManage/Update/FetchPieReleaseFromGitHub.php

View workflow job for this annotation

GitHub Actions / static-analysis

MixedAssignment

src/SelfManage/Update/FetchPieReleaseFromGitHub.php:82:9: MixedAssignment: Unable to determine the type that $authOptions is being assigned to (see https://psalm.dev/032)
$pharContent = $this->httpDownloader->get(
$releaseMetadata->downloadUrl,
[
'retry-auth-failure' => true,
'http' => [
'method' => 'GET',
'header' => $this->authHelper->addAuthenticationHeader([], $this->githubApiBaseUrl, $releaseMetadata->downloadUrl),
'header' => $authOptions['http']['header'],
],
],
)->getBody();
Expand Down
5 changes: 3 additions & 2 deletions src/SelfManage/Verify/FallbackVerificationUsingOpenSsl.php
Original file line number Diff line number Diff line change
Expand Up @@ -282,13 +282,14 @@ private function downloadAttestations(ReleaseMetadata $releaseMetadata, BinaryFi
$attestationUrl = $this->githubApiBaseUrl . '/orgs/php/attestations/sha256:' . $pharFilename->checksum;

try {
$decodedJson = $this->httpDownloader->get(
$authOptions = $this->authHelper->addAuthenticationOptions([], $this->githubApiBaseUrl, $attestationUrl);
$decodedJson = $this->httpDownloader->get(
$attestationUrl,
[
'retry-auth-failure' => true,
'http' => [
'method' => 'GET',
'header' => $this->authHelper->addAuthenticationHeader([], $this->githubApiBaseUrl, $attestationUrl),
'header' => $authOptions['http']['header'],
],
],
)->decodeJson();
Expand Down
8 changes: 4 additions & 4 deletions test/unit/SelfManage/Update/FetchPieReleaseFromGitHubTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public function testLatestReleaseMetadata(): void

$url = self::TEST_GITHUB_URL . '/repos/php/pie/releases/latest';
$authHelper
->method('addAuthenticationHeader')
->willReturn(['Authorization: Bearer fake-token']);
->method('addAuthenticationOptions')
->willReturn(['http' => ['header' => ['Authorization: Bearer fake-token']]]);
$httpDownloader->expects(self::once())
->method('get')
->with(
Expand Down Expand Up @@ -84,8 +84,8 @@ public function testDownloadContent(): void
$authHelper = $this->createMock(AuthHelper::class);

$authHelper
->method('addAuthenticationHeader')
->willReturn(['Authorization: Bearer fake-token']);
->method('addAuthenticationOptions')
->willReturn(['http' => ['header' => ['Authorization: Bearer fake-token']]]);
$httpDownloader->expects(self::once())
->method('get')
->with(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ private function mockAttestationResponse(string $digestInUrl, string $dsseEnvelo
{
$url = self::TEST_GITHUB_URL . '/orgs/php/attestations/sha256:' . $digestInUrl;
$this->authHelper
->method('addAuthenticationHeader')
->willReturn(['Authorization: Bearer fake-token']);
->method('addAuthenticationOptions')
->willReturn(['http' => ['header' => ['Authorization: Bearer fake-token']]]);
$this->httpDownloader->expects(self::once())
->method('get')
->with(
Expand Down Expand Up @@ -267,8 +267,8 @@ public function testFailedToVerifyBecauseDigestNotFoundOnGitHub(): void
$transportException->setStatusCode(404);

$this->authHelper
->method('addAuthenticationHeader')
->willReturn(['Authorization: Bearer fake-token']);
->method('addAuthenticationOptions')
->willReturn(['http' => ['header' => ['Authorization: Bearer fake-token']]]);
$this->httpDownloader->expects(self::once())
->method('get')
->willThrowException($transportException);
Expand Down
Loading