Skip to content

Commit d08a9b0

Browse files
authored
Revert "[11.x] Name of job set by displayName() must be honoured by Schedule …" (#51034)
This reverts commit d63d2b1.
1 parent c1bec87 commit d08a9b0

File tree

3 files changed

+9
-89
lines changed

3 files changed

+9
-89
lines changed

src/Illuminate/Console/Scheduling/Schedule.php

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -154,19 +154,15 @@ public function command($command, array $parameters = [])
154154
*/
155155
public function job($job, $queue = null, $connection = null)
156156
{
157-
$instance = is_string($job)
158-
? Container::getInstance()->make($job)
159-
: $job;
160-
161-
$name = method_exists($instance, 'displayName')
162-
? $instance->displayName()
163-
: $instance::class;
164-
165-
return $this->call(function () use ($instance, $queue, $connection) {
166-
$instance instanceof ShouldQueue
167-
? $this->dispatchToQueue($instance, $queue ?? $instance->queue, $connection ?? $instance->connection)
168-
: $this->dispatchNow($instance);
169-
})->name($name);
157+
return $this->call(function () use ($job, $queue, $connection) {
158+
$job = is_string($job) ? Container::getInstance()->make($job) : $job;
159+
160+
if ($job instanceof ShouldQueue) {
161+
$this->dispatchToQueue($job, $queue ?? $job->queue, $connection ?? $job->connection);
162+
} else {
163+
$this->dispatchNow($job);
164+
}
165+
})->name(is_string($job) ? $job : get_class($job));
170166
}
171167

172168
/**

tests/Console/Fixtures/JobToTestWithSchedule.php

Lines changed: 0 additions & 14 deletions
This file was deleted.

tests/Console/Scheduling/ScheduleTest.php

Lines changed: 0 additions & 62 deletions
This file was deleted.

0 commit comments

Comments
 (0)