Skip to content

Commit f1c415b

Browse files
committed
fix projection
1 parent aeca748 commit f1c415b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Diff for: examples/4-projection.phpt

+4-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ $eventsProduced = $book->getRecordedEvents();
2424
// normally loaded from persistent storage
2525
$loadedEvents = $eventsProduced;
2626

27-
$lentTo = false;
27+
/** @var null|\Library\UserId $lentTo */
28+
$lentTo = null;
2829

2930
foreach($loadedEvents as $event) {
3031

@@ -48,7 +49,8 @@ foreach($loadedEvents as $event) {
4849

4950
function whoHasTheBook(\Library\BookId $id): ?\Library\UserId {
5051
$data = \file_get_contents(__DIR__ . '/data/'. $id);
51-
if ($data === false) {
52+
\assert($data !== false);
53+
if ($data === '') {
5254
return null;
5355
}
5456
return \Library\UserId::reconstitute($data);

0 commit comments

Comments
 (0)