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)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does the class-name still fit, after you removed this line?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the class changed here is named PhpDocTagGenericUsesDecorator .. I guess the name is related to if (! in_array($node->name, ['@uses', '@used-by', '@see'], true)) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@samsonasik what do you think? Could you do the change it you think it's worth it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, probably raname class name and its usage to PhpDocTagGenericDecorator should be ok

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();
};