diff --git a/examples/merge.php b/examples/merge.php index a917b07b..9a149b99 100755 --- a/examples/merge.php +++ b/examples/merge.php @@ -3,8 +3,8 @@ error_reporting(-1); ini_set('display_errors', '1'); -use League\Csv\Writer; use League\Csv\Reader; +use League\Csv\Writer; require '../vendor/autoload.php'; diff --git a/examples/stream.php b/examples/stream.php index 9dd9d47b..1372ea52 100755 --- a/examples/stream.php +++ b/examples/stream.php @@ -132,7 +132,7 @@ } $writer->insertAll([ 'je,suis,toto,le,héros', - 'je,suis,toto,le,héros' + 'je,suis,toto,le,héros', ]); echo $writer->newReader()->toHTML(), PHP_EOL; diff --git a/examples/switchmode.php b/examples/switchmode.php index 3a3223b0..c4d27f34 100755 --- a/examples/switchmode.php +++ b/examples/switchmode.php @@ -44,7 +44,7 @@ $writer->insertOne('Ben;7;M;2004'); $writer->insertAll([ 'Benjamin;118;M;2004', - ['Benoit', '6', 'M', '2004'] + ['Benoit', '6', 'M', '2004'], ]); //we create a Reader object from the Writer object diff --git a/examples/writing.php b/examples/writing.php index 185cfeb3..53b6ec7c 100755 --- a/examples/writing.php +++ b/examples/writing.php @@ -7,7 +7,7 @@ require '../vendor/autoload.php'; -$writer = Writer::createFromFileObject(new SplTempFileObject); //the CSV file will be created into a temporary File +$writer = Writer::createFromFileObject(new SplTempFileObject()); //the CSV file will be created into a temporary File $writer->setDelimiter("\t"); //the delimiter will be the tab character $writer->setEncodingFrom("utf-8"); diff --git a/phpunit.xml b/phpunit.xml index 25285b71..47835d8a 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -10,7 +10,7 @@ convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false"> - + test @@ -30,5 +30,5 @@ - + diff --git a/scrutinizer.yml b/scrutinizer.yml index 1c6931ef..51a0ed10 100644 --- a/scrutinizer.yml +++ b/scrutinizer.yml @@ -31,4 +31,4 @@ tools: excluded_dirs: [vendor, test, examples] php_cpd: enabled: true - excluded_dirs: [vendor, test, examples] \ No newline at end of file + excluded_dirs: [vendor, test, examples] diff --git a/src/AbstractCsv.php b/src/AbstractCsv.php index d660fb32..23acbbc5 100644 --- a/src/AbstractCsv.php +++ b/src/AbstractCsv.php @@ -200,7 +200,7 @@ public static function createFromString($str) 'the submitted data must be a string or an object implementing the `__toString` method' ); } - $obj = new SplTempFileObject; + $obj = new SplTempFileObject(); $obj->fwrite((string) $str.PHP_EOL); return static::createFromFileObject($obj); diff --git a/test/CsvTest.php b/test/CsvTest.php index 49342118..f7e65ed4 100644 --- a/test/CsvTest.php +++ b/test/CsvTest.php @@ -26,7 +26,7 @@ class CsvTest extends PHPUnit_Framework_TestCase public function setUp() { - $csv = new SplTempFileObject; + $csv = new SplTempFileObject(); foreach ($this->expected as $row) { $csv->fputcsv($row); } @@ -77,7 +77,7 @@ public function testCreateFromPathWithPHPWrapper() */ public function testCreateFromPathWithSplTempFileObject() { - Reader::createFromPath(new SplTempFileObject); + Reader::createFromPath(new SplTempFileObject()); } public function testCreateFromString() @@ -116,7 +116,7 @@ public function testDetectDelimiterListWithInvalidRowLimit() public function testDetectDelimiterListWithNoCSV() { - $file = new SplTempFileObject; + $file = new SplTempFileObject(); $file->fwrite("How are you today ?\nI'm doing fine thanks!"); $csv = Writer::createFromFileObject($file); $this->assertSame([], $csv->detectDelimiterList(5, ['toto', '|'])); @@ -124,7 +124,7 @@ public function testDetectDelimiterListWithNoCSV() public function testDetectDelimiterListWithInconsistentCSV() { - $data = new SplTempFileObject; + $data = new SplTempFileObject(); $data->setCsvControl(';'); $data->fputcsv(['toto', 'tata', 'tutu']); $data->setCsvControl('|'); @@ -166,7 +166,7 @@ public function testEnclosure() */ public function testCreateFromStringFromNotStringableObject() { - Reader::createFromString(new DateTime); + Reader::createFromString(new DateTime()); } /** @@ -313,7 +313,7 @@ public function testappendStreamFilter() */ public function testFailedprependStreamFilter() { - $csv = new Reader(new SplTempFileObject); + $csv = new Reader(new SplTempFileObject()); $this->assertFalse($csv->isActiveStreamFilter()); $csv->prependStreamFilter('string.toupper'); } @@ -324,7 +324,7 @@ public function testFailedprependStreamFilter() */ public function testFailedapppendStreamFilter() { - $csv = new Writer(new SplTempFileObject); + $csv = new Writer(new SplTempFileObject()); $this->assertFalse($csv->isActiveStreamFilter()); $csv->appendStreamFilter('string.toupper'); } diff --git a/test/ReaderTest.php b/test/ReaderTest.php index f18324cc..36d4dc1c 100644 --- a/test/ReaderTest.php +++ b/test/ReaderTest.php @@ -21,7 +21,7 @@ class ReaderTest extends PHPUnit_Framework_TestCase public function setUp() { - $csv = new SplTempFileObject; + $csv = new SplTempFileObject(); foreach ($this->expected as $row) { $csv->fputcsv($row); } @@ -117,7 +117,7 @@ public function testSortBy2() $csv->addSortBy($func); $this->assertSame([ ['john', 'doe', 'john.doe@example.com'], - ['john', 'doe', 'john.doe@example.com'] + ['john', 'doe', 'john.doe@example.com'], ], $csv->fetchAll()); } @@ -190,10 +190,10 @@ public function testFetchColEmptyCol() { $raw = [ ['john', 'doe'], - ['lara', 'croft', 'lara.croft@example.com'] + ['lara', 'croft', 'lara.croft@example.com'], ]; - $file = new SplTempFileObject; + $file = new SplTempFileObject(); foreach ($raw as $row) { $file->fputcsv($row); } diff --git a/test/WriterTest.php b/test/WriterTest.php index aedee304..a238f1a7 100644 --- a/test/WriterTest.php +++ b/test/WriterTest.php @@ -17,12 +17,11 @@ */ class WriterTest extends PHPUnit_Framework_TestCase { - private $csv; public function setUp() { - $this->csv = Writer::createFromFileObject(new SplTempFileObject); + $this->csv = Writer::createFromFileObject(new SplTempFileObject()); } public function tearDown() @@ -165,7 +164,7 @@ public function testAutoDetectColumnsCount() */ public function testFailedInsertWithWrongData() { - $this->csv->insertOne(new DateTime); + $this->csv->insertOne(new DateTime()); } /** @@ -174,7 +173,7 @@ public function testFailedInsertWithWrongData() */ public function testFailedInsertWithMultiDimensionArray() { - $this->csv->insertOne(['john', new DateTime]); + $this->csv->insertOne(['john', new DateTime()]); } public function testSave() @@ -201,7 +200,7 @@ public function testSave() */ public function testFailedSaveWithWrongType() { - $this->csv->insertAll(new DateTime); + $this->csv->insertAll(new DateTime()); } public function testGetReader()