yii\web\Application->session: property-read?

Hi,

I just upgraded from 2.0.38 to 2.0.40. I work with PHPStorm and noticed the following:

Since the Yii2 upgrade, all lines \Yii::$app->session['key'] = value; are underlined red. PHPStorm says “@property-read” as the reason.

I took a look to the class and it is right:

yii\web\Application:

 * @property-read Session $session The session component. This property is read-only.

But the docs state, that:

// set a session variable. The following usages are equivalent:
$session->set('language', 'en-US');
$session['language'] = 'en-US';
$_SESSION['language'] = 'en-US';

So, it should be ok. I see, that the PHPstorm error is talking about the property session inside the class Application.

So, is this caused by https://github.com/yiisoft/yii2/commit/ccb14ff6671279f184906024144544ce3b732393#diff-eeee8573b0fd163722a7a780827dc44ceb48b9d96b639deaa23d38dc17cc9b60 ? I think, the change is not correct, since it is not just read only. Its confusing now.

Any ideas?

Thanks!

If it’s not correct, create an issue at https://github.com/yiisoft/yii2/issues. We’ll look into it and fix it.

Did this ever get sorted, just upgraded and hit the same issue :slight_smile:

Would you please report it to issue tracker?