Import 'some/namespace' is never used when used in doc blocks only

Hello,

 

just asking since I stumble on this. Don't know whether could be a bad practice though.

Should PS also search inside docs blocks before reporting non used import?

This would help to shortens doc blocks namespaces declarations when referrring to types. Problem i see is that actually, it is some editor level feature, for php runtime would be actualy an unused import :)

I am using PS 2016.3

 

Thanks in advance,

David

0
3 comments

Hi there,

Could you please clarify your case with some code/screenshots of how it looks and should look in IDE?

0

4 years later, still a thing.

Happens in a few languages. Here it is in an ESM Node.JS project in IntelliJ IDEA Ultimate 2020.3.3:

  • The "Remove unused 'import'" context action should not be active.
  • It should not be greyed out.
  • It should not be removed when "Optimize Imports" runs.

Workaround is to put the following above it (or let "Suppress for statement" add it for you):

// noinspection ES6UnusedImports
0

JS and PHP inspections work differently, this thread was about PHP inspection, afaics. Please report this separately to our tracker at https://youtrack.jetbrains.com/newIssue or at a WebStorm forum.

1

Please sign in to leave a comment.