Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ public function decorate(PhpDocNode $phpDocNode, PhpNode $phpNode): void
return null;
}

if (! in_array($node->name, ['@uses', '@used-by', '@see'], true)) {
return null;
}

$reference = $node->value->value;
if (! str_contains($reference, '::')) {
return null;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

declare(strict_types=1);

namespace Rector\Tests\Issues\CustomPhpDocTagClassReference;

use Iterator;
use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;

final class CustomPhpDocTagClassReferenceTest extends AbstractRectorTestCase
{
#[DataProvider('provideData')]
public function test(string $filePath): void
{
$this->doTestFile($filePath);
}

public static function provideData(): Iterator
{
return self::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}

public function provideConfigFilePath(): string
{
return __DIR__ . '/config/configured_rule.php';
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace Rector\Tests\Issues\CustomPhpDocTagClassReference\Fixture;

use Rector\Tests\Issues\CustomPhpDocTagClassReference\Source\NotificationHandler;

/**
* @throwable-from NotificationHandler::createPayload
*/
final class SkipCustomTagWithClassReference extends \Exception
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

declare(strict_types=1);

namespace Rector\Tests\Issues\CustomPhpDocTagClassReference\Source;

final class NotificationHandler
{
public function createPayload(): void
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

declare(strict_types=1);

use Rector\Config\RectorConfig;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->removeUnusedImports();
};