From 7cb6dfdda55488ea2eaa49e291079c4173c373cf Mon Sep 17 00:00:00 2001 From: David Yell Date: Tue, 7 Jan 2025 11:32:08 +0000 Subject: [PATCH] Changed default to prevent a null TypeError --- packages/support/src/Assets/Asset.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/packages/support/src/Assets/Asset.php b/packages/support/src/Assets/Asset.php index af42a06c74f..d53a42130af 100644 --- a/packages/support/src/Assets/Asset.php +++ b/packages/support/src/Assets/Asset.php @@ -13,15 +13,15 @@ abstract class Asset protected string $package; - protected ?string $path = null; + protected string $path = null; - final public function __construct(string $id, ?string $path = null) + final public function __construct(string $id, ?string $path = '/') { $this->id = $id; $this->path = $path; } - public static function make(string $id, ?string $path = null): static + public static function make(string $id, ?string $path = '/'): static { return app(static::class, ['id' => $id, 'path' => $path]); } @@ -50,17 +50,13 @@ public function getPackage(): string return $this->package; } - public function getPath(): ?string + public function getPath(): string { return $this->path; } public function isRemote(): bool { - if ($this->getPath() === null) { - return false; - } - return str($this->getPath())->startsWith(['http://', 'https://', '//']); }