-
-
Notifications
You must be signed in to change notification settings - Fork 338
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reduce Deprecation Warning in PHP8.4
- Loading branch information
Showing
8 changed files
with
21 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,8 +31,8 @@ protected function setUp(): void | |
protected function tearDown(): void | ||
{ | ||
$csv = new SplFileObject(__DIR__.'/../test_files/foo.csv', 'w'); | ||
$csv->setCsvControl(); | ||
$csv->fputcsv(['john', 'doe', '[email protected]'], ',', '"'); | ||
$csv->setCsvControl(escape: '\\'); | ||
$csv->fputcsv(fields: ['john', 'doe', '[email protected]']); | ||
unset($this->csv); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,6 +38,7 @@ final class ReaderTest extends TabularDataReaderTestCase | |
protected function setUp(): void | ||
{ | ||
$tmp = new SplTempFileObject(); | ||
$tmp->setCsvControl(escape: '\\'); | ||
foreach ($this->expected as $row) { | ||
$tmp->fputcsv($row); | ||
} | ||
|
@@ -156,6 +157,7 @@ public function testCall(): void | |
]; | ||
|
||
$file = new SplTempFileObject(); | ||
$file->setCsvControl(escape: '\\'); | ||
foreach ($raw as $row) { | ||
$file->fputcsv($row); | ||
} | ||
|
@@ -213,7 +215,7 @@ public function testStripBOM(array $record, string $expected_bom, string $expect | |
{ | ||
/** @var resource $fp */ | ||
$fp = fopen('php://temp', 'r+'); | ||
fputcsv($fp, $record); | ||
fputcsv($fp, $record, escape: ''); | ||
$csv = Reader::createFromStream($fp); | ||
self::assertSame($expected_bom, $csv->getInputBOM()); | ||
foreach ($csv as $row) { | ||
|
@@ -274,7 +276,7 @@ public function testDisablingBOMStripping(): void | |
$expected_record = [Bom::Utf16Le->value.'john', 'doe', '[email protected]']; | ||
/** @var resource $fp */ | ||
$fp = fopen('php://temp', 'r+'); | ||
fputcsv($fp, $expected_record); | ||
fputcsv($fp, $expected_record, escape: ''); | ||
$csv = Reader::createFromStream($fp); | ||
$csv->includeInputBOM(); | ||
self::assertSame(Bom::Utf16Le->value, $csv->getInputBOM()); | ||
|
@@ -333,7 +335,7 @@ public function testGetHeaderThrowsExceptionWithStreamObject(): void | |
/** @var resource $tmp */ | ||
$tmp = fopen('php://temp', 'r+'); | ||
foreach ($this->expected as $row) { | ||
fputcsv($tmp, $row); | ||
fputcsv($tmp, $row, escape: ''); | ||
} | ||
|
||
$csv = Reader::createFromStream($tmp); | ||
|
@@ -363,6 +365,7 @@ public function testJsonSerialize(): void | |
]; | ||
|
||
$tmp = new SplTempFileObject(); | ||
$tmp->setCsvControl(escape: '\\'); | ||
foreach ($expected as $row) { | ||
$tmp->fputcsv($row); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,8 +38,8 @@ protected function setUp(): void | |
protected function tearDown(): void | ||
{ | ||
$csv = new SplFileObject(__DIR__.'/../test_files/foo.csv', 'w'); | ||
$csv->setCsvControl(); | ||
$csv->fputcsv(['john', 'doe', '[email protected]'], ',', '"'); | ||
$csv->setCsvControl(escape: ''); | ||
$csv->fputcsv(['john', 'doe', '[email protected]']); | ||
unset($this->csv); | ||
} | ||
|
||
|