mirror of
https://github.com/parsecsv/parsecsv-for-php.git
synced 2026-02-19 08:36:39 +00:00
Slightly simplified getTotalDataRowCount, added test
The brackets () in the pattern were not needed, as only $matches[0] was accessed, not $matches[1]. The @var is useful for PhpStorm's Php Inspections (EA Extended). More details here: https://github.com/kalessil/phpinspectionsea/blob/master/docs/types-compatibility.md#foreach-source-to-iterate-over
This commit is contained in:
@@ -549,9 +549,10 @@ class Csv {
|
||||
|
||||
$this->_detect_and_remove_sep_row_from_data($data);
|
||||
|
||||
$pattern = sprintf('/(%1$s[^%1$s]*%1$s)/i', $this->enclosure);
|
||||
$pattern = sprintf('/%1$s[^%1$s]*%1$s/i', $this->enclosure);
|
||||
preg_match_all($pattern, $data, $matches);
|
||||
|
||||
/** @var array[] $matches */
|
||||
foreach ($matches[0] as $match) {
|
||||
if (empty($match) || (strpos($match, $this->enclosure) === false)) {
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user