Skip to content

Commit aaef13a

Browse files
committed
refactor(console): use property hook for isForced
1 parent 0f18ed1 commit aaef13a

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

packages/console/src/Console.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,5 +161,7 @@ public function disablePrompting(): self;
161161
/**
162162
* Whether the console is in forced mode (skipping confirmations).
163163
*/
164-
public function isForced(): bool;
164+
public bool $isForced {
165+
get;
166+
}
165167
}

packages/console/src/GenericConsole.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ final class GenericConsole implements Console
3939

4040
private ?string $label = null;
4141

42-
private bool $isForced = false;
42+
public private(set) bool $isForced = false;
4343

4444
private bool $supportsPrompting = true;
4545

@@ -73,11 +73,6 @@ public function setForced(): self
7373
return $this;
7474
}
7575

76-
public function isForced(): bool
77-
{
78-
return $this->isForced;
79-
}
80-
8176
public function disablePrompting(): self
8277
{
8378
$this->supportsPrompting = false;

packages/console/src/Middleware/CautionMiddleware.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function __invoke(Invocation $invocation, ConsoleMiddlewareCallable $next
2525
$environment = $this->appConfig->environment;
2626

2727
if ($environment->isProduction() || $environment->isStaging()) {
28-
if ($this->console->isForced()) {
28+
if ($this->console->isForced) {
2929
return $next($invocation);
3030
}
3131

0 commit comments

Comments
 (0)