Skip to content

Commit 8383856

Browse files
committed
Don't use empty() to check for empty documents
empty() is inconsistent for checking if the document is empty (i.e. empty([]) != empty(new stdClass)). Simply check that the option has been set in order to include it in the command.
1 parent 28e0574 commit 8383856

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Operation/CreateCollection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,11 @@ private function createCommand()
126126
}
127127
}
128128

129-
if ( ! empty($this->options['indexOptionDefaults'])) {
129+
if (isset($this->options['indexOptionDefaults'])) {
130130
$cmd['indexOptionDefaults'] = (object) $this->options['indexOptionDefaults'];
131131
}
132132

133-
if ( ! empty($this->options['storageEngine'])) {
133+
if (isset($this->options['storageEngine'])) {
134134
$cmd['storageEngine'] = (object) $this->options['storageEngine'];
135135
}
136136

0 commit comments

Comments
 (0)