Skip to content

[11.x] Fix deprecation warnings in optimize:clear and optimize #54197

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

Merged
merged 2 commits into from
Jan 15, 2025
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
2 changes: 1 addition & 1 deletion src/Illuminate/Foundation/Console/OptimizeClearCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function handle()
{
$this->components->info('Clearing cached bootstrap files.');

$exceptions = Collection::wrap(explode(',', $this->option('except')))
$exceptions = Collection::wrap(explode(',', $this->option('except') ?? ''))
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there the need, to call all these at all if $this->option('except') is null? Maybe let's just wrap that in an if statement

Copy link
Contributor

Choose a reason for hiding this comment

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

see #54214

->map(fn ($except) => trim($except))
->filter()
->unique()
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Foundation/Console/OptimizeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function handle()
{
$this->components->info('Caching framework bootstrap, configuration, and metadata.');

$exceptions = Collection::wrap(explode(',', $this->option('except')))
$exceptions = Collection::wrap(explode(',', $this->option('except') ?? ''))
->map(fn ($except) => trim($except))
->filter()
->unique()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ protected function getPackageProviders($app): array

public function testCanListenToOptimizingEvent(): void
{
$this->withoutDeprecationHandling();

$this->artisan('optimize:clear')
->assertSuccessful()
->expectsOutputToContain('ServiceProviderWithOptimizeClear');
Expand Down
2 changes: 2 additions & 0 deletions tests/Integration/Foundation/Console/OptimizeCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ protected function getPackageProviders($app): array

public function testCanListenToOptimizingEvent(): void
{
$this->withoutDeprecationHandling();

$this->artisan('optimize')
->assertSuccessful()
->expectsOutputToContain('my package');
Expand Down