Fix constant fixer docs format
@@ -32,7 +32,8 @@ $fixer = new ConstantFixer(
$parser = (new ParserFactory())->create(ParserFactory::PREFER_PHP7);
$ast = $parser->parse($content);
$traverser = new NodeTraverser();
- $traverser->addVisitor(new class($constantDefinitions) extends SimpleNodeTraverserAbstract {
+ $traverser->addVisitor(new class($constantDefinitions) extends SimpleNodeTraverserAbstract
+ {
/**
* @param array<string, ConstantDefinition> $constantDefinitions
*/
@@ -92,7 +93,7 @@ $fixer = new ConstantFixer(
'comments' => [
new Doc(
text: "/**\n * This constant holds SIG{$name} value, it's platform-dependent.\n *" .
- str_replace("\n", "\n * ", $constantDefinition->comment) .
+ implode("\n *", array_map(static fn ($x) => $x === '' ? $x : " $x", explode("\n", $constantDefinition->comment))) .
"\n */",
),
],
@@ -121,7 +122,7 @@ $fixer = new ConstantFixer(
'comments' => [
new Doc(
text: "/**\n* This constant holds SIG{$name} value, it's platform-dependent.\n *" .
- str_replace("\n", "\n * ", $constantDefinition->comment) .
+ implode("\n *", array_map(static fn ($x) => $x === '' ? $x : " $x", explode("\n", $constantDefinition->comment))) .
"\n */",
),
],
@@ -242,7 +243,7 @@ $fixer = new ConstantFixer(
'comments' => [
new Doc(
text: "/**\n * This constant holds page size of this machine, it's platform-dependent.\n *" .
- str_replace("\n", "\n * ", $constantDefinition->comment) .
+ implode("\n *", array_map(static fn ($x) => $x === '' ? $x : " $x", explode("\n", $constantDefinition->comment))) .
"\n */",
),
],
@@ -283,7 +284,7 @@ $fixer = new ConstantFixer(
'comments' => [
new Doc(
text: "/**\n * This constant holds UV_{$name} value, it's platform-dependent.\n *" .
- str_replace("\n", "\n * ", $constantDefinition->comment) .
+ implode("\n *", array_map(static fn ($x) => $x === '' ? $x : " $x", explode("\n", $constantDefinition->comment))) .
"\n */",
),
],
