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
77
77
}
78
78
79
79
80
- public static function formatDocComment (string $ content ): string
80
+ public static function formatDocComment (string $ content, bool $ forceMultiLine = false ): string
81
81
{
82
82
$ s = trim ($ content );
83
83
$ s = str_replace ('*/ ' , '* / ' , $ s );
84
84
if ($ s === '' ) {
85
85
return '' ;
86
- } elseif (str_contains ($ content , "\n" )) {
86
+ } elseif ($ forceMultiLine || str_contains ($ content , "\n" )) {
87
87
$ s = str_replace ("\n" , "\n * " , "/** \n$ s " ) . "\n */ " ;
88
88
return Nette \Utils \Strings::normalize ($ s ) . "\n" ;
89
89
} else {
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ require __DIR__ . '/../bootstrap.php';
16
16
Assert::same ('' , Helpers::formatDocComment (' ' ));
17
17
Assert::same ("/** @var string */ \n" , Helpers::formatDocComment ('@var string ' ));
18
18
Assert::same ("/** \n * @var string \n */ \n" , Helpers::formatDocComment ("@var string \n" ));
19
+ Assert::same ("/** \n * @var string \n */ \n" , Helpers::formatDocComment ('@var string ' , true ));
19
20
Assert::same ("/** \n * A \n * B \n * C \n */ \n" , Helpers::formatDocComment ("A \nB \nC \n" ));
20
21
Assert::same ("/** \n * @var string \n */ \n" , Helpers::formatDocComment ("@var string \r\n" ));
21
22
Assert::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