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

Unused imports detected for classes with generic type annotations #224

Closed wimski closed 2 years ago

wimski commented 3 years ago

I'm using @template and @extends to support generic types. The class names used in these annotations are not recognized as required imports. Is this not supported by this plugin? Will this be supported in an upcoming version?

<?php

use Illuminate\Database\Eloquent\Model; // PHPStorm flags this import as unused

/**
 * @template T of Model
 */
interface RepositoryInterface
{
    /**
     * @param string $id
     * @return T|null
     */
    public function find(string $id);
}
<?php

use App\Models\MyModel; // PHPStorm flags this import as unused

/**
 * @extends RepositoryInterface<MyModel>
 */
interface MyModelRepository extends RepositoryInterface
{
}
Haehnchen commented 2 years ago

this tags are directly handled inside PhpStorm core. maybe report the first use case to them as its not supported, but second one works