Warning "Expected EntityDrupalWrapper, got string" in function calls

My Drupal project behaved well in PHPStorm. But at some point during custom module development, probably after writing a test in Drupal Simpletest framework using Entity API, PHPStorm suddenly started to show a warning: "Expected EntityDrupalWrapper, got string" all over Drupal code. I am not sure why, because simpletest framework and entity api is used in many Drupal modules and so far there was no problem. Maybe opening the EntityDrupalWrapper class file or a test file using this class in editor makes PHPStorm aware of this class and from now on the problem exists?

For example, this is native code from Drupal node module:

/**
 * Implements hook_cron().
 */
function node_cron() {
  db_delete('history')
    ->condition('timestamp', NODE_NEW_LIMIT, '<')
    ->execute();
}

PHPStorm displays the string 'history' in yellow color and on mouse hover the warning mentioned above appears, although db_delete function expects a string parameter.

Basically all Drupal files in the project are affected and there are tons of warnings in function calls which have a string parameter (but not all functions, some are unaffected). Removing my custom module from the project does not help.

So, two questions:

[SOLVED] 1) How to quickly disable this warning because it makes makes the code look bad (I checked Settings > Editor > Inspections but couldn't find this warning)?

2) What can be the cause of such PHPStorm behavior and is it possible to deal with it in another way than just disabling the warning, because such a warning may be useful if the parameters are really messed?

[Edit]

Question 1) was resolved by disabling "Parameter type" inspection.

 

4 comments
Avatar
Vladimir Luchansky
Comment actions Permalink

Hello,

There could be some IDE caches error. Could you run File > Invalidate Caches/Restart > Invalidate and Restart, please, and then check if the issue reoccurs?

Thanks!

0
Comment actions Permalink

I expected the same strange behavior:

I invalidated the cache before, but it reoccurs after a wile. But I have no idea how to reproduce it.

 

 

0
Comment actions Permalink

@Eugene Morozov

You're right, in my case it's related to https://youtrack.jetbrains.com/issue/WI-32620

Tanks!!

0

Please sign in to leave a comment.