Skip to content

Commit 5df9a6c

Browse files
authored
set opposite expiry option to null when setting expiry (#93)
1 parent 3f7b7ae commit 5df9a6c

File tree

4 files changed

+8
-0
lines changed

4 files changed

+8
-0
lines changed

Couchbase/InsertOptions.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,10 @@ public function timeout(int $milliseconds): InsertOptions
7777
public function expiry($seconds): InsertOptions
7878
{
7979
if ($seconds instanceof DateTimeInterface) {
80+
$this->expirySeconds = null;
8081
$this->expiryTimestamp = $seconds->getTimestamp();
8182
} else {
83+
$this->expiryTimestamp = null;
8284
$this->expirySeconds = (int)$seconds;
8385
}
8486
return $this;

Couchbase/MutateInOptions.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,10 @@ public function cas(string $cas): MutateInOptions
9595
public function expiry($seconds): MutateInOptions
9696
{
9797
if ($seconds instanceof DateTimeInterface) {
98+
$this->expirySeconds = null;
9899
$this->expiryTimestamp = $seconds->getTimestamp();
99100
} else {
101+
$this->expiryTimestamp = null;
100102
$this->expirySeconds = (int)$seconds;
101103
}
102104
return $this;

Couchbase/ReplaceOptions.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,10 @@ public function timeout(int $milliseconds): ReplaceOptions
7878
public function expiry($seconds): ReplaceOptions
7979
{
8080
if ($seconds instanceof DateTimeInterface) {
81+
$this->expirySeconds = null;
8182
$this->expiryTimestamp = $seconds->getTimestamp();
8283
} else {
84+
$this->expiryTimestamp = null;
8385
$this->expirySeconds = (int)$seconds;
8486
}
8587
return $this;

Couchbase/UpsertOptions.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,10 @@ public function timeout(int $milliseconds): UpsertOptions
7777
public function expiry($seconds): UpsertOptions
7878
{
7979
if ($seconds instanceof DateTimeInterface) {
80+
$this->expirySeconds = null;
8081
$this->expiryTimestamp = $seconds->getTimestamp();
8182
} else {
83+
$this->expiryTimestamp = null;
8284
$this->expirySeconds = (int)$seconds;
8385
}
8486
return $this;

0 commit comments

Comments
 (0)