This was happening to me on a Javascript file app.js
.
Ed Cottrell's answer seemed promising:
The short version is that you have to "kick" the IDE and get it to reset something internally.
But his workaround did not work for me (2016.2.2), nor did the following:
- copy all contents, cut it away, save the file, paste it back.
- hit F2 to trigger inspector
- run inspector manually (Code > Inspect Code)
- invalidate all caches and restart
So I thought I would carve down what piece of Javascript was triggering the fake error. To begin with I made an identical copy of app.js (Ctrl-C + Ctrl-V in the Files tree). I planned on removing code until I got rid of that pesky weak warning.
The new file (identical - same MD5 even) had no warnings and the green checkmark.
Okay, so I thought "I'll just delete app.js and rename appcopy.js. This will not go well with SVN but what the heck".
Then I thought I was first going to rename app.js, and I did. That triggered the refactor dialog. Silly me, I don't want to do that, and I hit Cancel. Then hit Refactor->Rename again but unchecked all refactorings.
And it was at that point that I noticed the green checkmark had appeared in app.js too.
So I hit Cancel again, and deleted the appcopy.js file.
The weak warning returned on the surviving app.js file!
Okay. Let's start again...
Final procedure
- Ctrl-C + Ctrl-V and I have a new
appunisci.js
file identical to my app.js
. Green checkmark on both. If only it were that easy...
- Rename
app.js
without refactoring and app.js
becomes spunisci.js
. My app is now broken but no changes to the code are performed.
- Rename
appunisci.js
without refactoring into app.js
. My app now works again, I have an extra file and a SVN mess.
- I now have an
app.js
with the green check mark
- Finally delete
spunisci.js
to get rid of the extra file.
app.js
is still OK!
- from the command line, since I had also modified
app.js
(otherwise a simple revert would have fixed SVN)
- copy
app.js
to app.bak
- run
svn revert app.js
to reset Subversion history
- copy
app.bak
to app.js
to recover my changes
- run
svn status
and confirm that app.js
is "M" and not "R +"
- courting disaster, I hit F2 in PHPStorm and also tried Code > Inspect Code...
- "No suspicious code found" (as before), green checkmark.