E
E
entermix2021-04-03 17:27:19
phpstorm
entermix, 2021-04-03 17:27:19

How to allow annotations in PhpStorm 2020.3.3?

PhpStorm 2020.3.3 marks imported classes as unused even if they are used in annotations.

606874e2616d1462741393.png

I'm using Symfony 5.2 + api-platform/api-pack which installed doctrine/annotations ^1.0 where PHP 8 attributes are not supported.

I understand it's possible to manually update this package? What if there is no alternative?

The thing is that the Ctrl + Alt + O(Optimize imports) combination removes classes that are not used in the code, but you need to make sure that the imported classes are sorted automatically before the commit, i.e. the Optimize imports function will run automatically, hence removing all (as PhpStorm thinks) unused classes.

https://www.jetbrains.com/help/phpstorm/creating-a...

What can be done?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
entermix, 2021-04-03
@entermix

So far managed to solve the problem using the following plugins:
https://plugins.jetbrains.com/plugin/7320-php-anno...
https://plugins.jetbrains.com/plugin/7219-symfony-...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question