Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.x] Make commands lazy #1399

Merged
merged 4 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"illuminate/support": "^9.21|^10.0|^11.0",
"nesbot/carbon": "^2.17|^3.0",
"ramsey/uuid": "^4.0",
"symfony/console": "^6.0|^7.0",
"symfony/process": "^6.0|^7.0",
"symfony/error-handler": "^6.0|^7.0"
},
Expand Down
2 changes: 2 additions & 0 deletions src/Console/ClearCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
use Illuminate\Support\Arr;
use Laravel\Horizon\Contracts\JobRepository;
use Laravel\Horizon\RedisQueue;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'horizon:clear')]
class ClearCommand extends Command
{
use ConfirmableTrait;
Expand Down
2 changes: 2 additions & 0 deletions src/Console/ClearMetricsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

use Illuminate\Console\Command;
use Laravel\Horizon\Contracts\MetricsRepository;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'horizon:clear-metrics')]
class ClearMetricsCommand extends Command
{
/**
Expand Down
2 changes: 2 additions & 0 deletions src/Console/ContinueCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
use Illuminate\Support\Str;
use Laravel\Horizon\Contracts\MasterSupervisorRepository;
use Laravel\Horizon\MasterSupervisor;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'horizon:continue')]
class ContinueCommand extends Command
{
/**
Expand Down
2 changes: 2 additions & 0 deletions src/Console/ContinueSupervisorCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
use Illuminate\Support\Str;
use Laravel\Horizon\Contracts\SupervisorRepository;
use Laravel\Horizon\MasterSupervisor;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'horizon:continue-supervisor')]
class ContinueSupervisorCommand extends Command
{
/**
Expand Down
2 changes: 2 additions & 0 deletions src/Console/ForgetFailedCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

use Illuminate\Console\Command;
use Laravel\Horizon\Contracts\JobRepository;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'horizon:forget')]
class ForgetFailedCommand extends Command
{
/**
Expand Down
2 changes: 2 additions & 0 deletions src/Console/HorizonCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
use Laravel\Horizon\Contracts\MasterSupervisorRepository;
use Laravel\Horizon\MasterSupervisor;
use Laravel\Horizon\ProvisioningPlan;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'horizon')]
class HorizonCommand extends Command
{
/**
Expand Down
3 changes: 2 additions & 1 deletion src/Console/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
use Illuminate\Console\Command;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Str;
use Symfony\Component\Console\Attribute\AsCommand;

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

if (file_exists($this->laravel->bootstrapPath('providers.php'))) {
// @phpstan-ignore-next-line
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PHPStan in CI was complaining that it didn't need this.

https://github.com/laravel/horizon/actions/runs/8335290386/job/22810504345

ServiceProvider::addProviderToBootstrapFile("{$namespace}\\Providers\\HorizonServiceProvider");
} else {
$appConfig = file_get_contents(config_path('app.php'));
Expand Down
2 changes: 2 additions & 0 deletions src/Console/ListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

use Illuminate\Console\Command;
use Laravel\Horizon\Contracts\MasterSupervisorRepository;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'horizon:list')]
class ListCommand extends Command
{
/**
Expand Down
2 changes: 2 additions & 0 deletions src/Console/PauseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
use Illuminate\Support\Str;
use Laravel\Horizon\Contracts\MasterSupervisorRepository;
use Laravel\Horizon\MasterSupervisor;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'horizon:pause')]
class PauseCommand extends Command
{
/**
Expand Down
2 changes: 2 additions & 0 deletions src/Console/PauseSupervisorCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
use Illuminate\Support\Str;
use Laravel\Horizon\Contracts\SupervisorRepository;
use Laravel\Horizon\MasterSupervisor;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'horizon:pause-supervisor')]
class PauseSupervisorCommand extends Command
{
/**
Expand Down
2 changes: 2 additions & 0 deletions src/Console/PublishCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
namespace Laravel\Horizon\Console;

use Illuminate\Console\Command;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'horizon:publish')]
class PublishCommand extends Command
{
/**
Expand Down
2 changes: 2 additions & 0 deletions src/Console/PurgeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
use Laravel\Horizon\Contracts\SupervisorRepository;
use Laravel\Horizon\MasterSupervisor;
use Laravel\Horizon\ProcessInspector;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'horizon:purge')]
class PurgeCommand extends Command
{
/**
Expand Down
2 changes: 2 additions & 0 deletions src/Console/SnapshotCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
use Illuminate\Console\Command;
use Laravel\Horizon\Contracts\MetricsRepository;
use Laravel\Horizon\Lock;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'horizon:snapshot')]
class SnapshotCommand extends Command
{
/**
Expand Down
2 changes: 2 additions & 0 deletions src/Console/StatusCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

use Illuminate\Console\Command;
use Laravel\Horizon\Contracts\MasterSupervisorRepository;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'horizon:status')]
class StatusCommand extends Command
{
/**
Expand Down
2 changes: 2 additions & 0 deletions src/Console/SupervisorCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
use Illuminate\Console\Command;
use Laravel\Horizon\SupervisorFactory;
use Laravel\Horizon\SupervisorOptions;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'horizon:supervisor')]
class SupervisorCommand extends Command
{
/**
Expand Down
2 changes: 2 additions & 0 deletions src/Console/SupervisorsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

use Illuminate\Console\Command;
use Laravel\Horizon\Contracts\SupervisorRepository;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'horizon:supervisors')]
class SupervisorsCommand extends Command
{
/**
Expand Down
2 changes: 2 additions & 0 deletions src/Console/TerminateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
use Illuminate\Support\Str;
use Laravel\Horizon\Contracts\MasterSupervisorRepository;
use Laravel\Horizon\MasterSupervisor;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'horizon:terminate')]
class TerminateCommand extends Command
{
use InteractsWithTime;
Expand Down
2 changes: 2 additions & 0 deletions src/Console/TimeoutCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
use Illuminate\Console\Command;
use Laravel\Horizon\MasterSupervisor;
use Laravel\Horizon\ProvisioningPlan;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'horizon:timeout')]
class TimeoutCommand extends Command
{
/**
Expand Down