Skip to content

Commit

Permalink
Handle booted state using boolean property
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Apr 7, 2024
1 parent 9bd4ce0 commit 8804498
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/framework/src/Facades/Features.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ class Features implements SerializableContract
*/
protected array $enabled = [];

protected bool $booted = false;

/** @experimental This method may change before its release. */
public function getEnabled(): array
{
Expand Down Expand Up @@ -227,12 +229,14 @@ protected static function getDefaultOptions(): array
public function boot(): void
{
$this->enabled = Config::getArray('hyde.features', static::getDefaultOptions());

$this->booted = true;
}

/** @internal */
public function booted(): static
{
if ($this->enabled === []) {
if (! $this->booted) {
$this->boot();
}

Expand Down

0 comments on commit 8804498

Please sign in to comment.