Skip to content

Commit 4083cd8

Browse files
committed
adding special case for KVTxnOp
1 parent 05ae873 commit 4083cd8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Hydratable.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
*/
2020

2121
use DCarbone\PHPConsulAPI\KV\KVPair;
22+
use DCarbone\PHPConsulAPI\KV\KVTxnOp;
2223

2324
/**
2425
* Used to assist with hydrating json responses
@@ -147,8 +148,8 @@ private function buildObjectValue(string $field, $value, string $class, bool $nu
147148
return clone $value;
148149
}
149150
// otherwise, attempt to cast whatever was provided as an array and construct a new instance of $class
150-
if (KVPair::class === $class) {
151-
// special case for KVPair
151+
if (KVPair::class === $class || KVTxnOp::class) {
152+
// special case for KVPair and KVTxnOp
152153
// todo: find cleaner way to do this...
153154
return new $class((array)$value, true);
154155
}

0 commit comments

Comments
 (0)