AutoComplete for CWebApplication instance (Yii::app())

Hi,

Since Yii::app() is marked as returning CApplication instance I can not get the code hinting that I need when working on a web site and where Yii::app() actually is a CWebApplication

Any idea how I could get Yii:app() to be marked as returning a CWebApplication instance.

Without changing the PhpDoc in the core that is

thanks in advance

CApplication is the base class of CWebApplication… How would your code hinting work if a method returns an interface?

hi,

all i am wondering is a way to have Yii::app()->… give me hints about the CWebApplication methods and ppties because this is actually what my app is.

I know that in other languages (AS3 for instance) i could just cast like this :

CWebApplication(Yii::app())->…

this would work because CWebApplication is a subclass of CApplication

don't know if what I am saying is making sense

thanks

PHP is a weak-typed language. Even though the doc says the return value is CApplication, if it actually returns CWebApplication, you can use it just as CWebApplication. You don't need to typecast it.

You can use "instanceof" operator to check whether the return value is of certain class. You can also use get_class() to check the concrete class name of the instance.

hi again,

thanks

my main concern was having code hints available :)

as this is a good way to learn the API I think

what I do at the moment is change the return type in the phpdoc comment in YiiBase

was wondering if there was another way

thanks for all the work and your answers !