summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--composer.json2
-rw-r--r--src/AbstractCsv.php22
-rw-r--r--src/Iterator/Filter.php16
-rw-r--r--src/Iterator/SortBy.php16
-rw-r--r--src/Reader.php29
-rw-r--r--src/Writer.php10
-rw-r--r--test/CsvTest.php8
-rw-r--r--test/ReaderTest.php16
-rw-r--r--test/WriterTest.php2
9 files changed, 15 insertions, 106 deletions
diff --git a/composer.json b/composer.json
index ba3c52c..b2fd435 100644
--- a/composer.json
+++ b/composer.json
@@ -36,7 +36,7 @@
},
"extra": {
"branch-alias": {
- "dev-master": "5.5-dev"
+ "dev-dev": "6.0-dev"
}
}
}
diff --git a/src/AbstractCsv.php b/src/AbstractCsv.php
index 3a31b09..bacaa67 100644
--- a/src/AbstractCsv.php
+++ b/src/AbstractCsv.php
@@ -369,7 +369,7 @@ abstract class AbstractCsv implements JsonSerializable, IteratorAggregate
public function getIterator()
{
$obj = $this->path;
- if (! $obj instanceof SplFileObject) {
+ if (! $obj instanceof SplTempFileObject) {
$obj = new SplFileObject($this->getStreamFilterPath(), $this->open_mode);
}
$obj->setCsvControl($this->delimiter, $this->enclosure, $this->escape);
@@ -379,26 +379,6 @@ abstract class AbstractCsv implements JsonSerializable, IteratorAggregate
}
/**
- * DEPRECATION WARNING! This method will be removed in the next major point release
- *
- * @deprecated deprecated since version 5.5
- */
- public function setEncoding($str)
- {
- return $this->setEncodingFrom($str);
- }
-
- /**
- * DEPRECATION WARNING! This method will be removed in the next major point release
- *
- * @deprecated deprecated since version 5.5
- */
- public function getEncoding()
- {
- return $this->getEncodingFrom();
- }
-
- /**
* Set the CSV encoding charset
*
* @param string $str
diff --git a/src/Iterator/Filter.php b/src/Iterator/Filter.php
index b04de5e..dc032e7 100644
--- a/src/Iterator/Filter.php
+++ b/src/Iterator/Filter.php
@@ -35,22 +35,6 @@ trait Filter
/**
* Set the Iterator filter method
*
- * DEPRECATION WARNING! This method will be removed in the next major point release
- *
- * @deprecated deprecated since version 5.1
- *
- * @param callable $callable
- *
- * @return self
- */
- public function setFilter(callable $callable)
- {
- return $this->addFilter($callable);
- }
-
- /**
- * Set the Iterator filter method
- *
* @param callable $callable
*
* @return self
diff --git a/src/Iterator/SortBy.php b/src/Iterator/SortBy.php
index 8e4b2e0..b59d92d 100644
--- a/src/Iterator/SortBy.php
+++ b/src/Iterator/SortBy.php
@@ -33,22 +33,6 @@ trait SortBy
protected $iterator_sort_by = [];
/**
- * Set the Iterator SortBy method
- *
- * DEPRECATION WARNING! This method will be removed in the next major point release
- *
- * @deprecated deprecated since version 5.2
- *
- * @param callable $callable
- *
- * @return self
- */
- public function setSortBy(callable $callable)
- {
- return $this->addSortBy($callable);
- }
-
- /**
* Set an Iterator sorting callable function
*
* @param callable $callable
diff --git a/src/Reader.php b/src/Reader.php
index 473aa7c..ff90e15 100644
--- a/src/Reader.php
+++ b/src/Reader.php
@@ -187,25 +187,6 @@ class Reader extends AbstractCsv
/**
* Return a single column from the CSV data
*
- * DEPRECATION WARNING! This method will be removed in the next major point release
- *
- * @deprecated deprecated since version 5.4
- *
- * @param integer $column_index field Index
- * @param callable $callable a callable function to be applied to each value to be return
- *
- * @return array
- *
- * @throws \InvalidArgumentException If the column index is not a positive integer or 0
- */
- public function fetchCol($column_index = 0, callable $callable = null)
- {
- return $this->fetchColumn($column_index, $callable);
- }
-
- /**
- * Return a single column from the CSV data
- *
* @param integer $column_index field Index
* @param callable $callable a callable function to be applied to each value to be return
*
@@ -232,14 +213,4 @@ class Reader extends AbstractCsv
return iterator_to_array($iterator, false);
}
-
- /**
- * DEPRECATION WARNING! This method will be removed in the next major point release
- *
- * @deprecated deprecated since version 5.5
- */
- public function getWriter($open_mode = 'r+')
- {
- return $this->newWriter($open_mode);
- }
}
diff --git a/src/Writer.php b/src/Writer.php
index 3349f7c..5f30678 100644
--- a/src/Writer.php
+++ b/src/Writer.php
@@ -313,14 +313,4 @@ class Writer extends AbstractCsv
return $this;
}
-
- /**
- * DEPRECATION WARNING! This method will be removed in the next major point release
- *
- * @deprecated deprecated since version 5.5
- */
- public function getReader($open_mode = 'r+')
- {
- return $this->newReader($open_mode);
- }
}
diff --git a/test/CsvTest.php b/test/CsvTest.php
index 722b330..2898180 100644
--- a/test/CsvTest.php
+++ b/test/CsvTest.php
@@ -164,10 +164,10 @@ class CsvTest extends PHPUnit_Framework_TestCase
public function testEncoding()
{
$expected = 'iso-8859-15';
- $this->csv->setEncoding($expected);
- $this->assertSame(strtoupper($expected), $this->csv->getEncoding());
+ $this->csv->setEncodingFrom($expected);
+ $this->assertSame(strtoupper($expected), $this->csv->getEncodingFrom());
- $this->csv->setEncoding('');
+ $this->csv->setEncodingFrom('');
}
public function testToString()
@@ -248,7 +248,7 @@ EOF;
{
$this->assertSame(json_encode($this->expected), json_encode($this->csv));
$csv = Reader::createFromString($rawCsv);
- $csv->setEncoding('iso-8859-15');
+ $csv->setEncodingFrom('iso-8859-15');
json_encode($csv);
$this->assertEquals(JSON_ERROR_NONE, json_last_error());
}
diff --git a/test/ReaderTest.php b/test/ReaderTest.php
index 8e81225..54deea4 100644
--- a/test/ReaderTest.php
+++ b/test/ReaderTest.php
@@ -68,7 +68,7 @@ class ReaderTest extends PHPUnit_Framework_TestCase
$func = function ($row) {
return ! in_array('jane', $row);
};
- $this->csv->setFilter($func);
+ $this->csv->addFilter($func);
$this->assertCount(1, $this->csv->fetchAll());
@@ -94,7 +94,7 @@ class ReaderTest extends PHPUnit_Framework_TestCase
$func = function ($rowA, $rowB) {
return strcmp($rowA[0], $rowB[0]);
};
- $this->csv->setSortBy($func);
+ $this->csv->addSortBy($func);
$this->assertSame(array_reverse($this->expected), $this->csv->fetchAll());
$this->csv->addSortBy($func);
@@ -111,7 +111,7 @@ class ReaderTest extends PHPUnit_Framework_TestCase
$func = function ($rowA, $rowB) {
return strcmp($rowA[0], $rowB[0]);
};
- $csv->setSortBy($func);
+ $csv->addSortBy($func);
$this->assertSame([
['john', 'doe', 'john.doe@example.com'],
['john', 'doe', 'john.doe@example.com']
@@ -178,7 +178,7 @@ class ReaderTest extends PHPUnit_Framework_TestCase
public function testFetchCol()
{
- $this->assertSame(['john', 'jane'], $this->csv->fetchCol(0));
+ $this->assertSame(['john', 'jane'], $this->csv->fetchColumn(0));
$this->assertSame(['john', 'jane'], $this->csv->fetchColumn());
}
@@ -206,7 +206,7 @@ class ReaderTest extends PHPUnit_Framework_TestCase
return array_map('strtoupper', $value);
};
- $this->assertSame(['JOHN', 'JANE'], $this->csv->fetchCol(0, $func));
+ $this->assertSame(['JOHN', 'JANE'], $this->csv->fetchColumn(0, $func));
}
/**
@@ -214,7 +214,7 @@ class ReaderTest extends PHPUnit_Framework_TestCase
*/
public function testFetchColFailure()
{
- $this->csv->fetchCol('toto');
+ $this->csv->fetchColumn('toto');
}
/**
@@ -250,7 +250,7 @@ class ReaderTest extends PHPUnit_Framework_TestCase
public function testGetWriter()
{
- $writer = $this->csv->getWriter();
+ $writer = $this->csv->newWriter();
$writer->insertOne(['toto', 'le', 'herisson']);
$expected = <<<EOF
<table class="table-csv-data">
@@ -276,7 +276,7 @@ EOF;
public function testGetWriter2()
{
- $csv = (new Reader(__DIR__.'/foo.csv'))->getWriter('a+');
+ $csv = (new Reader(__DIR__.'/foo.csv'))->newWriter('a+');
$this->assertInstanceOf('\League\Csv\Writer', $csv);
}
}
diff --git a/test/WriterTest.php b/test/WriterTest.php
index 95ddd43..86db64a 100644
--- a/test/WriterTest.php
+++ b/test/WriterTest.php
@@ -189,7 +189,7 @@ class WriterTest extends PHPUnit_Framework_TestCase
$this->csv->insertOne($row);
}
- $reader = $this->csv->getReader();
+ $reader = $this->csv->newReader();
$this->assertSame(['john', 'doe', 'john.doe@example.com'], $reader->fetchOne(0));
}
}