Skip to content

Commit 7dfb04c

Browse files
Merge pull request #207 from TheDragonCode/patch/2025-04-02/13-25
Method `shouldBeAsync` was renamed with `needAsync`
2 parents 93e42ee + 06f4f32 commit 7dfb04c

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

src/Operation.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function needBefore(): bool
5151
/**
5252
* Defines whether the operation will run synchronously or asynchronously.
5353
*/
54-
public function shouldBeAsync(): bool
54+
public function needAsync(): bool
5555
{
5656
return app(ConfigData::class)->async;
5757
}

src/Services/MigratorService.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function runUp(string $filename, int $batch, OptionsData $options): void
6060
return;
6161
}
6262

63-
if ($this->hasAsync($operation, $options)) {
63+
if ($this->needAsync($operation, $options)) {
6464
OperationJob::dispatch($name);
6565

6666
$this->notification->twoColumn($name, StatusEnum::Pending->toColor());
@@ -69,7 +69,7 @@ public function runUp(string $filename, int $batch, OptionsData $options): void
6969
}
7070

7171
$this->notification->task($name, function () use ($operation, $name, $batch) {
72-
$this->hasOperation($operation, '__invoke')
72+
$this->hasMethod($operation, '__invoke')
7373
? $this->runOperation($operation, '__invoke')
7474
: $this->runOperation($operation, 'up');
7575

@@ -93,7 +93,7 @@ public function runDown(string $filename, OptionsData $options): void
9393

9494
protected function runOperation(Operation $operation, string $method): void
9595
{
96-
if ($this->hasOperation($operation, $method)) {
96+
if ($this->hasMethod($operation, $method)) {
9797
try {
9898
$this->runMethod($operation, $method, $operation->withinTransactions());
9999

@@ -107,14 +107,14 @@ protected function runOperation(Operation $operation, string $method): void
107107
}
108108
}
109109

110-
protected function hasOperation(Operation $operation, string $method): bool
110+
protected function hasMethod(Operation $operation, string $method): bool
111111
{
112112
return method_exists($operation, $method);
113113
}
114114

115-
protected function hasAsync(Operation $operation, OptionsData $options): bool
115+
protected function needAsync(Operation $operation, OptionsData $options): bool
116116
{
117-
return ! $options->sync && $operation->shouldBeAsync();
117+
return ! $options->sync && $operation->needAsync();
118118
}
119119

120120
protected function runMethod(Operation $operation, string $method, bool $transactions): void

tests/fixtures/app/async/2021_04_06_212742_every_time.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function shouldOnce(): bool
2525
return false;
2626
}
2727

28-
public function shouldBeAsync(): bool
28+
public function needAsync(): bool
2929
{
3030
return true;
3131
}

tests/fixtures/app/async/2023_04_06_212637_foo_bar.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ protected function table(): Builder
2020
return DB::table('test');
2121
}
2222

23-
public function shouldBeAsync(): bool
23+
public function needAsync(): bool
2424
{
2525
return true;
2626
}

0 commit comments

Comments
 (0)