File tree Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -77,13 +77,13 @@ public static function formatArgs(string $statement, array $args): string
7777 }
7878
7979
80- public static function formatDocComment (string $ content ): string
80+ public static function formatDocComment (string $ content, bool $ forceMultiLine = false ): string
8181 {
8282 $ s = trim ($ content );
8383 $ s = str_replace ('*/ ' , '* / ' , $ s );
8484 if ($ s === '' ) {
8585 return '' ;
86- } elseif (str_contains ($ content , "\n" )) {
86+ } elseif ($ forceMultiLine || str_contains ($ content , "\n" )) {
8787 $ s = str_replace ("\n" , "\n * " , "/** \n$ s " ) . "\n */ " ;
8888 return Nette \Utils \Strings::normalize ($ s ) . "\n" ;
8989 } else {
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ require __DIR__ . '/../bootstrap.php';
1616Assert::same ('' , Helpers::formatDocComment (' ' ));
1717Assert::same ("/** @var string */ \n" , Helpers::formatDocComment ('@var string ' ));
1818Assert::same ("/** \n * @var string \n */ \n" , Helpers::formatDocComment ("@var string \n" ));
19+ Assert::same ("/** \n * @var string \n */ \n" , Helpers::formatDocComment ('@var string ' , true ));
1920Assert::same ("/** \n * A \n * B \n * C \n */ \n" , Helpers::formatDocComment ("A \nB \nC \n" ));
2021Assert::same ("/** \n * @var string \n */ \n" , Helpers::formatDocComment ("@var string \r\n" ));
2122Assert::same ("/** \n * A \n * \n * B \n */ \n" , Helpers::formatDocComment ("A \n\nB " ));
You can’t perform that action at this time.
0 commit comments