diff --git a/CHANGELOG.md b/CHANGELOG.md index 0bf4f1d5..936c7cf3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,11 +6,11 @@ All Notable changes to `Csv` will be documented in this file ### Added -- None +- `Writer::necessaryEnclosure` ### Deprecated -- None +- `Writer::relaxEnclosure` use `Writer::necessaryEnclosure` ### Fixed diff --git a/docs/9.0/writer/index.md b/docs/9.0/writer/index.md index 076052a7..1f422a6f 100644 --- a/docs/9.0/writer/index.md +++ b/docs/9.0/writer/index.md @@ -134,7 +134,7 @@ By default, `getFlushTreshold` returns `null`. ```php public Writer::forceEnclosure(): self -public Writer::relaxEnclosure(): self +public Writer::necessaryEnclosure(): self public Writer::noEnclosure(): self public Writer::encloseAll(): bool public Writer::encloseNecessary(): bool @@ -149,6 +149,7 @@ With this feature, you can:
+ ```php enclose_all = self::ENCLOSE_NECESSARY; $this->resetProperties(); @@ -338,4 +338,19 @@ public function setNewline(string $newline): self { return $this->setEndOfLine($newline); } + + /** + * DEPRECATION WARNING! This method will be removed in the next major point release. + * + * @see Writer::necessaryEnclosure() + * @deprecated Since version 9.22.0 + * @codeCoverageIgnore + * + * Sets the enclosure threshold to only enclose necessary fields. + */ + #[Deprecated(message:'use League\Csv\Writer::necessaryEnclosure()', since:'league/csv:9.22.0')] + public function relaxEnclosure(): self + { + return $this->necessaryEnclosure(); + } } diff --git a/src/WriterTest.php b/src/WriterTest.php index d7352d44..5403c72b 100644 --- a/src/WriterTest.php +++ b/src/WriterTest.php @@ -191,7 +191,7 @@ public function testForceEnclosure(): void self::assertStringContainsString('"value 2-0","value 2-1"'."\n", $csv); self::assertStringContainsString('"to""to","foo\"bar"'."\n", $csv); - $writer->relaxEnclosure(); + $writer->necessaryEnclosure(); self::assertFalse($writer->encloseAll()); }