Haehnchen / idea-php-annotation-plugin

Add PHP annotation support for PhpStorm and IntelliJ
https://plugins.jetbrains.com/plugin/7320
MIT License
251 stars 41 forks source link

Renaming class is not working #292

Open vlady777 opened 1 year ago

vlady777 commented 1 year ago

Rename class is not working totally (or partially in case of many usages) when there are at least one test case with @covers annotation. To reproduce behavior, plase create two classes in SF directory structure like the following:

<?php

declare(strict_types=1);

namespace App\Service;

class SomeService
{
    public function someMethod(): bool
    {
        return true;
    }
}

and

<?php

declare(strict_types=1);

namespace App\Tests\Service;

use App\Service\SomeService;
use PHPUnit\Framework\TestCase;

class SomeServiceTest extends TestCase
{
    /**
     * @covers \App\Service\SomeService::someMethod
     */
    public function testSomeMethod(): void
    {
        self::assertTrue((new RenamedService())->someMethod());
    }
}

Next try to rename SomeService to something else (Shift+F6). Class (and file) will not be renamed. If plugin is disabled renaming works as expected.

It's related to the following lines:

/**
 * @covers \App\Service\SomeService::someMethod
 */

if there will be short classname @covers SomeService::someMethod will works as expected.

Also it works fine if dynamic usages are excluded (plugin enabled) изображение

Please check and fix.

изображение изображение

PhpStorm 2023.1.4 Build #PS-231.9225.18, built on July 13, 2023 Licensed to SIA "ATTA-1" / Vlad Yarus Subscription is active until November 14, 2023. Runtime version: 17.0.7+10-b829.16 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. Linux 6.2.0-26-generic GC: G1 Young Generation, G1 Old Generation Memory: 4096M Cores: 8 Registry: debugger.watches.in.variables=false run.processes.with.pty=TRUE documentation.show.toolbar=true

Non-Bundled Plugins: com.kalessil.phpStorm.phpInspectionsEA (5.0.0.0) ru.adelf.idea.dotenv (2023.1) de.espend.idea.php.annotation (9.4.0) fr.adrienbrault.idea.symfony2plugin (2022.1.253)

Current Desktop: X-Cinnamon

vlady777 commented 1 year ago

All installed plugins were disabled and problem starts to reproduce right after PHP Annotations plugin is enabled (even without Symfony plugin).

lukascocula commented 10 months ago

I observed same issue today. I tried to reinstall plugin, invalidate caches, downgrade PHPstorm, reinstall PHPstorm, nothing helped. Only disabling/uninstall plugin helped.

PhpStorm 2023.3.2 Build #PS-233.13135.108, built on December 21, 2023 Runtime version: 17.0.9+7-b1087.9 aarch64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. macOS 14.1.1 GC: G1 Young Generation, G1 Old Generation Memory: 4096M Cores: 10 Metal Rendering is ON Registry: run.processes.with.pty=TRUE Non-Bundled Plugins: ru.adelf.idea.dotenv (2023.3) de.espend.idea.php.annotation (9.4.0)