File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -235,13 +235,17 @@ public static function setInvoker(callable $callable): void
235
235
*/
236
236
public function invoke ($ method , array $ vars = [])
237
237
{
238
+ if (is_string ($ method )) {
239
+ $ method = [$ this , $ method ];
240
+ }
241
+
238
242
if (self ::$ invoker ) {
239
243
$ call = self ::$ invoker ;
240
244
241
- return $ call ($ method instanceof Closure ? $ method : Closure::fromCallable ([ $ this , $ method] ), $ vars );
245
+ return $ call ($ method instanceof Closure ? $ method : Closure::fromCallable ($ method ), $ vars );
242
246
}
243
247
244
- return call_user_func_array ($ method instanceof Closure ? $ method : [ $ this , $ method ] , $ vars );
248
+ return call_user_func_array ($ method , $ vars );
245
249
}
246
250
247
251
/**
Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ protected function trigger(string $event): bool
93
93
}
94
94
95
95
if (method_exists ($ observer , $ call )) {
96
- $ result = call_user_func ([$ observer , $ call ], $ this );
96
+ $ result = $ this -> invoke ([$ observer , $ call ], [ $ this ] );
97
97
} elseif (is_object (self ::$ event ) && method_exists (self ::$ event , 'trigger ' )) {
98
98
$ result = self ::$ event ->trigger (static ::class . '. ' . $ event , $ this );
99
99
$ result = empty ($ result ) ? true : end ($ result );
You can’t perform that action at this time.
0 commit comments