Skip to content

Commit

Permalink
Fix #213: Document alternative metadata syntax (#280)
Browse files Browse the repository at this point in the history
  • Loading branch information
samdark committed Nov 29, 2021
1 parent 9e2785f commit 66dbc6c
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Expand Up @@ -385,6 +385,25 @@ StateResetter::class => function () {
}
```

## Specifying metadata for non-array definitions

In order to specify some metadata, such as in cases of "resetting services state" or "container tags" above, for non-array
definitions, the following syntax could be used:

```php
LogTarget::class => [
'definition' => static function (LoggerInterface $logger) use ($params) {
$target = ...
return $target;
},
'reset' => function () use ($params) {
...
},
],
```

In the above we have explicitly moved definition itself to "definition" key.

## Delegates

Container delegates define. Each delegate is a callable returning a container instance that is used in case a service
Expand Down

0 comments on commit 66dbc6c

Please sign in to comment.