-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
[5.4] Make With with non-associative $params array #18474
Comments
This is intentional, you have to pass the parameter name. |
I would love to be able to understand what was removed and then brought back since this subject seems to be widely discussed around here. |
Given: class SomeClass
{
public function __construct(AnotherResolvableClass $class, $first, $last){}
} You can use the container to create an instance of this class like so: $container->makeWith(SomeClass::class, ['last' => 'lastname', 'first' => 'firstname']); The container resolves the primitive dependencies of the constructor using the parameters passed to This functionality used to be in |
Description:
Since Laravel 5.4.16 the
$container->makeWith()
method allows functionality similar to old$container->make(class, params)
functionality, see #18271 and #18320.So you can do:
But you can't do:
Steps To Reproduce:
I've backported the
ContainerTest::testPassingSomePrimitiveParameters()
of Laravel 5.3 for Laravel 5.4:And it failed at
$value = $container->makeWith(ContainerMixedPrimitiveStub::class, [0 => 'taylor', 2 => 'otwell']);
line :So, is it possible to backport this functionality, please?
The text was updated successfully, but these errors were encountered: