Skip to content

Commit a82efd7

Browse files
authored
Merge pull request #5 from mcg-web/fix_doc
Fix some syntax errors in documentation.
2 parents 0c84e81 + c330ba7 commit a82efd7

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ and then call your batch function with all requested keys.
4545
```php
4646
$userLoader->load(1)
4747
->then(function ($user) use ($userLoader) { $userLoader->load($user->invitedByID); })
48-
->then(function ($invitedBy) { echo "User 1 was invited by $invitedBy"; }));
48+
->then(function ($invitedBy) { echo "User 1 was invited by $invitedBy"; });
4949

5050
// Elsewhere in your application
5151
$userLoader->load(2)
5252
->then(function ($user) use ($userLoader) { $userLoader->load($user->invitedByID); })
53-
->then(function ($invitedBy) { echo "User 2 was invited by $invitedBy"; }));
53+
->then(function ($invitedBy) { echo "User 2 was invited by $invitedBy"; });
5454

5555
// Synchronously waits on the promise to complete, if not using EventLoop.
56-
$userLoader->await();
56+
$userLoader->await(); // or `DataLoader::await()`
5757
```
5858
A naive application may have issued four round-trips to a backend for the
5959
required information, but with DataLoaderPHP this application will make at most
@@ -139,7 +139,7 @@ Create a new `DataLoaderPHP` given a batch loading instance and options.
139139
creating a new Promise and new key in the `batchLoadFn` for every load.
140140

141141
- *cacheKeyFn*: A function to produce a cache key for a given load key.
142-
Defaults to `key => key`. Useful to provide when JavaScript objects are keys
142+
Defaults to `key`. Useful to provide when an objects are keys
143143
and two similarly shaped objects should be considered equivalent.
144144

145145
- *cacheMap*: An instance of `CacheMap` to be
@@ -156,7 +156,7 @@ Loads a key, returning a `Promise` for the value represented by that key.
156156
Loads multiple keys, promising an array of values:
157157

158158
```php
159-
list($a, $b) = DataLoader::await($myLoader->loadMany(['a', 'b']);
159+
list($a, $b) = DataLoader::await($myLoader->loadMany(['a', 'b']));
160160
```
161161

162162
This is equivalent to the more verbose:
@@ -165,7 +165,7 @@ This is equivalent to the more verbose:
165165
list($a, $b) = DataLoader::await(\React\Promise\all([
166166
$myLoader->load('a'),
167167
$myLoader->load('b')
168-
]);
168+
]));
169169
```
170170

171171
- *$keys*: An array of key values to load.
@@ -187,7 +187,7 @@ method chaining.
187187

188188
Primes the cache with the provided key and value. If the key already exists, no
189189
change is made. (To forcefully prime the cache, clear the key first with
190-
`$loader->clear($key)->prime($key, $value)`.) Returns itself for method chaining.
190+
`$loader->clear($key)->prime($key, $value)`. Returns itself for method chaining.
191191

192192
##### `static await([$promise][, $unwrap])`
193193

0 commit comments

Comments
 (0)