Skip to content

Commit 3c2b60d

Browse files
tiagofgithub-actions[bot]
authored andcommitted
Fix styling
1 parent bf4deaf commit 3c2b60d

File tree

4 files changed

+10
-12
lines changed

4 files changed

+10
-12
lines changed

src/Exceptions/InvalidTransitionException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
class InvalidTransitionException extends Exception
88
{
9-
public function __construct(string $message = null)
9+
public function __construct(?string $message = null)
1010
{
1111
parent::__construct($message ?? __('Invalid transition'));
1212
}

src/Exceptions/UnauthorizedTransitionException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
class UnauthorizedTransitionException extends Exception
99
{
10-
public function __construct(string $message = null, Throwable $previous = null)
10+
public function __construct(?string $message = null, ?Throwable $previous = null)
1111
{
1212
parent::__construct($message ?? __('Unauthorized transition'), 403, $previous);
1313
}

src/Services/TransitionService.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class TransitionService
1515
/**
1616
* @return Collection<int, WorkflowTransition>
1717
*/
18-
public static function possibleTransitions(WorkflowModelStatus $modelStatus, Authenticatable $user = null): Collection
18+
public static function possibleTransitions(WorkflowModelStatus $modelStatus, ?Authenticatable $user = null): Collection
1919
{
2020
return WorkflowTransition::query()
2121
->where('workflow_id', $modelStatus->workflow_id)
@@ -24,7 +24,7 @@ public static function possibleTransitions(WorkflowModelStatus $modelStatus, Aut
2424
->filter(fn (WorkflowTransition $transition) => self::isAllowed($transition, $user));
2525
}
2626

27-
public static function isAllowed(WorkflowTransition $transition, Authenticatable $user = null): bool
27+
public static function isAllowed(WorkflowTransition $transition, ?Authenticatable $user = null): bool
2828
{
2929
$user = $user ?? Auth::user();
3030

src/Traits/HasWorkflows.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,9 @@ public function isInStatus(string|BackedEnum $statusName): bool
139139
}
140140

141141
public function scopeInWorkflow(
142-
Builder $query,
142+
Builder $query,
143143
int|string|Workflow $workflow,
144-
): Builder
145-
{
144+
): Builder {
146145
$workflow = is_string($workflow)
147146
? Workflow::findWithName($workflow)
148147
: ($workflow ?? $this->getDefaultWorkflow());
@@ -155,11 +154,10 @@ public function scopeInWorkflow(
155154
}
156155

157156
public function scopeInStatus(
158-
Builder $query,
157+
Builder $query,
159158
int|array|BackedEnum|WorkflowStatus|Collection $status,
160-
int|string|Workflow $workflow = null,
161-
): Builder
162-
{
159+
int|string|Workflow|null $workflow = null,
160+
): Builder {
163161
$workflow = is_string($workflow)
164162
? Workflow::findWithName($workflow)
165163
: ($workflow ?? $this->getDefaultWorkflow());
@@ -178,7 +176,7 @@ public function scopeInStatus(
178176

179177
public function possibleTransitions(): \Illuminate\Support\Collection
180178
{
181-
throw_unless($this->getCurrentWorkflow(), Exception::class, 'Select a workflow before calling ' . __FUNCTION__);
179+
throw_unless($this->getCurrentWorkflow(), Exception::class, 'Select a workflow before calling '.__FUNCTION__);
182180

183181
return TransitionService::possibleTransitions($this->modelStatus, Auth::user());
184182
}

0 commit comments

Comments
 (0)