Skip to content

Commit 42300e0

Browse files
authored
[5.x] Make commands lazy (#1399)
* Make commands lazy * lint * lint * Fix soft dependency
1 parent 7dc7c05 commit 42300e0

19 files changed

+37
-1
lines changed

composer.json

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"illuminate/support": "^9.21|^10.0|^11.0",
2020
"nesbot/carbon": "^2.17|^3.0",
2121
"ramsey/uuid": "^4.0",
22+
"symfony/console": "^6.0|^7.0",
2223
"symfony/process": "^6.0|^7.0",
2324
"symfony/error-handler": "^6.0|^7.0"
2425
},

src/Console/ClearCommand.php

+2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
use Illuminate\Support\Arr;
99
use Laravel\Horizon\Contracts\JobRepository;
1010
use Laravel\Horizon\RedisQueue;
11+
use Symfony\Component\Console\Attribute\AsCommand;
1112

13+
#[AsCommand(name: 'horizon:clear')]
1214
class ClearCommand extends Command
1315
{
1416
use ConfirmableTrait;

src/Console/ClearMetricsCommand.php

+2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
use Illuminate\Console\Command;
66
use Laravel\Horizon\Contracts\MetricsRepository;
7+
use Symfony\Component\Console\Attribute\AsCommand;
78

9+
#[AsCommand(name: 'horizon:clear-metrics')]
810
class ClearMetricsCommand extends Command
911
{
1012
/**

src/Console/ContinueCommand.php

+2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
use Illuminate\Support\Str;
88
use Laravel\Horizon\Contracts\MasterSupervisorRepository;
99
use Laravel\Horizon\MasterSupervisor;
10+
use Symfony\Component\Console\Attribute\AsCommand;
1011

12+
#[AsCommand(name: 'horizon:continue')]
1113
class ContinueCommand extends Command
1214
{
1315
/**

src/Console/ContinueSupervisorCommand.php

+2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
use Illuminate\Support\Str;
77
use Laravel\Horizon\Contracts\SupervisorRepository;
88
use Laravel\Horizon\MasterSupervisor;
9+
use Symfony\Component\Console\Attribute\AsCommand;
910

11+
#[AsCommand(name: 'horizon:continue-supervisor')]
1012
class ContinueSupervisorCommand extends Command
1113
{
1214
/**

src/Console/ForgetFailedCommand.php

+2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
use Illuminate\Console\Command;
66
use Laravel\Horizon\Contracts\JobRepository;
7+
use Symfony\Component\Console\Attribute\AsCommand;
78

9+
#[AsCommand(name: 'horizon:forget')]
810
class ForgetFailedCommand extends Command
911
{
1012
/**

src/Console/HorizonCommand.php

+2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
use Laravel\Horizon\Contracts\MasterSupervisorRepository;
77
use Laravel\Horizon\MasterSupervisor;
88
use Laravel\Horizon\ProvisioningPlan;
9+
use Symfony\Component\Console\Attribute\AsCommand;
910

11+
#[AsCommand(name: 'horizon')]
1012
class HorizonCommand extends Command
1113
{
1214
/**

src/Console/InstallCommand.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
use Illuminate\Console\Command;
66
use Illuminate\Support\ServiceProvider;
77
use Illuminate\Support\Str;
8+
use Symfony\Component\Console\Attribute\AsCommand;
89

10+
#[AsCommand(name: 'horizon:install')]
911
class InstallCommand extends Command
1012
{
1113
/**
@@ -52,7 +54,6 @@ protected function registerHorizonServiceProvider()
5254
$namespace = Str::replaceLast('\\', '', $this->laravel->getNamespace());
5355

5456
if (file_exists($this->laravel->bootstrapPath('providers.php'))) {
55-
// @phpstan-ignore-next-line
5657
ServiceProvider::addProviderToBootstrapFile("{$namespace}\\Providers\\HorizonServiceProvider");
5758
} else {
5859
$appConfig = file_get_contents(config_path('app.php'));

src/Console/ListCommand.php

+2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
use Illuminate\Console\Command;
66
use Laravel\Horizon\Contracts\MasterSupervisorRepository;
7+
use Symfony\Component\Console\Attribute\AsCommand;
78

9+
#[AsCommand(name: 'horizon:list')]
810
class ListCommand extends Command
911
{
1012
/**

src/Console/PauseCommand.php

+2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
use Illuminate\Support\Str;
88
use Laravel\Horizon\Contracts\MasterSupervisorRepository;
99
use Laravel\Horizon\MasterSupervisor;
10+
use Symfony\Component\Console\Attribute\AsCommand;
1011

12+
#[AsCommand(name: 'horizon:pause')]
1113
class PauseCommand extends Command
1214
{
1315
/**

src/Console/PauseSupervisorCommand.php

+2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
use Illuminate\Support\Str;
77
use Laravel\Horizon\Contracts\SupervisorRepository;
88
use Laravel\Horizon\MasterSupervisor;
9+
use Symfony\Component\Console\Attribute\AsCommand;
910

11+
#[AsCommand(name: 'horizon:pause-supervisor')]
1012
class PauseSupervisorCommand extends Command
1113
{
1214
/**

src/Console/PublishCommand.php

+2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
namespace Laravel\Horizon\Console;
44

55
use Illuminate\Console\Command;
6+
use Symfony\Component\Console\Attribute\AsCommand;
67

8+
#[AsCommand(name: 'horizon:publish')]
79
class PublishCommand extends Command
810
{
911
/**

src/Console/PurgeCommand.php

+2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
use Laravel\Horizon\Contracts\SupervisorRepository;
1010
use Laravel\Horizon\MasterSupervisor;
1111
use Laravel\Horizon\ProcessInspector;
12+
use Symfony\Component\Console\Attribute\AsCommand;
1213

14+
#[AsCommand(name: 'horizon:purge')]
1315
class PurgeCommand extends Command
1416
{
1517
/**

src/Console/SnapshotCommand.php

+2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
use Illuminate\Console\Command;
66
use Laravel\Horizon\Contracts\MetricsRepository;
77
use Laravel\Horizon\Lock;
8+
use Symfony\Component\Console\Attribute\AsCommand;
89

10+
#[AsCommand(name: 'horizon:snapshot')]
911
class SnapshotCommand extends Command
1012
{
1113
/**

src/Console/StatusCommand.php

+2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
use Illuminate\Console\Command;
66
use Laravel\Horizon\Contracts\MasterSupervisorRepository;
7+
use Symfony\Component\Console\Attribute\AsCommand;
78

9+
#[AsCommand(name: 'horizon:status')]
810
class StatusCommand extends Command
911
{
1012
/**

src/Console/SupervisorCommand.php

+2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
use Illuminate\Console\Command;
77
use Laravel\Horizon\SupervisorFactory;
88
use Laravel\Horizon\SupervisorOptions;
9+
use Symfony\Component\Console\Attribute\AsCommand;
910

11+
#[AsCommand(name: 'horizon:supervisor')]
1012
class SupervisorCommand extends Command
1113
{
1214
/**

src/Console/SupervisorsCommand.php

+2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
use Illuminate\Console\Command;
66
use Laravel\Horizon\Contracts\SupervisorRepository;
7+
use Symfony\Component\Console\Attribute\AsCommand;
78

9+
#[AsCommand(name: 'horizon:supervisors')]
810
class SupervisorsCommand extends Command
911
{
1012
/**

src/Console/TerminateCommand.php

+2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
use Illuminate\Support\Str;
1010
use Laravel\Horizon\Contracts\MasterSupervisorRepository;
1111
use Laravel\Horizon\MasterSupervisor;
12+
use Symfony\Component\Console\Attribute\AsCommand;
1213

14+
#[AsCommand(name: 'horizon:terminate')]
1315
class TerminateCommand extends Command
1416
{
1517
use InteractsWithTime;

src/Console/TimeoutCommand.php

+2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
use Illuminate\Console\Command;
66
use Laravel\Horizon\MasterSupervisor;
77
use Laravel\Horizon\ProvisioningPlan;
8+
use Symfony\Component\Console\Attribute\AsCommand;
89

10+
#[AsCommand(name: 'horizon:timeout')]
911
class TimeoutCommand extends Command
1012
{
1113
/**

0 commit comments

Comments
 (0)