Skip to content

Commit

Permalink
#96 amended code samples to now work. The samples still make sense in…
Browse files Browse the repository at this point in the history
… context.
  • Loading branch information
TRPB authored Feb 22, 2017
1 parent df90606 commit 3b621d2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,19 +153,19 @@ This behaviour has changed as it makes it impossible to provide a closure as a c
To overcome this, Dice will now only call a closures if they're wrapped in \Dice\Instance:

```php
$rule->substitutions['A'] = new \Dice\Instance(function() {
$rule->substitutions['A'] = ['instance' => function() {
return new A;
});
}];

$rule->call[] = ['someMethod', new \Dice\Instance(function() {
$rule->call[] = ['someMethod', ['instance' => function() {
// '2' will be provided as the first argument when someMethod is called
return 2;
}]);
}]]);

$rule->constructParams[] = new \Dice\Instance(function() {
$rule->constructParams[] = ['instance' => function() { {
//'abc' will be providedas the first constructor parameter
return 'abc';
});
}]);
```


Expand Down

0 comments on commit 3b621d2

Please sign in to comment.