Skip to content

Commit

Permalink
Changed default to prevent a null TypeError
Browse files Browse the repository at this point in the history
  • Loading branch information
davidyell authored Jan 7, 2025
1 parent fb5e144 commit 7cb6dfd
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions packages/support/src/Assets/Asset.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
Expand Down Expand Up @@ -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://', '//']);
}

Expand Down

0 comments on commit 7cb6dfd

Please sign in to comment.