Skip to content

Commit

Permalink
Improve PSR-11 implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
deleugpn committed Oct 2, 2018
1 parent f4551ca commit 9da48a0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 1 addition & 5 deletions src/Illuminate/Container/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -606,11 +606,7 @@ public function make($abstract, array $parameters = [])
*/
public function get($id)
{
if ($this->has($id)) {
return $this->resolve($id);
}

throw new EntryNotFoundException;
return $this->resolve($id);
}

/**
Expand Down
10 changes: 9 additions & 1 deletion tests/Container/ContainerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1041,13 +1041,21 @@ public function testContainerCanDynamicallySetService()
}

/**
* @expectedException \Illuminate\Container\EntryNotFoundException
* @expectedException \Psr\Container\ContainerExceptionInterface
*/
public function testUnknownEntryThrowsException()
{
$container = new Container;
$container->get('Taylor');
}

public function testContainerCanResolveClasses()
{
$container = new Container;
$class = $container->get(ContainerConcreteStub::class);

$this->assertInstanceOf(ContainerConcreteStub::class, $class);
}
}

class ContainerConcreteStub
Expand Down

0 comments on commit 9da48a0

Please sign in to comment.