Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 564ba5b

Browse files
Prefer str_contains
1 parent d375752 commit 564ba5b

File tree

1 file changed

+2
-2
lines changed
  • src/Symfony/Component/Console/Helper

1 file changed

+2
-2
lines changed

src/Symfony/Component/Console/Helper/Table.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ private function buildTableRows(array $rows): TableRows
621621
if (!strstr($cell ?? '', "\n")) {
622622
continue;
623623
}
624-
$eol = false !== strpos($cell ?? '', "\r\n") ? "\r\n" : "\n";
624+
$eol = str_contains($cell ?? '', "\r\n") ? "\r\n" : "\n";
625625
$escaped = implode($eol, array_map([OutputFormatter::class, 'escapeTrailingBackslash'], explode($eol, $cell)));
626626
$cell = $cell instanceof TableCell ? new TableCell($escaped, ['colspan' => $cell->getColspan()]) : $escaped;
627627
$lines = explode($eol, str_replace($eol, '<fg=default;bg=default></>'.$eol, $cell));
@@ -686,7 +686,7 @@ private function fillNextRows(array $rows, int $line): array
686686
$nbLines = $cell->getRowspan() - 1;
687687
$lines = [$cell];
688688
if (strstr($cell, "\n")) {
689-
$eol = false !== strpos($cell, "\r\n") ? "\r\n" : "\n";
689+
$eol = str_contains($cell, "\r\n") ? "\r\n" : "\n";
690690
$lines = explode($eol, str_replace($eol, '<fg=default;bg=default>'.$eol.'</>', $cell));
691691
$nbLines = \count($lines) > $nbLines ? substr_count($cell, $eol) : $nbLines;
692692

0 commit comments

Comments
 (0)