illegal array key type stdClass

I have this code fragment:

( $this->getFieldToUnset() as $field) {


where $this->getFieldToUnset is a method that returns an array.

After working for a while with Phpstorm, i get this 'warning' about $field

llegal array key type stdClass

(for warning I mean that $field in $attributes[$field] is highlighted and the message pops up if I over the variable

If I close Phpstorm and reopen it, the warning disappears.

This is not the only weird warning, but they all seem to be related to wrongly detect variable type.

Anybody experienced the same? Any fix?

My Phpstorm is 2016.2 built on July 12th, 2016




Comment actions Permalink


Do you have any 3rd-party plugins that helps with PHP inspections? If yes then it is worth disabling them and checking how PhpStorm will behave after the restart.

Comment actions Permalink

Hi Vladimir,

and thank you for your answer. The only third-party plugins I installed are the markdown plugin by Julien Nicoulaud, which is currently not working because it is not compatible with the current PS version and the .ignore plugin by hsz.

I'll try disabling them as per your suggestion and see what happens.

Thank you

Comment actions Permalink

Hi Marco,

I doubt this will do any difference.

Please try File > Invalidate Caches\Restart > Invalidate and Restart and check how it will go after.

Comment actions Permalink

Hi Vladimir,

I'll try what you suggested and see how it goes today.

I'll let you know.

Thanks a lot for your time and suggestions.

Comment actions Permalink

Hi Vladimir,

so far so good. Never had the problem yesterday. I see how it'll behave today.

Thanks a lot again


Please sign in to leave a comment.