Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.6k
[Config] Fix generated comment for multiline "info"#60400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
} | ||
if ($node instanceof EnumNode) { | ||
$comment .= sprintf(' *@param ParamConfigurator|%s $value', implode('|', array_unique(array_map(fn ($a) => !$a instanceof \UnitEnum ? var_export($a, true) : '\\'.ltrim(var_export($a, true), '\\'), $node->getValues()))))."\n"; | ||
$comment .= sprintf('@param ParamConfigurator|%s $value', implode('|', array_unique(array_map(fn ($a) => !$a instanceof \UnitEnum ? var_export($a, true) : '\\'.ltrim(var_export($a, true), '\\'), $node->getValues()))))."\n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
When up-merging into 7.2, a backslash is added beforesprintf
by6ce530c#diff-2aaa94a5e0cdde514853eddaf724fb3724c0501ddc5285af115bc1fe9c04d7ce
@@ -413,39 +413,43 @@ private function getComment(BaseNode $node): string | |||
{ | |||
$comment = ''; | |||
if ('' !== $info = (string) $node->getInfo()) { | |||
$comment .=' * '.$info."\n"; | |||
$comment .= $info."\n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
If we want a smaller fix applied only to the$info
part, it would be:
$comment .=' *'.str_replace("\n","\n *",$info)."\n";
Could we edit existing fixtures to cover this (like |
Thanks@alexandre-daubois, I hadn't found where to test. |
Thank you@GromNaN. |
7a69d61
intosymfony:6.4Uh oh!
There was an error while loading.Please reload this page.
Instead of fixing the multiline comment formatting only for the "info" part, the
*
is now prepended to every line of the generated comment block.nette/code-generator
uses almost the same transformation:https://github.com/nette/php-generator/blob/42806049a7774a2bd316c958f5dcf01c6b5c56fa/src/PhpGenerator/Helpers.php#L60