Skip to content

Commit

Permalink
Remove throw in BoundMethod (#34970)
Browse files Browse the repository at this point in the history
  • Loading branch information
driesvints committed Oct 26, 2020
1 parent b1555ed commit 826a90f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 0 additions & 5 deletions src/Illuminate/Container/BoundMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Illuminate\Container;

use Closure;
use Illuminate\Contracts\Container\BindingResolutionException;
use InvalidArgumentException;
use ReflectionFunction;
use ReflectionMethod;
Expand Down Expand Up @@ -174,10 +173,6 @@ protected static function addDependencyForCallParameter($container, $parameter,
}
} elseif ($parameter->isDefaultValueAvailable()) {
$dependencies[] = $parameter->getDefaultValue();
} elseif (! $parameter->isOptional() && ! array_key_exists($paramName, $parameters)) {
$message = "Unable to resolve dependency [{$parameter}] in class {$parameter->getDeclaringClass()->getName()}";

throw new BindingResolutionException($message);
}
}

Expand Down
7 changes: 7 additions & 0 deletions tests/Container/ContainerCallTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,13 @@ public function testCallWithBoundMethod()
$this->assertSame('taylor', $result[1]);
}

public function testCallWithUnnamedParameters()
{
$container = new Container;
$result = $container->call([new ContainerTestCallStub, 'unresolvable'], ['foo', 'bar']);
$this->assertEquals(['foo', 'bar'], $result);
}

public function testBindMethodAcceptsAnArray()
{
$container = new Container;
Expand Down

0 comments on commit 826a90f

Please sign in to comment.