Skip to content

Commit 5107066

Browse files
authored
[11.x] Fix deprecation warnings in optimize:clear and optimize (#54197)
* Update OptimizeCommand.php * null coalesce in optimize clear && test
1 parent 4ddd68e commit 5107066

File tree

4 files changed

+6
-2
lines changed

4 files changed

+6
-2
lines changed

src/Illuminate/Foundation/Console/OptimizeClearCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function handle()
3434
{
3535
$this->components->info('Clearing cached bootstrap files.');
3636

37-
$exceptions = Collection::wrap(explode(',', $this->option('except')))
37+
$exceptions = Collection::wrap(explode(',', $this->option('except') ?? ''))
3838
->map(fn ($except) => trim($except))
3939
->filter()
4040
->unique()

src/Illuminate/Foundation/Console/OptimizeCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function handle()
3434
{
3535
$this->components->info('Caching framework bootstrap, configuration, and metadata.');
3636

37-
$exceptions = Collection::wrap(explode(',', $this->option('except')))
37+
$exceptions = Collection::wrap(explode(',', $this->option('except') ?? ''))
3838
->map(fn ($except) => trim($except))
3939
->filter()
4040
->unique()

tests/Integration/Foundation/Console/OptimizeClearCommandTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ protected function getPackageProviders($app): array
1515

1616
public function testCanListenToOptimizingEvent(): void
1717
{
18+
$this->withoutDeprecationHandling();
19+
1820
$this->artisan('optimize:clear')
1921
->assertSuccessful()
2022
->expectsOutputToContain('ServiceProviderWithOptimizeClear');

tests/Integration/Foundation/Console/OptimizeCommandTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ protected function getPackageProviders($app): array
2323

2424
public function testCanListenToOptimizingEvent(): void
2525
{
26+
$this->withoutDeprecationHandling();
27+
2628
$this->artisan('optimize')
2729
->assertSuccessful()
2830
->expectsOutputToContain('my package');

0 commit comments

Comments
 (0)