mirror of
https://github.com/rectorphp/rector.git
synced 2025-02-25 04:03:55 +01:00
keep original info at doc block
This commit is contained in:
parent
c8d45616c0
commit
71bcc39de1
@ -67,10 +67,12 @@ final class DocBlockAnalyzer
|
||||
return;
|
||||
}
|
||||
|
||||
$content = $node->getDocComment()->getText();
|
||||
$docComment = $node->getDocComment();
|
||||
$content = $docComment->getText();
|
||||
|
||||
$newContent = Strings::replace($content, '#' . preg_quote($old, '#') . '#', $new, 1);
|
||||
|
||||
$doc = new Doc($newContent);
|
||||
$doc = new Doc($newContent, $docComment->getLine(), $docComment->getFilePos(), $docComment->getTokenPos());
|
||||
$node->setDocComment($doc);
|
||||
}
|
||||
|
||||
@ -84,12 +86,7 @@ final class DocBlockAnalyzer
|
||||
|
||||
$oldAnnotationPattern = preg_quote(sprintf('#@%s#', $oldAnnotation), '\\');
|
||||
|
||||
$newContent = Strings::replace(
|
||||
$oldContent,
|
||||
$oldAnnotationPattern,
|
||||
'@' . $newAnnotation,
|
||||
1
|
||||
);
|
||||
$newContent = Strings::replace($oldContent, $oldAnnotationPattern, '@' . $newAnnotation, 1);
|
||||
|
||||
$doc = new Doc($newContent);
|
||||
$node->setDocComment($doc);
|
||||
|
@ -161,7 +161,6 @@ final class ValueObjectRemoverRector extends AbstractRector
|
||||
return $node;
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -211,7 +210,6 @@ final class ValueObjectRemoverRector extends AbstractRector
|
||||
continue;
|
||||
}
|
||||
|
||||
dump($nodeType);
|
||||
return $this->valueObjectsToSimpleTypes[$nodeType];
|
||||
}
|
||||
|
||||
@ -228,7 +226,7 @@ final class ValueObjectRemoverRector extends AbstractRector
|
||||
|
||||
return [
|
||||
$nodeType,
|
||||
$this->valueObjectsToSimpleTypes[$nodeType]
|
||||
$this->valueObjectsToSimpleTypes[$nodeType],
|
||||
];
|
||||
}
|
||||
|
||||
@ -237,7 +235,8 @@ final class ValueObjectRemoverRector extends AbstractRector
|
||||
|
||||
private function renameNullableInDocBlock(Node $node, string $oldType, string $newType): void
|
||||
{
|
||||
$this->docBlockAnalyzer->replaceInNode($node,
|
||||
$this->docBlockAnalyzer->replaceInNode(
|
||||
$node,
|
||||
sprintf('%s|null', $oldType),
|
||||
sprintf('%s|null', $newType)
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user