Skip to content

Commit ba3ae9f

Browse files
committed
Fix RiskyTruthyFalsyComparison
1 parent f872a96 commit ba3ae9f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Csv.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,11 @@ protected function open(): void
182182
throw new \Exception(sprintf('Error during the opening of the %s file', $this->filename));
183183
}
184184
if ($this->addUtf8Bom) {
185-
if (!fwrite($this->handle, \chr(0xEF).\chr(0xBB).\chr(0xBF))) {
185+
if (false === fwrite($this->handle, \chr(0xEF).\chr(0xBB).\chr(0xBF))) {
186186
throw new \Exception(sprintf('Error during the UTF8-BOM writing in %s file', $this->filename));
187187
}
188188
}
189-
if (!empty($this->header)) {
189+
if (null !== $this->header && \count($this->header) > 0) {
190190
$this->write($this->header);
191191
$this->lines = 0;
192192
--$this->totalLines;
@@ -237,7 +237,7 @@ public function write($data): void
237237
}
238238

239239
// New file
240-
if ($this->maxLines && $this->maxLines == $this->lines) {
240+
if (null !== $this->maxLines && $this->maxLines == $this->lines) {
241241
$this->newFile();
242242
}
243243

0 commit comments

Comments
 (0)