Warnings for NULL initialized class members

Hi Folks,

when using class member vars, default initialized with NULL and then re-initialized in the constructor, PHPStorm gives my warnings. See example screenshot attached. I already did an annotation for this, is there any trick regarding this problem?

When changing

protected $_db = null;

to

protected $_db;


all warnings go away.


Will gladly accept any hints. :)

Cheers,
Dave



Attachment(s):
Bildschirmfoto 2012-10-31 um 17.24.57.png
Bildschirmfoto 2012-10-31 um 17.34.36.png
4 comments
Comment actions Permalink

Hi David,

Try adding proper PHPDoc for $_db field:

...

/**
* @var Zend_Db_Adapter_Mysqli (or whatever proper type should be here)

*/
protected $_db = null;
...

0
Comment actions Permalink

Sorry, forget to add this to the screenshot, just mentioned it in the text.

Dave



Attachment(s):
Bildschirmfoto 2012-10-31 um 17.48.56.png
Bildschirmfoto 2012-10-31 um 17.51.00.png
0
Comment actions Permalink

No idea then. Used to work just fine before since v1 IIRC (but v5.0.3 is really bad -- brought too many new issues -- very unexpected for stable release).

I guess reporting it to the Issue Tracker would the the right choice.

0
Comment actions Permalink

Will do!

Thanks!

0

Please sign in to leave a comment.