summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/AbstractCsv.php4
-rw-r--r--src/Config/Output.php2
-rw-r--r--src/Plugin/ColumnConsistencyValidator.php4
-rw-r--r--src/Plugin/ForbiddenNullValuesValidator.php2
-rw-r--r--src/Plugin/SkipNullValuesFormatter.php2
-rw-r--r--src/Reader.php10
-rw-r--r--src/Writer.php6
7 files changed, 16 insertions, 14 deletions
diff --git a/src/AbstractCsv.php b/src/AbstractCsv.php
index 109df0b..9ec135a 100644
--- a/src/AbstractCsv.php
+++ b/src/AbstractCsv.php
@@ -256,9 +256,9 @@ abstract class AbstractCsv implements JsonSerializable, IteratorAggregate
*
* @return static
*/
- protected function newInstance($class_name, $open_mode)
+ protected function newInstance($class, $open_mode)
{
- $csv = new $class_name($this->path, $open_mode);
+ $csv = new $class($this->path, $open_mode);
$csv->delimiter = $this->delimiter;
$csv->enclosure = $this->enclosure;
$csv->escape = $this->escape;
diff --git a/src/Config/Output.php b/src/Config/Output.php
index f7689c7..047f402 100644
--- a/src/Config/Output.php
+++ b/src/Config/Output.php
@@ -155,7 +155,7 @@ trait Output
*/
public function output($filename = null)
{
- if (!is_null($filename)) {
+ if (null !== $filename) {
$filename = filter_var($filename, FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW);
header('Content-Type: application/octet-stream');
header('Content-Transfer-Encoding: binary');
diff --git a/src/Plugin/ColumnConsistencyValidator.php b/src/Plugin/ColumnConsistencyValidator.php
index 607c651..c0bf74f 100644
--- a/src/Plugin/ColumnConsistencyValidator.php
+++ b/src/Plugin/ColumnConsistencyValidator.php
@@ -89,7 +89,9 @@ class ColumnConsistencyValidator
$this->detect_columns_count = false;
return true;
- } elseif (-1 == $this->columns_count) {
+ }
+
+ if (-1 == $this->columns_count) {
return true;
}
diff --git a/src/Plugin/ForbiddenNullValuesValidator.php b/src/Plugin/ForbiddenNullValuesValidator.php
index ce1045c..831b79b 100644
--- a/src/Plugin/ForbiddenNullValuesValidator.php
+++ b/src/Plugin/ForbiddenNullValuesValidator.php
@@ -31,7 +31,7 @@ class ForbiddenNullValuesValidator
public function __invoke(array $row)
{
$res = array_filter($row, function ($value) {
- return is_null($value);
+ return null === $value;
});
return !$res;
diff --git a/src/Plugin/SkipNullValuesFormatter.php b/src/Plugin/SkipNullValuesFormatter.php
index d8546e2..02fc103 100644
--- a/src/Plugin/SkipNullValuesFormatter.php
+++ b/src/Plugin/SkipNullValuesFormatter.php
@@ -31,7 +31,7 @@ class SkipNullValuesFormatter
public function __invoke(array $row)
{
return array_filter($row, function ($value) {
- return !is_null($value);
+ return null !== $value;
});
}
}
diff --git a/src/Reader.php b/src/Reader.php
index 5e44f61..adf47e9 100644
--- a/src/Reader.php
+++ b/src/Reader.php
@@ -93,7 +93,7 @@ class Reader extends AbstractCsv
$iterator = $this->applyIteratorSortBy($iterator);
$iterator = $this->applyIteratorInterval($iterator);
$this->returnType = self::TYPE_ARRAY;
- if (!is_null($callable)) {
+ if (null !== $callable) {
return new MapIterator($iterator, $callable);
}
@@ -188,8 +188,8 @@ class Reader extends AbstractCsv
*
* By default if no column index is provided the first column of the CSV is selected
*
- * @param int $column_index field Index
- * @param callable|null $callable a callable function
+ * @param int $columnIndex field Index
+ * @param callable|null $callable a callable function
*
* @throws InvalidArgumentException If the column index is not a positive integer or 0
*
@@ -210,7 +210,7 @@ class Reader extends AbstractCsv
$this->addFilter($filterColumn);
$type = $this->returnType;
$iterator = $this->fetch($selectColumn);
- if (!is_null($callable)) {
+ if (null !== $callable) {
$iterator = new MapIterator($iterator, $callable);
}
@@ -261,7 +261,7 @@ class Reader extends AbstractCsv
$type = $this->returnType;
$iterator = $this->fetch($selectPairs);
- if (!is_null($callable)) {
+ if (null !== $callable) {
$iterator = new MapIterator($iterator, $callable);
}
diff --git a/src/Writer.php b/src/Writer.php
index 90a92cf..879ef99 100644
--- a/src/Writer.php
+++ b/src/Writer.php
@@ -68,7 +68,7 @@ class Writer extends AbstractCsv
*/
protected static function initFputcsv()
{
- if (is_null(static::$fputcsv)) {
+ if (null === static::$fputcsv) {
static::$fputcsv = new ReflectionMethod('\SplFileObject', 'fputcsv');
static::$fputcsv_param_count = static::$fputcsv->getNumberOfParameters();
}
@@ -115,7 +115,7 @@ class Writer extends AbstractCsv
$row = $this->formatRow($row);
$this->validateRow($row);
- if (is_null($this->csv)) {
+ if (null === $this->csv) {
$this->csv = $this->getIterator();
}
@@ -150,7 +150,7 @@ class Writer extends AbstractCsv
*/
public function isActiveStreamFilter()
{
- return parent::isActiveStreamFilter() && is_null($this->csv);
+ return parent::isActiveStreamFilter() && null === $this->csv;
}
/**