You cannot call a method to set the default value for a variable in PHP, even if it is a static method. Change it to set in the constructor:
use Yii; class UserController extends XController { var $app; function __construct() { $this->app = = Yii::app(); } public function init() { $test = $this->app; } }
As a note, you should not use the var keyword in PHP versions> 4; see this question for an explanation.
source share