diff --git a/src/Illuminate/Container/Container.php b/src/Illuminate/Container/Container.php index 1b2bad943338..4fc82f1c133c 100755 --- a/src/Illuminate/Container/Container.php +++ b/src/Illuminate/Container/Container.php @@ -576,8 +576,10 @@ public function make($abstract) */ protected function resolve($abstract, $parameters = []) { + $abstract = $this->getAlias($abstract); + $needsContextualBuild = ! empty($parameters) || ! is_null( - $this->getContextualConcrete($abstract = $this->getAlias($abstract)) + $this->getContextualConcrete($abstract) ); // If an instance of the type is currently being managed as a singleton we'll diff --git a/tests/Container/ContainerTest.php b/tests/Container/ContainerTest.php index f9f15faa8910..7156080dc24f 100755 --- a/tests/Container/ContainerTest.php +++ b/tests/Container/ContainerTest.php @@ -121,6 +121,16 @@ public function testAliases() $this->assertEquals('bar', $container->make('bat')); } + public function testAliasesWithArrayOfParameters() + { + $container = new Container; + $container->bind('foo', function ($app, $config) { + return $config; + }); + $container->alias('foo', 'baz'); + $this->assertEquals([1, 2, 3], $container->makeWith('baz', [1, 2, 3])); + } + public function testBindingsCanBeOverridden() { $container = new Container;