Skip to content

Commit b43a021

Browse files
committed
Revert "fix skipped data persisters on persist"
1 parent 815a504 commit b43a021

File tree

2 files changed

+2
-12
lines changed

2 files changed

+2
-12
lines changed

src/DataPersister/ChainDataPersister.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,9 @@ public function persist($data)
5151
{
5252
foreach ($this->persisters as $persister) {
5353
if ($persister->supports($data)) {
54-
$data = $persister->persist($data) ?? $data;
54+
return $persister->persist($data) ?? $data;
5555
}
5656
}
57-
58-
return $data;
5957
}
6058

6159
/**

tests/DataPersister/ChainDataPersisterTest.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,7 @@ public function testPersist()
6060
$barPersisterProphecy->supports($dummy)->willReturn(true)->shouldBeCalled();
6161
$barPersisterProphecy->persist($dummy)->shouldBeCalled();
6262

63-
$bazPersisterProphecy = $this->prophesize(DataPersisterInterface::class);
64-
$bazPersisterProphecy->supports($dummy)->willReturn(true)->shouldBeCalled();
65-
$bazPersisterProphecy->persist($dummy)->shouldBeCalled();
66-
67-
(new ChainDataPersister([
68-
$fooPersisterProphecy->reveal(),
69-
$barPersisterProphecy->reveal(),
70-
$bazPersisterProphecy->reveal(),
71-
]))->persist($dummy);
63+
(new ChainDataPersister([$fooPersisterProphecy->reveal(), $barPersisterProphecy->reveal()]))->persist($dummy);
7264
}
7365

7466
public function testRemove()

0 commit comments

Comments
 (0)