diff --git a/src/Illuminate/Console/Scheduling/Event.php b/src/Illuminate/Console/Scheduling/Event.php index 14d5fc63960c..a132ad3c63da 100644 --- a/src/Illuminate/Console/Scheduling/Event.php +++ b/src/Illuminate/Console/Scheduling/Event.php @@ -150,18 +150,18 @@ class Event public $mutex; /** - * The exit status code of the command. + * The mutex name resolver callback. * - * @var int|null + * @var \Closure|null */ - public $exitCode; + public $mutexNameResolver; /** - * The mutex name resolver callback. + * The exit status code of the command. * - * @var \Closure|null + * @var int|null */ - public $createMutexNameCallback; + public $exitCode; /** * Create a new event instance. @@ -942,24 +942,24 @@ public function preventOverlapsUsing(EventMutex $mutex) */ public function mutexName() { - $createMutexNameUsing = $this->createMutexNameCallback; + $mutexNameResolver = $this->mutexNameResolver; - if (! is_null($createMutexNameUsing) && is_callable($createMutexNameUsing)) { - return $createMutexNameUsing($this); + if (! is_null($mutexNameResolver) && is_callable($mutexNameResolver)) { + return $mutexNameResolver($this); } return 'framework'.DIRECTORY_SEPARATOR.'schedule-'.sha1($this->expression.$this->command); } /** - * Set the mutex name resolver callback. + * Set the mutex name or name resolver callback. * - * @param \Closure $callback + * @param \Closure|string $mutexName * @return $this */ - public function createMutexNameUsing(Closure $callback) + public function createMutexNameUsing(Closure|string $mutexName) { - $this->createMutexNameCallback = $callback; + $this->mutexNameResolver = is_string($mutexName) ? fn () => $mutexName : $mutexName; return $this; }