Implemented PHP-CS-Fixer support

This commit is contained in:
ErickSkrauch
2018-04-17 23:47:25 +03:00
parent bfdcaf2233
commit 02ea7346a8
115 changed files with 883 additions and 363 deletions

View File

@@ -17,7 +17,7 @@ abstract class AmqpController extends Controller {
private $reconnected = false;
public final function actionIndex() {
final public function actionIndex() {
$this->start();
}

View File

@@ -85,7 +85,7 @@ class CleanupController extends Controller {
$durationsMap = [];
foreach (EmailActivation::getClassMap() as $typeId => $className) {
/** @var EmailActivation $object */
$object = new $className;
$object = new $className();
/** @var \common\behaviors\EmailActivationExpirationBehavior $behavior */
$behavior = $object->getBehavior('expirationBehavior');
/** @noinspection NullPointerExceptionInspection */

View File

@@ -95,7 +95,7 @@ class RbacController extends Controller {
$authManager = $this->getAuthManager();
$permission = $authManager->createPermission($name);
if ($ruleClassName !== null) {
$rule = new $ruleClassName;
$rule = new $ruleClassName();
if (!$rule instanceof Rule) {
throw new InvalidArgumentException('ruleClassName must be rule class name');
}

View File

@@ -43,7 +43,7 @@ class Migration extends YiiMigration {
private function buildKey(array $columns) {
$key = '';
foreach ($columns as $i => $column) {
$key .= $i == count($columns) ? $column : "$column,";
$key .= $i === count($columns) ? $column : "$column,";
}
return $key;

View File

@@ -6,14 +6,14 @@ class m160201_055928_oauth extends Migration {
public function safeUp() {
$this->createTable('{{%oauth_clients}}', [
'id' => $this->string(64),
'secret' => $this->string()->notNull(),
'name' => $this->string()->notNull(),
'description' => $this->string(),
'id' => $this->string(64),
'secret' => $this->string()->notNull(),
'name' => $this->string()->notNull(),
'description' => $this->string(),
'redirect_uri' => $this->string()->notNull(),
'account_id' => $this->getDb()->getTableSchema('{{%accounts}}')->getColumn('id')->dbType,
'is_trusted' => $this->boolean()->defaultValue(false)->notNull(),
'created_at' => $this->integer()->notNull(),
'account_id' => $this->getDb()->getTableSchema('{{%accounts}}')->getColumn('id')->dbType,
'is_trusted' => $this->boolean()->defaultValue(false)->notNull(),
'created_at' => $this->integer()->notNull(),
$this->primary('id'),
], $this->tableOptions);
@@ -23,17 +23,17 @@ class m160201_055928_oauth extends Migration {
], $this->tableOptions);
$this->createTable('{{%oauth_sessions}}', [
'id' => $this->primaryKey(),
'owner_type' => $this->string()->notNull(),
'owner_id' => $this->string()->notNull(),
'client_id' => $this->getDb()->getTableSchema('{{%oauth_clients}}')->getColumn('id')->dbType,
'id' => $this->primaryKey(),
'owner_type' => $this->string()->notNull(),
'owner_id' => $this->string()->notNull(),
'client_id' => $this->getDb()->getTableSchema('{{%oauth_clients}}')->getColumn('id')->dbType,
'client_redirect_uri' => $this->string(),
], $this->tableOptions);
$this->createTable('{{%oauth_access_tokens}}', [
'access_token' => $this->string(64),
'session_id' => $this->getDb()->getTableSchema('{{%oauth_sessions}}')->getColumn('id')->dbType,
'expire_time' => $this->integer()->notNull(),
'session_id' => $this->getDb()->getTableSchema('{{%oauth_sessions}}')->getColumn('id')->dbType,
'expire_time' => $this->integer()->notNull(),
$this->primary('access_token'),
], $this->tableOptions);

View File

@@ -21,7 +21,7 @@ class m160414_231110_account_nicknames_history extends Migration {
FROM {{%accounts}}
')->queryAll();
foreach($accountNicknames as $row) {
foreach ($accountNicknames as $row) {
$this->insert('{{%usernames_history}}', [
'username' => $row['username'],
'account_id' => $row['id'],

View File

@@ -8,9 +8,9 @@ class m160819_211139_minecraft_access_tokens extends Migration {
$this->createTable('{{%minecraft_access_keys}}', [
'access_token' => $this->string(36)->notNull(),
'client_token' => $this->string(36)->notNull(),
'account_id' => $this->db->getTableSchema('{{%accounts}}')->getColumn('id')->dbType . ' NOT NULL',
'created_at' => $this->integer()->unsigned()->notNull(),
'updated_at' => $this->integer()->unsigned()->notNull(),
'account_id' => $this->db->getTableSchema('{{%accounts}}')->getColumn('id')->dbType . ' NOT NULL',
'created_at' => $this->integer()->unsigned()->notNull(),
'updated_at' => $this->integer()->unsigned()->notNull(),
]);
$this->addPrimaryKey('access_token', '{{%minecraft_access_keys}}', 'access_token');

View File

@@ -4,8 +4,6 @@ use console\db\Migration;
class m161030_013122_ely_by_admin_app extends Migration {
const APP_NAME = 'ely_admin';
public function safeUp() {
$exists = $this->db->createCommand('
SELECT COUNT(*)
@@ -13,12 +11,12 @@ class m161030_013122_ely_by_admin_app extends Migration {
WHERE id = :app_name
LIMIT 1
', [
'app_name' => self::APP_NAME,
'app_name' => 'ely_admin',
])->queryScalar();
if (!$exists) {
$this->insert('{{%oauth_clients}}', [
'id' => self::APP_NAME,
'id' => 'ely_admin',
'secret' => 'change_this_on_production',
'name' => 'Admin Ely.by',
'description' => '',
@@ -30,7 +28,7 @@ class m161030_013122_ely_by_admin_app extends Migration {
}
public function safeDown() {
$this->delete('{{%oauth_clients}}', ['id' => self::APP_NAME]);
$this->delete('{{%oauth_clients}}', ['id' => 'ely_admin']);
}
}

View File

@@ -12,8 +12,8 @@ class m161222_222520_remove_oauth_access_tokens extends Migration {
public function safeDown() {
$this->createTable('{{%oauth_access_tokens}}', [
'access_token' => $this->string(64),
'session_id' => $this->getDb()->getTableSchema('{{%oauth_sessions}}')->getColumn('id')->dbType,
'expire_time' => $this->integer()->notNull(),
'session_id' => $this->getDb()->getTableSchema('{{%oauth_sessions}}')->getColumn('id')->dbType,
'expire_time' => $this->integer()->notNull(),
$this->primary('access_token'),
], $this->tableOptions);