Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions src/Exporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
use function sprintf;
use function str_repeat;
use function str_replace;
use function strtr;
use function var_export;
use BackedEnum;
use ReflectionObject;
Expand Down Expand Up @@ -318,14 +319,14 @@ private function exportString(string $value): string
}

return "'" .
str_replace(
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

before the PR we processed each string twice.

'<lf>',
"\n",
str_replace(
["\r\n", "\n\r", "\r", "\n"],
['\r\n<lf>', '\n\r<lf>', '\r<lf>', '\n<lf>'],
$value,
),
strtr(
$value,
[
"\r\n" => '\r\n' . "\n",
"\n\r" => '\n\r' . "\n",
"\r" => '\r' . "\n",
"\n" => '\n' . "\n",
],
) .
"'";
}
Expand Down