@@ -150,18 +150,18 @@ class Event
150
150
public $ mutex ;
151
151
152
152
/**
153
- * The exit status code of the command .
153
+ * The mutex name resolver callback .
154
154
*
155
- * @var int |null
155
+ * @var \Closure |null
156
156
*/
157
- public $ exitCode ;
157
+ public $ mutexNameResolver ;
158
158
159
159
/**
160
- * The mutex name resolver callback .
160
+ * The exit status code of the command .
161
161
*
162
- * @var \Closure |null
162
+ * @var int |null
163
163
*/
164
- public $ createMutexNameCallback ;
164
+ public $ exitCode ;
165
165
166
166
/**
167
167
* Create a new event instance.
@@ -942,24 +942,24 @@ public function preventOverlapsUsing(EventMutex $mutex)
942
942
*/
943
943
public function mutexName ()
944
944
{
945
- $ createMutexNameUsing = $ this ->createMutexNameCallback ;
945
+ $ mutexNameResolver = $ this ->mutexNameResolver ;
946
946
947
- if (! is_null ($ createMutexNameUsing ) && is_callable ($ createMutexNameUsing )) {
948
- return $ createMutexNameUsing ($ this );
947
+ if (! is_null ($ mutexNameResolver ) && is_callable ($ mutexNameResolver )) {
948
+ return $ mutexNameResolver ($ this );
949
949
}
950
950
951
951
return 'framework ' .DIRECTORY_SEPARATOR .'schedule- ' .sha1 ($ this ->expression .$ this ->command );
952
952
}
953
953
954
954
/**
955
- * Set the mutex name resolver callback.
955
+ * Set the mutex name or name resolver callback.
956
956
*
957
- * @param \Closure $callback
957
+ * @param \Closure|string $mutexName
958
958
* @return $this
959
959
*/
960
- public function createMutexNameUsing (Closure $ callback )
960
+ public function createMutexNameUsing (Closure | string $ mutexName )
961
961
{
962
- $ this ->createMutexNameCallback = $ callback ;
962
+ $ this ->mutexNameResolver = is_string ( $ mutexName ) ? fn () => $ mutexName : $ mutexName ;
963
963
964
964
return $ this ;
965
965
}
0 commit comments