Skip to content

Commit

Permalink
reverting
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Dec 18, 2018
1 parent d329797 commit fefaf46
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 97 deletions.
4 changes: 1 addition & 3 deletions src/Illuminate/Container/BoundMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ protected static function getMethodDependencies($container, $callback, array $pa
static::addDependencyForCallParameter($container, $parameter, $parameters, $dependencies);
}

return $parameters + $dependencies;
return array_merge($dependencies, $parameters);
}

/**
Expand Down Expand Up @@ -162,8 +162,6 @@ protected static function addDependencyForCallParameter($container, $parameter,
$dependencies[] = $container->make($parameter->getClass()->name);
} elseif ($parameter->isDefaultValueAvailable()) {
$dependencies[] = $parameter->getDefaultValue();
} else {
$dependencies[] = null;
}
}

Expand Down
94 changes: 0 additions & 94 deletions tests/Container/ContainerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -516,77 +516,6 @@ public function testCallWithDependencies()
$this->assertEquals('taylor', $result[1]);
}

public function testWithDefaultParametersIndexedArraySyntax()
{
$container = new Container;
$result = $container->call(ContainerTestDefaultyParams::class.'@defaulty', ['foo', 'bar']);

$this->assertEquals(['foo', 'bar', 'default c'], $result);

$container = new Container;
$result = $container->call(ContainerTestDefaultyParams::class.'@defaulty', ['foo', 'bar', 'baz']);

$this->assertEquals(['foo', 'bar', 'baz'], $result);

$container = new Container;
$result = $container->call(ContainerTestDefaultyParams::class.'@defaulty');

$this->assertEquals(['default a', 'default b', 'default c'], $result);

$container = new Container;
$result = $container->call(ContainerTestDefaultyParams::class.'@defaultyBandC', ['foo', 'bar']);

$this->assertEquals(['foo', 'bar', 'default c'], $result);

$container = new Container;
$result = $container->call(ContainerTestDefaultyParams::class.'@defaultyBandC', ['foo']);

$this->assertEquals(['foo', 'default b', 'default c'], $result);

$container = new Container;
$result = $container->call(ContainerTestDefaultyParams::class.'@defaultyOnlyC', ['foo', 'bar']);

$this->assertEquals(['foo', 'bar', 'default c'], $result);

$container = new Container;
$result = $container->call(ContainerTestDefaultyParams::class.'@noDefault', ['foo', 'bar', 'baz']);

$this->assertEquals(['foo', 'bar', 'baz'], $result);
}

public function testWithDefaultParametersAssociativeSyntax()
{
$container = new Container;
$result = $container->call(ContainerTestDefaultyParams::class.'@defaulty', ['a' => 'foo', 'b' => 'bar']);

$this->assertEquals(['foo', 'bar', 'default c'], $result);

$container = new Container;
$result = $container->call(ContainerTestDefaultyParams::class.'@defaulty', ['a' => 'foo', 'b' => 'bar', 'c' => 'baz']);

$this->assertEquals(['foo', 'bar', 'baz'], $result);

$container = new Container;
$result = $container->call(ContainerTestDefaultyParams::class.'@defaultyBandC', ['a' => 'foo', 'b' => 'bar']);

$this->assertEquals(['foo', 'bar', 'default c'], $result);

$container = new Container;
$result = $container->call(ContainerTestDefaultyParams::class.'@defaultyBandC', ['a' => 'foo']);

$this->assertEquals(['foo', 'default b', 'default c'], $result);

$container = new Container;
$result = $container->call(ContainerTestDefaultyParams::class.'@defaultyOnlyC', ['a' => 'foo', 'b' => 'bar']);

$this->assertEquals(['foo', 'bar', 'default c'], $result);

$container = new Container;
$result = $container->call(ContainerTestDefaultyParams::class.'@noDefault', ['a' => 'foo', 'b' => 'bar', 'c' => 'baz']);

$this->assertEquals(['foo', 'bar', 'baz'], $result);
}

/**
* @expectedException \ReflectionException
* @expectedExceptionMessage Function ContainerTestCallStub() does not exist
Expand Down Expand Up @@ -1342,26 +1271,3 @@ public function __construct()
static::$instantiations++;
}
}

class ContainerTestDefaultyParams
{
public function defaulty($a = 'default a', $b = 'default b', $c = 'default c')
{
return func_get_args();
}

public function defaultyBandC($a, $b = 'default b', $c = 'default c')
{
return func_get_args();
}

public function defaultyOnlyC($a, $b, $c = 'default c')
{
return func_get_args();
}

public function noDefault($a, $b, $c)
{
return func_get_args();
}
}

0 comments on commit fefaf46

Please sign in to comment.