Skip to content

Commit

Permalink
fixed container closure and anonymous function
Browse files Browse the repository at this point in the history
  • Loading branch information
JanHuang committed Feb 1, 2017
1 parent 03608cf commit 8fe6eb8
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,12 @@ public function get($name)

if (is_object($service)) {
// magic invoke class
if (method_exists($service, '__invoke')) {
return $service;
if (method_exists($service, 'bindTo') && is_callable($service)) {
return $service($this);
}

// anonymous function
if (is_callable($service)) {
return $service($this);
return $service;
}
}

Expand Down

0 comments on commit 8fe6eb8

Please sign in to comment.