Yii Autocompletion Solution For Phpstorm Made Yiic Shell Stopped Working


I tried the solution that I read here:


To have auto complete for the component’s attributes and methods (Yii::app()->user, etc) in phpStorm. Basically, the tutorial says to change the index.php file so that it includes YiiBase.php instead of yii.php. And then delare the Yii in class in that same file like this:

class Yii extends YiiBase



     * @static

     * @return CWebApplication


    public static function app()


        return parent::app();



This worked perfectly, but now that I tried accessing yiic shell tool I get this error:

Fatal error: Cannot redeclare class Yii in /Users/F/Sites/MySite/index.php on line 25

Call Stack:

    0.0002     630120   1. {main}() /Users/x/Sites/yii-1.1.12/framework/yiic:0

    0.0009     645168   2. require_once('/Users/x/Sites/yii-1.1.12/framework/yiic.php') /Users/x/Sites/yii-1.1.12/framework/yiic:15

    0.0237    1991472   3. CApplication->run() /Users/x/Sites/yii-1.1.12/framework/yiic.php:34

    0.0237    1991472   4. CConsoleApplication->processRequest() /Users/x/Sites/yii-1.1.12/framework/base/CApplication.php:162

    0.0237    1991472   5. CConsoleCommandRunner->run() /Users/x/Sites/yii-1.1.12/framework/console/CConsoleApplication.php:92

    0.0413    2295520   6. ShellCommand->run() /Users/x/Sites/yii-1.1.12/framework/console/CConsoleCommandRunner.php:68


yii-1.1.12/framework/yiic shell protected/config/main.php

Solved the issue ;)

I got the solution from:


It was a different problem but the solution works also for this problem.