We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I created a named instance like so:
$rules = [ '$logger2' => [ Dice::INSTANCE => function () use ($config) { //do stuff; return $thing; } ] ]; $dice = $dice->addRules($rules);
And I tried to get it like so:
$logger2 = $dice->create('$logger2');
But it did not work because create() only expects class names. It throws:
create()
PHP Fatal error: Uncaught ReflectionException: Class $logger2 does not exist in //vendor/level-2/dice/Dice.php:107
I understand I can make it a dependency of a class and then create the class, but what if I just want to access it as is?
The text was updated successfully, but these errors were encountered:
This should work, you could try my fork:
https://packagist.org/packages/moddengine/dice
Example here: https://github.com/moddengine/Dice/blob/9b54e766b0275305ff5d303cebce2d5a24131398/tests/NamedInstancesTest.php#L61
Sorry, something went wrong.
No branches or pull requests
I created a named instance like so:
And I tried to get it like so:
$logger2 = $dice->create('$logger2');
But it did not work because
create()
only expects class names. It throws:I understand I can make it a dependency of a class and then create the class, but what if I just want to access it as is?
The text was updated successfully, but these errors were encountered: