summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md4
-rw-r--r--src/Config/Output.php10
-rw-r--r--test/ControlsTest.php6
3 files changed, 11 insertions, 9 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 39c38a0..b01742c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,9 +15,11 @@ All Notable changes to `Csv` will be documented in this file
### Fixed
-- `Reader::fetchColumn` and `Reader::fetchAssoc` now returns `Iterator`
+- `Reader::fetchColumn` and `Reader::fetchAssoc` now return `Iterator`
- `Reader::fetchAssoc` callable argument expects an indexed row using the submitted keys as its first argument
- `Reader::fetchColumn` callable argument expects the selected column value as its first argument
+- Default value on `setOutputBOM` is removed
+- `AbstractCsv::getOutputBOM` always return a string
### Removed
diff --git a/src/Config/Output.php b/src/Config/Output.php
index 4117717..baf5aa2 100644
--- a/src/Config/Output.php
+++ b/src/Config/Output.php
@@ -39,13 +39,13 @@ trait Output
* The Input file BOM character
* @var string
*/
- protected $input_bom;
+ protected $input_bom = '';
/**
* The Output file BOM character
* @var string
*/
- protected $output_bom;
+ protected $output_bom = '';
/**
* Sets the CSV encoding charset
@@ -83,10 +83,10 @@ trait Output
*
* @return static
*/
- public function setOutputBOM($str = null)
+ public function setOutputBOM($str)
{
if (empty($str)) {
- $this->output_bom = null;
+ $this->output_bom = '';
return $this;
}
@@ -126,7 +126,7 @@ trait Output
return strpos($line, $sequence) === 0;
});
- $this->input_bom = array_shift($res);
+ $this->input_bom = (string) array_shift($res);
}
return $this->input_bom;
diff --git a/test/ControlsTest.php b/test/ControlsTest.php
index 0e25a60..87854bb 100644
--- a/test/ControlsTest.php
+++ b/test/ControlsTest.php
@@ -48,11 +48,11 @@ class ControlsTest extends AbstractTestCase
public function testBOMSettings()
{
- $this->assertNull($this->csv->getOutputBOM());
+ $this->assertSame('', $this->csv->getOutputBOM());
$this->csv->setOutputBOM(Reader::BOM_UTF8);
$this->assertSame(Reader::BOM_UTF8, $this->csv->getOutputBOM());
- $this->csv->setOutputBOM();
- $this->assertNull($this->csv->getOutputBOM());
+ $this->csv->setOutputBOM('');
+ $this->assertSame('', $this->csv->getOutputBOM());
}
public function testAddBOMSequences()