Skip to content

Commit

Permalink
[AutoImport] Re-enable keep comment before multiple \@ (#5282)
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik authored Nov 23, 2023
1 parent 06eb108 commit 72c0216
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,16 @@ private function processTextSpacelessInTextNode(
return;
}

// temporary restore keep comment feature to avoid error
// in nested annotation
// @see https://github.com/rectorphp/rector-src/pull/5280#pullrequestreview-1745794426
unset($phpDocNode->children[$key]);
array_splice($phpDocNode->children, $key, 0, $spacelessPhpDocTagNodes);
$texts = explode("\n@\\", $phpDocTextNode->text);
$otherText = $texts[0];

if (! str_starts_with($otherText, '@\\') && trim($otherText) !== '') {
$phpDocNode->children[$key] = new PhpDocTextNode($otherText);
array_splice($phpDocNode->children, $key + 1, 0, $spacelessPhpDocTagNodes);
} else {
unset($phpDocNode->children[$key]);
array_splice($phpDocNode->children, $key, 0, $spacelessPhpDocTagNodes);
}
}

private function transformGenericTagValueNodesToDoctrineAnnotationTagValueNodes(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ use Symfony\Component\Routing\Annotation\Route;
class TwoRoutesWithCommentBefore
{
/**
* Testsssssssssss
* @Route("/first", methods={"GET"})
* @Route("/second", methods={"GET"})
*/
Expand Down

0 comments on commit 72c0216

Please sign in to comment.