Skip to content

Commit 605401e

Browse files
Fix undefined array key "assets" (#864)
* Fix undefined array key "assets" * Update InstallsFrankenPhpDependencies.php --------- Co-authored-by: Taylor Otwell <[email protected]>
1 parent 14a0eca commit 605401e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/Commands/Concerns/InstallsFrankenPhpDependencies.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Laravel\Octane\Commands\Concerns;
44

55
use GuzzleHttp\Client;
6+
use Illuminate\Http\Client\RequestException;
67
use Illuminate\Support\Facades\Http;
78
use Illuminate\Support\Str;
89
use Laravel\Octane\FrankenPhp\Concerns\FindsFrankenPhpBinary;
@@ -55,6 +56,8 @@ protected function ensureFrankenPhpBinaryIsInstalled()
5556
* Download the latest version of the FrankenPHP binary.
5657
*
5758
* @return string
59+
*
60+
* @throws RequestException
5861
*/
5962
protected function downloadFrankenPhpBinary()
6063
{
@@ -71,9 +74,12 @@ protected function downloadFrankenPhpBinary()
7174
throw new RuntimeException('FrankenPHP binaries are currently only available for Linux (x86_64, aarch64) and macOS. Other systems should use the Docker images or compile FrankenPHP manually.');
7275
}
7376

74-
$assets = Http::accept('application/vnd.github+json')
77+
$response = Http::accept('application/vnd.github+json')
7578
->withHeaders(['X-GitHub-Api-Version' => '2022-11-28'])
76-
->get('https://api.github.com/repos/dunglas/frankenphp/releases/latest')['assets'];
79+
->get('https://api.github.com/repos/dunglas/frankenphp/releases/latest')
80+
->throw(fn () => $this->error("Failed to download FrankenPHP."));
81+
82+
$assets = $response['assets'] ?? [];
7783

7884
foreach ($assets as $asset) {
7985
if ($asset['name'] !== $assetName) {

0 commit comments

Comments
 (0)