Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/PostRector/Rector/UnusedImportRemovingPostRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ private function findNamesInDocBlocks(Namespace_|FileNode $rootNode): array
$nodeToCheck = $totalDocs === 1 ? $node : clone $node;
if ($totalDocs > 1) {
$nodeToCheck->setDocComment($doc);
// the clone carries the PhpDocInfo already resolved for the original node (its last doc comment),
// so the factory would return it instead of parsing $doc
$nodeToCheck->setAttribute(AttributeKey::PHP_DOC_INFO, null);
}

$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($nodeToCheck);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

declare(strict_types=1);

namespace Rector\Tests\Issues\NamespacedUseAutoImport\Fixture;

use Carbon\Carbon;
use Carbon\CarbonInterface;

final class StackedDocblocksKeepUsedImport
{
/**
* @var CarbonInterface|null
*/
/**
* @see Carbon
*/
public $deletedAt;
}

?>
Loading