Skip to content

Instantly share code, notes, and snippets.

@clemherreman
Created October 28, 2014 10:04
Show Gist options
  • Save clemherreman/aacf19b7cfa2360f8289 to your computer and use it in GitHub Desktop.
Save clemherreman/aacf19b7cfa2360f8289 to your computer and use it in GitHub Desktop.
class MyService {
private $finderFactory;
public function __construct(callable $finderFactory)
{
$this->finderFactory = $finderFactory;
}
public function findStuff()
{
$finder = $this->finderFactory();
$finder->doStuff();
...
}
}
@docteurklein
Copy link

    $finder = $this->finderFactory();

won't work. I know it's just an example :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment