Skip to content

[5.8] Remove the container makeWith method #26550

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions src/Illuminate/Container/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -584,18 +584,6 @@ public function factory($abstract)
};
}

/**
* An alias function name for make().
*
* @param string $abstract
* @param array $parameters
* @return mixed
*/
public function makeWith($abstract, array $parameters = [])
{
return $this->make($abstract, $parameters);
}

/**
* Resolve the given type from the container.
*
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Database/Concerns/BuildsQueries.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public function unless($value, $callback, $default = null)
*/
protected function paginator($items, $total, $perPage, $currentPage, $options)
{
return Container::getInstance()->makeWith(LengthAwarePaginator::class, compact(
return Container::getInstance()->make(LengthAwarePaginator::class, compact(
'items', 'total', 'perPage', 'currentPage', 'options'
));
}
Expand All @@ -154,7 +154,7 @@ protected function paginator($items, $total, $perPage, $currentPage, $options)
*/
protected function simplePaginator($items, $perPage, $currentPage, $options)
{
return Container::getInstance()->makeWith(Paginator::class, compact(
return Container::getInstance()->make(Paginator::class, compact(
'items', 'perPage', 'currentPage', 'options'
));
}
Expand Down
16 changes: 0 additions & 16 deletions tests/Container/ContainerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -951,22 +951,6 @@ public function testResolvingCallbacksShouldBeFiredWhenCalledWithAliases()
$this->assertEquals('taylor', $instance->name);
}

public function testMakeWithMethodIsAnAliasForMakeMethod()
{
$mock = $this->getMockBuilder(Container::class)
->setMethods(['make'])
->getMock();

$mock->expects($this->once())
->method('make')
->with(ContainerDefaultValueStub::class, ['default' => 'laurence'])
->will($this->returnValue(new stdClass));

$result = $mock->makeWith(ContainerDefaultValueStub::class, ['default' => 'laurence']);

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

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