When a class name is used as a string as a key inside another array the class is marked as not used
But only if this construction is used before "regular" usages
The error only occurs in this exact case, when for example the array is not nested in another array everything works fine:
Aslo when the class name is not used as a key of an existing array the class is correctly marked as used
Running "Code > Inspect Code" shows an incorrect "Import 'common\models\sql\KnowledgeType' is never used" warning (the other 2 warnings are expected).
The biggest problem is that since the import is not recognized as being used, when the "optimize imports" function runs it removes the import statement.
Originally posted at https://youtrack.jetbrains.com/issue/WI-50947
What steps will reproduce the problem?
When a class name is used as a string as a key inside another array the class is marked as not used
But only if this construction is used before "regular" usages
The error only occurs in this exact case, when for example the array is not nested in another array everything works fine:
Aslo when the class name is not used as a key of an existing array the class is correctly marked as used
Running "Code > Inspect Code" shows an incorrect "Import 'common\models\sql\KnowledgeType' is never used" warning (the other 2 warnings are expected).
The biggest problem is that since the import is not recognized as being used, when the "optimize imports" function runs it removes the import statement.
What is the expected result?
Class is marked as "used"
What do you get instead?
Class is marked as "unused"
Additional info