Skip to content

Commit 7727687

Browse files
committed
Merge branch '9.x'
2 parents 718b4b6 + dddc27f commit 7727687

File tree

90 files changed

+407
-80
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+407
-80
lines changed

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: '3'
22
services:
33
dynamodb:
4-
image: amazon/dynamodb-local
4+
image: amazon/dynamodb-local
55
ports:
66
- "8000:8000"
77
command: ["-jar", "DynamoDBLocal.jar", "-sharedDb", "-inMemory"]

src/Illuminate/Auth/Console/ClearResetsCommand.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
namespace Illuminate\Auth\Console;
44

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

8+
#[AsCommand(name: 'auth:clear-resets')]
79
class ClearResetsCommand extends Command
810
{
911
/**
@@ -19,6 +21,8 @@ class ClearResetsCommand extends Command
1921
* This name is used to identify the command during lazy loading.
2022
*
2123
* @var string|null
24+
*
25+
* @deprecated
2226
*/
2327
protected static $defaultName = 'auth:clear-resets';
2428

src/Illuminate/Auth/SessionGuard.php

Lines changed: 7 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -685,9 +685,7 @@ protected function rehashUserPassword($password, $attribute)
685685
*/
686686
public function attempting($callback)
687687
{
688-
if (isset($this->events)) {
689-
$this->events->listen(Events\Attempting::class, $callback);
690-
}
688+
$this->events?->listen(Events\Attempting::class, $callback);
691689
}
692690

693691
/**
@@ -699,11 +697,7 @@ public function attempting($callback)
699697
*/
700698
protected function fireAttemptEvent(array $credentials, $remember = false)
701699
{
702-
if (isset($this->events)) {
703-
$this->events->dispatch(new Attempting(
704-
$this->name, $credentials, $remember
705-
));
706-
}
700+
$this->events?->dispatch(new Attempting($this->name, $credentials, $remember));
707701
}
708702

709703
/**
@@ -714,11 +708,7 @@ protected function fireAttemptEvent(array $credentials, $remember = false)
714708
*/
715709
protected function fireValidatedEvent($user)
716710
{
717-
if (isset($this->events)) {
718-
$this->events->dispatch(new Validated(
719-
$this->name, $user
720-
));
721-
}
711+
$this->events?->dispatch(new Validated($this->name, $user));
722712
}
723713

724714
/**
@@ -730,11 +720,7 @@ protected function fireValidatedEvent($user)
730720
*/
731721
protected function fireLoginEvent($user, $remember = false)
732722
{
733-
if (isset($this->events)) {
734-
$this->events->dispatch(new Login(
735-
$this->name, $user, $remember
736-
));
737-
}
723+
$this->events?->dispatch(new Login($this->name, $user, $remember));
738724
}
739725

740726
/**
@@ -745,11 +731,7 @@ protected function fireLoginEvent($user, $remember = false)
745731
*/
746732
protected function fireAuthenticatedEvent($user)
747733
{
748-
if (isset($this->events)) {
749-
$this->events->dispatch(new Authenticated(
750-
$this->name, $user
751-
));
752-
}
734+
$this->events?->dispatch(new Authenticated($this->name, $user));
753735
}
754736

755737
/**
@@ -760,11 +742,7 @@ protected function fireAuthenticatedEvent($user)
760742
*/
761743
protected function fireOtherDeviceLogoutEvent($user)
762744
{
763-
if (isset($this->events)) {
764-
$this->events->dispatch(new OtherDeviceLogout(
765-
$this->name, $user
766-
));
767-
}
745+
$this->events?->dispatch(new OtherDeviceLogout($this->name, $user));
768746
}
769747

770748
/**
@@ -776,11 +754,7 @@ protected function fireOtherDeviceLogoutEvent($user)
776754
*/
777755
protected function fireFailedEvent($user, array $credentials)
778756
{
779-
if (isset($this->events)) {
780-
$this->events->dispatch(new Failed(
781-
$this->name, $user, $credentials
782-
));
783-
}
757+
$this->events?->dispatch(new Failed($this->name, $user, $credentials));
784758
}
785759

786760
/**

src/Illuminate/Cache/Console/CacheTableCommand.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
use Illuminate\Console\Command;
66
use Illuminate\Filesystem\Filesystem;
77
use Illuminate\Support\Composer;
8+
use Symfony\Component\Console\Attribute\AsCommand;
89

10+
#[AsCommand(name: 'cache:table')]
911
class CacheTableCommand extends Command
1012
{
1113
/**
@@ -21,6 +23,8 @@ class CacheTableCommand extends Command
2123
* This name is used to identify the command during lazy loading.
2224
*
2325
* @var string|null
26+
*
27+
* @deprecated
2428
*/
2529
protected static $defaultName = 'cache:table';
2630

src/Illuminate/Cache/Console/ClearCommand.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
use Illuminate\Cache\CacheManager;
66
use Illuminate\Console\Command;
77
use Illuminate\Filesystem\Filesystem;
8+
use Symfony\Component\Console\Attribute\AsCommand;
89
use Symfony\Component\Console\Input\InputArgument;
910
use Symfony\Component\Console\Input\InputOption;
1011

12+
#[AsCommand(name: 'cache:clear')]
1113
class ClearCommand extends Command
1214
{
1315
/**
@@ -23,6 +25,8 @@ class ClearCommand extends Command
2325
* This name is used to identify the command during lazy loading.
2426
*
2527
* @var string|null
28+
*
29+
* @deprecated
2630
*/
2731
protected static $defaultName = 'cache:clear';
2832

src/Illuminate/Cache/Console/ForgetCommand.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
use Illuminate\Cache\CacheManager;
66
use Illuminate\Console\Command;
7+
use Symfony\Component\Console\Attribute\AsCommand;
78

9+
#[AsCommand(name: 'cache:forget')]
810
class ForgetCommand extends Command
911
{
1012
/**
@@ -20,6 +22,8 @@ class ForgetCommand extends Command
2022
* This name is used to identify the command during lazy loading.
2123
*
2224
* @var string|null
25+
*
26+
* @deprecated
2327
*/
2428
protected static $defaultName = 'cache:forget';
2529

src/Illuminate/Console/Scheduling/ScheduleFinishCommand.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
use Illuminate\Console\Command;
66
use Illuminate\Console\Events\ScheduledBackgroundTaskFinished;
77
use Illuminate\Contracts\Events\Dispatcher;
8+
use Symfony\Component\Console\Attribute\AsCommand;
89

10+
#[AsCommand(name: 'schedule:finish')]
911
class ScheduleFinishCommand extends Command
1012
{
1113
/**
@@ -21,6 +23,8 @@ class ScheduleFinishCommand extends Command
2123
* This name is used to identify the command during lazy loading.
2224
*
2325
* @var string|null
26+
*
27+
* @deprecated
2428
*/
2529
protected static $defaultName = 'schedule:finish';
2630

src/Illuminate/Console/Scheduling/ScheduleListCommand.php

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,30 @@ class ScheduleListCommand extends Command
4545
public function handle(Schedule $schedule)
4646
{
4747
$events = collect($schedule->events());
48-
$terminalWidth = $this->getTerminalWidth();
48+
49+
if ($events->isEmpty()) {
50+
$this->comment('No scheduled tasks have been defined.');
51+
52+
return;
53+
}
54+
55+
$terminalWidth = self::getTerminalWidth();
56+
4957
$expressionSpacing = $this->getCronExpressionSpacing($events);
5058

51-
$events = $events->map(function ($event) use ($terminalWidth, $expressionSpacing) {
59+
$timezone = new DateTimeZone($this->option('timezone') ?? config('app.timezone'));
60+
61+
$events = $events->map(function ($event) use ($terminalWidth, $expressionSpacing, $timezone) {
5262
$expression = $this->formatCronExpression($event->expression, $expressionSpacing);
5363

5464
$command = $event->command;
5565
$description = $event->description;
5666

5767
if (! $this->output->isVerbose()) {
58-
$command = str_replace(
59-
Application::artisanBinary(),
68+
$command = str_replace([Application::phpBinary(), Application::artisanBinary()], [
69+
'php',
6070
preg_replace("#['\"]#", '', Application::artisanBinary()),
61-
str_replace(Application::phpBinary(), 'php', $event->command)
62-
);
71+
], $event->command);
6372
}
6473

6574
if ($event instanceof CallbackEvent) {
@@ -77,7 +86,7 @@ public function handle(Schedule $schedule)
7786

7887
$nextDueDate = Carbon::create((new CronExpression($event->expression))
7988
->getNextRunDate(Carbon::now()->setTimezone($event->timezone))
80-
->setTimezone(new DateTimeZone($this->option('timezone') ?? config('app.timezone')))
89+
->setTimezone($timezone)
8190
);
8291

8392
$nextDueDate = $this->output->isVerbose()
@@ -109,11 +118,7 @@ public function handle(Schedule $schedule)
109118
) : ''];
110119
});
111120

112-
if ($events->isEmpty()) {
113-
return $this->comment('No scheduled tasks have been defined.');
114-
}
115-
116-
$this->output->writeln(
121+
$this->line(
117122
$events->flatten()->filter()->prepend('')->push('')->toArray()
118123
);
119124
}
@@ -140,10 +145,10 @@ private function getCronExpressionSpacing($events)
140145
*/
141146
private function formatCronExpression($expression, $spacing)
142147
{
143-
$expression = explode(' ', $expression);
148+
$expressions = explode(' ', $expression);
144149

145150
return collect($spacing)
146-
->map(fn ($length, $index) => $expression[$index] = str_pad($expression[$index], $length))
151+
->map(fn ($length, $index) => str_pad($expressions[$index], $length))
147152
->implode(' ');
148153
}
149154

src/Illuminate/Console/Scheduling/ScheduleRunCommand.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010
use Illuminate\Contracts\Debug\ExceptionHandler;
1111
use Illuminate\Contracts\Events\Dispatcher;
1212
use Illuminate\Support\Facades\Date;
13+
use Symfony\Component\Console\Attribute\AsCommand;
1314
use Throwable;
1415

16+
#[AsCommand(name: 'schedule:run')]
1517
class ScheduleRunCommand extends Command
1618
{
1719
/**
@@ -27,6 +29,8 @@ class ScheduleRunCommand extends Command
2729
* This name is used to identify the command during lazy loading.
2830
*
2931
* @var string|null
32+
*
33+
* @deprecated
3034
*/
3135
protected static $defaultName = 'schedule:run';
3236

src/Illuminate/Console/Scheduling/ScheduleTestCommand.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22

33
namespace Illuminate\Console\Scheduling;
44

5+
use Illuminate\Console\Application;
56
use Illuminate\Console\Command;
6-
use Illuminate\Support\Str;
7+
use Symfony\Component\Console\Attribute\AsCommand;
78

9+
#[AsCommand(name: 'schedule:test')]
810
class ScheduleTestCommand extends Command
911
{
1012
/**
@@ -20,6 +22,8 @@ class ScheduleTestCommand extends Command
2022
* This name is used to identify the command during lazy loading.
2123
*
2224
* @var string|null
25+
*
26+
* @deprecated
2327
*/
2428
protected static $defaultName = 'schedule:test';
2529

@@ -51,7 +55,11 @@ public function handle(Schedule $schedule)
5155
}
5256

5357
if (! empty($name = $this->option('name'))) {
54-
$matches = array_filter($commandNames, fn ($commandName) => Str::endsWith($commandName, $name));
58+
$commandBinary = Application::phpBinary().' '.Application::artisanBinary();
59+
60+
$matches = array_filter($commandNames, function ($commandName) use ($commandBinary, $name) {
61+
return trim(str_replace($commandBinary, '', $commandName)) === $name;
62+
});
5563

5664
if (count($matches) !== 1) {
5765
return $this->error('No matching scheduled command found.');

0 commit comments

Comments
 (0)