Skip to content

Commit

Permalink
feat(TextIterator): add forward compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
h4kuna committed Jun 11, 2024
1 parent ddad143 commit 8aa25b0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Iterators/TextIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ public function setCsv(string $delimiter = ',', string $enclosure = '"', string
*/
private static function text2Array(string $text): array
{
return explode("\n", Strings::unixNewLines($text));
$existsNewMethod = method_exists(Strings::class, 'unixNewLines'); // @phpstan-ignore-line
return explode("\n", $existsNewMethod
? Strings::unixNewLines($text)
: Strings::normalizeNewLines($text)
);
}


Expand Down

0 comments on commit 8aa25b0

Please sign in to comment.