File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed
Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change 1919use Symfony \Component \Console \Output \OutputInterface ;
2020
2121use function assert ;
22- use function explode ;
2322use function implode ;
2423use function mb_strlen ;
2524use function preg_replace ;
@@ -91,9 +90,9 @@ public function setHelp(string $help): static
9190
9291 private function wrapHelp (string $ message ): string
9392 {
94- $ message = (string ) preg_replace ('/(?<!\n)\n (?!\s)/m ' , ' ' , $ message );
95- $ message = str_replace ( "\n" , PHP_EOL , $ message );
96- $ lines = explode ( "\n" , $ message );
93+ $ message = (string ) preg_replace ('/(?<!\n|\r|\r\n)\R (?!\s)/ ' , ' ' , $ message );
94+ $ message = ( string ) preg_replace ( ' /\R/ ' , PHP_EOL , $ message );
95+ $ lines = preg_split ( ' /\R/ ' , $ message ) ?: [] ;
9796
9897 $ wrapped = [];
9998
Original file line number Diff line number Diff line change 2525use function trim ;
2626
2727use const FILTER_VALIDATE_FLOAT ;
28+ use const PHP_EOL ;
2829
2930abstract class ProcessCommand extends Command
3031{
@@ -66,11 +67,14 @@ public function setHelp(string $help): static
6667 $ executable = $ this ->getExecutablePath ();
6768 $ name = $ this ->getExecutableName ();
6869
69- $ programInfo = "\n\n--- \n\nThis command uses $ name. On your system, $ name is " ;
70+ // Double-spaced lines.
71+ $ ds = PHP_EOL . PHP_EOL ;
72+
73+ $ programInfo = "$ ds--- {$ ds }This command uses $ name. On your system, $ name is " ;
7074
7175 if ($ executable === null ) {
7276 $ programInfo .= '<error>not installed</error>. ' ;
73- $ programInfo .= "\n\n" ;
77+ $ programInfo .= $ ds ;
7478 $ programInfo .= $ this ->getInstallationMessage ();
7579 } else {
7680 if (str_starts_with ((string ) $ this ->getExecutablePath (), $ this ->configuration ->projectRoot )) {
You can’t perform that action at this time.
0 commit comments