Skip to content
Permalink
Browse files

[Inject] Add docs for @nAmed.

  • Loading branch information...
piotrooo committed Jul 24, 2019
1 parent 5fb4f45 commit c932c1bbe4c28d11518bf5c0f1c1dbf541ffef35
Showing with 22 additions and 0 deletions.
  1. +22 −0 src/Ouzo/Inject/README.md
@@ -76,6 +76,28 @@ class MyClass
}
```

For named binding in constructor use:

```php
class MyClass
{
private $otherClass;
private $andAnotherClass;
/**
* @Inject
* @Named("oterClass=some_name,andAnotherClass=new_named")
*/
public function __construct(OtherClass $otherClass, AndAnotherClass $andAnotherClass)
{
$this->otherClass = $otherClass;
$this->andAnotherClass = $andAnotherClass;
}
}
```

You can named any constructor argument using parameter name.

Constructor injection (requires arguments types):

```php

0 comments on commit c932c1b

Please sign in to comment.
You can’t perform that action at this time.