Добавлен файл для автокомплита в проекте, обновлены обращения к di для лучшего статического анализа

This commit is contained in:
ErickSkrauch 2016-07-17 19:13:40 +03:00
parent dd0c4fcc9e
commit 2063d7daa0
7 changed files with 51 additions and 11 deletions

View File

@ -48,9 +48,7 @@ class OauthController extends Controller {
* @return \League\OAuth2\Server\AuthorizationServer
*/
protected function getServer() {
/** @var \common\components\oauth\Component $oauth */
$oauth = Yii::$app->get('oauth');
return $oauth->authServer;
return Yii::$app->oauth->authServer;
}
/**

42
autocompletion.php Normal file
View File

@ -0,0 +1,42 @@
<?php
/**
* Yii bootstrap file.
* Used for enhanced IDE code autocompletion.
* Note: To avoid "Multiple Implementations" PHPStorm warning and make autocomplete faster
* exclude or "Mark as Plain Text" vendor/yiisoft/yii2/Yii.php file
*/
class Yii extends \yii\BaseYii {
/**
* @var BaseApplication|WebApplication|ConsoleApplication the application instance
*/
public static $app;
}
/**
* Class BaseApplication
* Used for properties that are identical for both WebApplication and ConsoleApplication
*
* @property \yii\swiftmailer\Mailer $mailer
* @property \yii\redis\Connection $redis
* @property \common\components\RabbitMQ\Component $amqp
*/
abstract class BaseApplication extends yii\base\Application {
}
/**
* Class WebApplication
* Include only Web application related components here
*
* @property \api\components\User\Component $user User component.
* @property \api\components\ReCaptcha\Component $reCaptcha
* @property \common\components\oauth\Component $oauth
*/
class WebApplication extends yii\web\Application {
}
/**
* Class ConsoleApplication
* Include only Console application related components here
*/
class ConsoleApplication extends yii\console\Application {
}

View File

@ -43,7 +43,7 @@ abstract class Controller extends \yii\console\Controller {
* @return Component
*/
protected function getAmqp() {
return Yii::$app->get('amqp');
return Yii::$app->amqp;
}
/**

View File

@ -9,7 +9,7 @@ class Helper {
* @return Component $amqp
*/
public static function getInstance() {
return Yii::$app->get('amqp');
return Yii::$app->amqp;
}
public static function sendToExchange($exchange, $routingKey, $message, $exchangeArgs = []) {

View File

@ -12,7 +12,7 @@ class Key {
* @return \yii\redis\Connection
*/
public function getRedis() {
return Yii::$app->get('redis');
return Yii::$app->redis;
}
public function getKey() {

View File

@ -10,7 +10,7 @@ class Set extends Key implements IteratorAggregate {
* @return \yii\redis\Connection
*/
public static function getDb() {
return Yii::$app->get('redis');
return Yii::$app->redis;
}
public function add($value) {

View File

@ -3,21 +3,21 @@ return [
'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',
'components' => [
'cache' => [
'class' => 'yii\caching\FileCache',
'class' => yii\caching\FileCache::class,
],
'db' => [
'class' => 'yii\db\Connection',
'class' => yii\db\Connection::class,
'charset' => 'utf8',
],
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
'class' => yii\swiftmailer\Mailer::class,
'viewPath' => '@common/mail',
],
'security' => [
'passwordHashStrategy' => 'password_hash',
],
'redis' => [
'class' => 'yii\redis\Connection',
'class' => yii\redis\Connection::class,
],
'amqp' => [
'class' => \common\components\RabbitMQ\Component::class,