Skip to content

Commit

Permalink
Allow listeners added via config to be compiled in container by makin…
Browse files Browse the repository at this point in the history
…g them factories
  • Loading branch information
AydinHassan committed Mar 10, 2024
1 parent d2c68e0 commit f391aff
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/Event/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,8 @@

if (!function_exists('PhpSchool\PhpWorkshop\Event\containerListener')) {

/**
* @param string $service
* @param string $method
* @return ContainerListenerHelper
*/
function containerListener(string $service, string $method = '__invoke')
function containerListener(string $service, string $method = '__invoke'): callable
{
return new ContainerListenerHelper($service, $method);
return fn () => new ContainerListenerHelper($service, $method);
}
}

0 comments on commit f391aff

Please sign in to comment.