Yii::app() ->Getuser() - Completion Problem


I’m interested in why function app() in YiiBase class in PHPDoc return CApplication? It’s not comfortable when I write code. For example when I want to use Yii::getUser() function from CWebApplication - I don’t have code propsal for function getUser()?

I know that I can change CApplication to CWebApplication and all will be fine, but why CWebApplication aren’t the default value of return type Yii::app() function?

Thanks for reponse and sorry for my English language :) !

EDIT: I use eclipse with PDT and Yiiclipse plugin. Maybe other IDEs will improve the precision of code hints?

That’s because Yii::app() may return both CWebApplication and CConsoleApplication. One way to get code completion is to do this:

$app = Yii::app();

/* @var $app CWebApplication */

$app->getU //code completion will now offer getUser()

[color="#006400"]/* moved from Bug Discussions … */[/color]