diff --git a/src/Neves/Events/EventServiceProvider.php b/src/Neves/Events/EventServiceProvider.php index 1f8a5f87af..ebfc769b99 100644 --- a/src/Neves/Events/EventServiceProvider.php +++ b/src/Neves/Events/EventServiceProvider.php @@ -27,7 +27,7 @@ public function register() $eventDispatcher = $this->app->make(EventDispatcher::class); $this->app->extend('events', function () use ($eventDispatcher) { $dispatcher = new TransactionalDispatcher($eventDispatcher); - $dispatcher->listen(TransactionalClosureEvent::class, function(TransactionalClosureEvent $event) { + $dispatcher->listen(TransactionalClosureEvent::class, function (TransactionalClosureEvent $event) { ($event->getClosure())(); }); $dispatcher->setTransactionalEvents($this->app['config']->get('transactional-events.transactional')); diff --git a/src/Neves/Events/TransactionalClosureEvent.php b/src/Neves/Events/TransactionalClosureEvent.php index 6bd4272209..d0467a11d1 100644 --- a/src/Neves/Events/TransactionalClosureEvent.php +++ b/src/Neves/Events/TransactionalClosureEvent.php @@ -1,9 +1,7 @@ closure = $closure; } - public function getClosure(): Closure { + public function getClosure(): Closure + { return $this->closure; } -} \ No newline at end of file +} diff --git a/src/helpers.php b/src/helpers.php index 17c819a8be..d0903bc797 100644 --- a/src/helpers.php +++ b/src/helpers.php @@ -16,4 +16,4 @@ function transactional(Closure $callable) $dispatcher->dispatch(new TransactionalClosureEvent($callable)); } -} \ No newline at end of file +} diff --git a/tests/TransactionalDispatcherTest.php b/tests/TransactionalDispatcherTest.php index ec3c53ba4e..291ad978eb 100644 --- a/tests/TransactionalDispatcherTest.php +++ b/tests/TransactionalDispatcherTest.php @@ -273,7 +273,7 @@ public function it_immediately_dispatches_specific_events_excluded_on_a_pattern( public function it_provides_transactional_behavior_of_custom_closures() { DB::transaction(function () { - $this->dispatcher->dispatch(new TransactionalClosureEvent(function() { + $this->dispatcher->dispatch(new TransactionalClosureEvent(function () { $_SERVER['__events'] = 'bar'; })); @@ -287,7 +287,7 @@ public function it_provides_transactional_behavior_of_custom_closures() public function it_provides_transactional_behavior_of_custom_closures_using_transactional_helper() { DB::transaction(function () { - transactional(function() { + transactional(function () { $_SERVER['__events'] = 'bar'; });