Skip to content

Commit

Permalink
Merge pull request #2 from intraworlds/unset_broken_factory
Browse files Browse the repository at this point in the history
unset broken factory
  • Loading branch information
esler authored Nov 21, 2018
2 parents 5c7557d + 3aebea8 commit 2df98a5
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/ServiceContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ public function make(string $id)
// first try create instance naively
$instance = ($this->factories[$id] = static::buildSimpleFactory($id))();
} catch (\Throwable $t) {
unset($this->factories[$id]);

// cannot create instance naively for some reason, keep going and try create factory then
if (!$this->autowireEnabled) {
throw new ServiceNotFoundException($id, $t);
Expand Down

0 comments on commit 2df98a5

Please sign in to comment.