From 9d327baa8b2c80b53d4d405678f03e6b89ff6e38 Mon Sep 17 00:00:00 2001 From: Nikola Kovacs Date: Thu, 26 May 2016 11:19:32 +0200 Subject: [PATCH] coding style fixes --- framework/base/ActionFilter.php | 3 +- framework/base/Configurable.php | 1 - framework/behaviors/SluggableBehavior.php | 2 +- framework/captcha/Captcha.php | 2 +- framework/console/ErrorHandler.php | 2 +- framework/console/controllers/CacheController.php | 4 +- .../console/controllers/FixtureController.php | 3 +- .../console/controllers/MessageController.php | 34 +++++----- .../console/controllers/MigrateController.php | 4 +- framework/console/controllers/ServeController.php | 2 +- framework/db/ActiveQuery.php | 2 +- framework/db/BaseActiveRecord.php | 2 +- framework/db/cubrid/Schema.php | 2 +- framework/db/oci/Schema.php | 2 +- framework/db/pgsql/Schema.php | 2 +- framework/db/sqlite/ColumnSchemaBuilder.php | 1 - framework/grid/DataColumn.php | 4 +- framework/helpers/BaseInflector.php | 2 +- framework/helpers/BaseJson.php | 2 +- framework/i18n/DbMessageSource.php | 4 +- framework/i18n/Formatter.php | 72 ++++++++++++++-------- framework/messages/config.php | 2 +- framework/test/ArrayFixture.php | 1 - framework/validators/FileValidator.php | 13 ++-- framework/validators/ImageValidator.php | 10 +-- framework/validators/IpValidator.php | 8 ++- framework/web/MultiFieldSession.php | 2 +- framework/web/Request.php | 2 +- framework/web/UrlRule.php | 4 +- framework/web/User.php | 4 +- 30 files changed, 110 insertions(+), 88 deletions(-) diff --git a/framework/base/ActionFilter.php b/framework/base/ActionFilter.php index 8f33f4e..1c4c624 100644 --- a/framework/base/ActionFilter.php +++ b/framework/base/ActionFilter.php @@ -118,7 +118,8 @@ class ActionFilter extends Behavior * @return string * @since 2.0.7 */ - protected function getActionId($action) { + protected function getActionId($action) + { if ($this->owner instanceof Module) { $mid = $this->owner->getUniqueId(); $id = $action->getUniqueId(); diff --git a/framework/base/Configurable.php b/framework/base/Configurable.php index 37e7f31..b9a121d 100644 --- a/framework/base/Configurable.php +++ b/framework/base/Configurable.php @@ -29,4 +29,3 @@ namespace yii\base; interface Configurable { } - diff --git a/framework/behaviors/SluggableBehavior.php b/framework/behaviors/SluggableBehavior.php index f08ef23..fa1ad9c 100644 --- a/framework/behaviors/SluggableBehavior.php +++ b/framework/behaviors/SluggableBehavior.php @@ -223,7 +223,7 @@ class SluggableBehavior extends AttributeBehavior /* @var $model BaseActiveRecord */ $validator = Yii::createObject(array_merge( [ - 'class' => UniqueValidator::className() + 'class' => UniqueValidator::className(), ], $this->uniqueValidator )); diff --git a/framework/captcha/Captcha.php b/framework/captcha/Captcha.php index 58a74cc..12ab1c3 100644 --- a/framework/captcha/Captcha.php +++ b/framework/captcha/Captcha.php @@ -150,7 +150,7 @@ class Captcha extends InputWidget $options = [ 'refreshUrl' => Url::toRoute($route), - 'hashKey' => 'yiiCaptcha/' . trim($route[0], '/') + 'hashKey' => 'yiiCaptcha/' . trim($route[0], '/'), ]; return $options; diff --git a/framework/console/ErrorHandler.php b/framework/console/ErrorHandler.php index 712a7a5..c2ef846 100644 --- a/framework/console/ErrorHandler.php +++ b/framework/console/ErrorHandler.php @@ -75,4 +75,4 @@ class ErrorHandler extends \yii\base\ErrorHandler } return $message; } -} \ No newline at end of file +} diff --git a/framework/console/controllers/CacheController.php b/framework/console/controllers/CacheController.php index 9079eec..a2f6fe4 100644 --- a/framework/console/controllers/CacheController.php +++ b/framework/console/controllers/CacheController.php @@ -93,7 +93,7 @@ class CacheController extends Controller $cachesInfo[] = [ 'name' => $name, 'class' => $class, - 'is_flushed' => Yii::$app->get($name)->flush(), + 'is_flushed' => Yii::$app->get($name)->flush(), ]; } @@ -117,7 +117,7 @@ class CacheController extends Controller $cachesInfo[] = [ 'name' => $name, 'class' => $class, - 'is_flushed' => Yii::$app->get($name)->flush(), + 'is_flushed' => Yii::$app->get($name)->flush(), ]; } diff --git a/framework/console/controllers/FixtureController.php b/framework/console/controllers/FixtureController.php index 99ec476..79b7993 100644 --- a/framework/console/controllers/FixtureController.php +++ b/framework/console/controllers/FixtureController.php @@ -78,7 +78,7 @@ class FixtureController extends Controller { return array_merge(parent::optionAliases(), [ 'g' => 'globalFixtures', - 'n' => 'namespace' + 'n' => 'namespace', ]); } @@ -490,5 +490,4 @@ class FixtureController extends Controller { return Yii::getAlias('@' . str_replace('\\', '/', $this->namespace)); } - } diff --git a/framework/console/controllers/MessageController.php b/framework/console/controllers/MessageController.php index 29f30be..980c192 100644 --- a/framework/console/controllers/MessageController.php +++ b/framework/console/controllers/MessageController.php @@ -141,22 +141,22 @@ class MessageController extends Controller public function options($actionID) { return array_merge(parent::options($actionID), [ - 'sourcePath', - 'messagePath', - 'languages', - 'translator', - 'sort', - 'overwrite', - 'removeUnused', - 'markUnused', - 'except', - 'only', - 'format', - 'db', - 'sourceMessageTable', - 'messageTable', - 'catalog', - 'ignoreCategories' + 'sourcePath', + 'messagePath', + 'languages', + 'translator', + 'sort', + 'overwrite', + 'removeUnused', + 'markUnused', + 'except', + 'only', + 'format', + 'db', + 'sourceMessageTable', + 'messageTable', + 'catalog', + 'ignoreCategories', ]); } @@ -180,7 +180,7 @@ class MessageController extends Controller 't' => 'translator', 'm' => 'sourceMessageTable', 's' => 'sourcePath', - 'r' => 'removeUnused' + 'r' => 'removeUnused', ]); } diff --git a/framework/console/controllers/MigrateController.php b/framework/console/controllers/MigrateController.php index 11f5960..01aac89 100644 --- a/framework/console/controllers/MigrateController.php +++ b/framework/console/controllers/MigrateController.php @@ -80,7 +80,7 @@ class MigrateController extends BaseMigrateController 'drop_table' => '@yii/views/dropTableMigration.php', 'add_column' => '@yii/views/addColumnMigration.php', 'drop_column' => '@yii/views/dropColumnMigration.php', - 'create_junction' => '@yii/views/createTableMigration.php' + 'create_junction' => '@yii/views/createTableMigration.php', ]; /** * @var boolean indicates whether the table names generated should consider @@ -295,7 +295,7 @@ class MigrateController extends BaseMigrateController $foreignKeys[$column] = [ 'idx' => $this->generateTableName("idx-$table-$column"), 'fk' => $this->generateTableName("fk-$table-$column"), - 'relatedTable' => $this->generateTableName($relatedTable) + 'relatedTable' => $this->generateTableName($relatedTable), ]; } diff --git a/framework/console/controllers/ServeController.php b/framework/console/controllers/ServeController.php index daee73b..65ca37c 100644 --- a/framework/console/controllers/ServeController.php +++ b/framework/console/controllers/ServeController.php @@ -103,7 +103,7 @@ class ServeController extends Controller return array_merge(parent::optionAliases(), [ 't' => 'docroot', 'p' => 'port', - 'r' => 'router' + 'r' => 'router', ]); } diff --git a/framework/db/ActiveQuery.php b/framework/db/ActiveQuery.php index 49211a6..3a53a7a 100644 --- a/framework/db/ActiveQuery.php +++ b/framework/db/ActiveQuery.php @@ -405,7 +405,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface // relation is defined with an alias, adjust callback to apply alias list(, $relation, $alias) = $matches; $name = $relation; - $callback = function($query) use ($callback, $alias) { + $callback = function ($query) use ($callback, $alias) { /** @var $query ActiveQuery */ $query->alias($alias); if ($callback !== null) { diff --git a/framework/db/BaseActiveRecord.php b/framework/db/BaseActiveRecord.php index 75272f1..3606d5f 100644 --- a/framework/db/BaseActiveRecord.php +++ b/framework/db/BaseActiveRecord.php @@ -912,7 +912,7 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface public function afterSave($insert, $changedAttributes) { $this->trigger($insert ? self::EVENT_AFTER_INSERT : self::EVENT_AFTER_UPDATE, new AfterSaveEvent([ - 'changedAttributes' => $changedAttributes + 'changedAttributes' => $changedAttributes, ])); } diff --git a/framework/db/cubrid/Schema.php b/framework/db/cubrid/Schema.php index 84885c6..f70063c 100644 --- a/framework/db/cubrid/Schema.php +++ b/framework/db/cubrid/Schema.php @@ -155,7 +155,7 @@ class Schema extends \yii\db\Schema } else { $table->foreignKeys[$key['FK_NAME']] = [ $key['PKTABLE_NAME'], - $key['FKCOLUMN_NAME'] => $key['PKCOLUMN_NAME'] + $key['FKCOLUMN_NAME'] => $key['PKCOLUMN_NAME'], ]; } } diff --git a/framework/db/oci/Schema.php b/framework/db/oci/Schema.php index c0d3227..f65e608 100644 --- a/framework/db/oci/Schema.php +++ b/framework/db/oci/Schema.php @@ -213,7 +213,7 @@ SQL; $c->name = $column['COLUMN_NAME']; $c->allowNull = $column['NULLABLE'] === 'Y'; $c->comment = $column['COLUMN_COMMENT'] === null ? '' : $column['COLUMN_COMMENT']; - $c->isPrimaryKey = false; + $c->isPrimaryKey = false; $this->extractColumnType($c, $column['DATA_TYPE'], $column['DATA_PRECISION'], $column['DATA_SCALE'], $column['DATA_LENGTH']); $this->extractColumnSize($c, $column['DATA_TYPE'], $column['DATA_PRECISION'], $column['DATA_SCALE'], $column['DATA_LENGTH']); diff --git a/framework/db/pgsql/Schema.php b/framework/db/pgsql/Schema.php index b83fdcd..1e7d3b5 100644 --- a/framework/db/pgsql/Schema.php +++ b/framework/db/pgsql/Schema.php @@ -105,7 +105,7 @@ class Schema extends \yii\db\Schema 'uuid' => self::TYPE_STRING, 'json' => self::TYPE_STRING, 'jsonb' => self::TYPE_STRING, - 'xml' => self::TYPE_STRING + 'xml' => self::TYPE_STRING, ]; diff --git a/framework/db/sqlite/ColumnSchemaBuilder.php b/framework/db/sqlite/ColumnSchemaBuilder.php index 1c2da63..8ba7456 100644 --- a/framework/db/sqlite/ColumnSchemaBuilder.php +++ b/framework/db/sqlite/ColumnSchemaBuilder.php @@ -9,7 +9,6 @@ namespace yii\db\sqlite; use yii\db\ColumnSchemaBuilder as AbstractColumnSchemaBuilder; - /** * ColumnSchemaBuilder is the schema builder for Sqlite databases. * diff --git a/framework/grid/DataColumn.php b/framework/grid/DataColumn.php index dd06283..e1402b2 100644 --- a/framework/grid/DataColumn.php +++ b/framework/grid/DataColumn.php @@ -144,11 +144,11 @@ class DataColumn extends Column /* @var $model Model */ $model = new $provider->query->modelClass; $label = $model->getAttributeLabel($this->attribute); - } else if ($provider instanceof ArrayDataProvider && $provider->modelClass !== null) { + } elseif ($provider instanceof ArrayDataProvider && $provider->modelClass !== null) { /* @var $model Model */ $model = new $provider->modelClass; $label = $model->getAttributeLabel($this->attribute); - } else if ($this->grid->filterModel !== null && $this->grid->filterModel instanceof Model) { + } elseif ($this->grid->filterModel !== null && $this->grid->filterModel instanceof Model) { $label = $this->grid->filterModel->getAttributeLabel($this->attribute); } else { $models = $provider->getModels(); diff --git a/framework/helpers/BaseInflector.php b/framework/helpers/BaseInflector.php index 5c513d3..1e19d38 100644 --- a/framework/helpers/BaseInflector.php +++ b/framework/helpers/BaseInflector.php @@ -362,7 +362,7 @@ class BaseInflector $label = trim(strtolower(str_replace([ '-', '_', - '.' + '.', ], ' ', preg_replace('/(?where([ 't1.id' => new Expression('[[t2.id]]'), 't1.category' => $category, - 't2.language' => $language + 't2.language' => $language, ]); $fallbackLanguage = substr($language, 0, 2); @@ -181,7 +181,7 @@ class DbMessageSource extends MessageSource ->where([ 't1.id' => new Expression('[[t2.id]]'), 't1.category' => $category, - 't2.language' => $fallbackLanguage + 't2.language' => $fallbackLanguage, ])->andWhere([ 'NOT IN', 't2.id', (new Query())->select('[[id]]')->from($this->messageTable)->where(['language' => $language]) ]); diff --git a/framework/i18n/Formatter.php b/framework/i18n/Formatter.php index 8de3745..82018c6 100644 --- a/framework/i18n/Formatter.php +++ b/framework/i18n/Formatter.php @@ -1146,21 +1146,33 @@ class Formatter extends Component if ($this->sizeFormatBase == 1024) { switch ($position) { - case 0: return Yii::t('yii', '{nFormatted} B', $params, $this->locale); - case 1: return Yii::t('yii', '{nFormatted} KiB', $params, $this->locale); - case 2: return Yii::t('yii', '{nFormatted} MiB', $params, $this->locale); - case 3: return Yii::t('yii', '{nFormatted} GiB', $params, $this->locale); - case 4: return Yii::t('yii', '{nFormatted} TiB', $params, $this->locale); - default: return Yii::t('yii', '{nFormatted} PiB', $params, $this->locale); + case 0: + return Yii::t('yii', '{nFormatted} B', $params, $this->locale); + case 1: + return Yii::t('yii', '{nFormatted} KiB', $params, $this->locale); + case 2: + return Yii::t('yii', '{nFormatted} MiB', $params, $this->locale); + case 3: + return Yii::t('yii', '{nFormatted} GiB', $params, $this->locale); + case 4: + return Yii::t('yii', '{nFormatted} TiB', $params, $this->locale); + default: + return Yii::t('yii', '{nFormatted} PiB', $params, $this->locale); } } else { switch ($position) { - case 0: return Yii::t('yii', '{nFormatted} B', $params, $this->locale); - case 1: return Yii::t('yii', '{nFormatted} KB', $params, $this->locale); - case 2: return Yii::t('yii', '{nFormatted} MB', $params, $this->locale); - case 3: return Yii::t('yii', '{nFormatted} GB', $params, $this->locale); - case 4: return Yii::t('yii', '{nFormatted} TB', $params, $this->locale); - default: return Yii::t('yii', '{nFormatted} PB', $params, $this->locale); + case 0: + return Yii::t('yii', '{nFormatted} B', $params, $this->locale); + case 1: + return Yii::t('yii', '{nFormatted} KB', $params, $this->locale); + case 2: + return Yii::t('yii', '{nFormatted} MB', $params, $this->locale); + case 3: + return Yii::t('yii', '{nFormatted} GB', $params, $this->locale); + case 4: + return Yii::t('yii', '{nFormatted} TB', $params, $this->locale); + default: + return Yii::t('yii', '{nFormatted} PB', $params, $this->locale); } } } @@ -1190,21 +1202,33 @@ class Formatter extends Component if ($this->sizeFormatBase == 1024) { switch ($position) { - case 0: return Yii::t('yii', '{nFormatted} {n, plural, =1{byte} other{bytes}}', $params, $this->locale); - case 1: return Yii::t('yii', '{nFormatted} {n, plural, =1{kibibyte} other{kibibytes}}', $params, $this->locale); - case 2: return Yii::t('yii', '{nFormatted} {n, plural, =1{mebibyte} other{mebibytes}}', $params, $this->locale); - case 3: return Yii::t('yii', '{nFormatted} {n, plural, =1{gibibyte} other{gibibytes}}', $params, $this->locale); - case 4: return Yii::t('yii', '{nFormatted} {n, plural, =1{tebibyte} other{tebibytes}}', $params, $this->locale); - default: return Yii::t('yii', '{nFormatted} {n, plural, =1{pebibyte} other{pebibytes}}', $params, $this->locale); + case 0: + return Yii::t('yii', '{nFormatted} {n, plural, =1{byte} other{bytes}}', $params, $this->locale); + case 1: + return Yii::t('yii', '{nFormatted} {n, plural, =1{kibibyte} other{kibibytes}}', $params, $this->locale); + case 2: + return Yii::t('yii', '{nFormatted} {n, plural, =1{mebibyte} other{mebibytes}}', $params, $this->locale); + case 3: + return Yii::t('yii', '{nFormatted} {n, plural, =1{gibibyte} other{gibibytes}}', $params, $this->locale); + case 4: + return Yii::t('yii', '{nFormatted} {n, plural, =1{tebibyte} other{tebibytes}}', $params, $this->locale); + default: + return Yii::t('yii', '{nFormatted} {n, plural, =1{pebibyte} other{pebibytes}}', $params, $this->locale); } } else { switch ($position) { - case 0: return Yii::t('yii', '{nFormatted} {n, plural, =1{byte} other{bytes}}', $params, $this->locale); - case 1: return Yii::t('yii', '{nFormatted} {n, plural, =1{kilobyte} other{kilobytes}}', $params, $this->locale); - case 2: return Yii::t('yii', '{nFormatted} {n, plural, =1{megabyte} other{megabytes}}', $params, $this->locale); - case 3: return Yii::t('yii', '{nFormatted} {n, plural, =1{gigabyte} other{gigabytes}}', $params, $this->locale); - case 4: return Yii::t('yii', '{nFormatted} {n, plural, =1{terabyte} other{terabytes}}', $params, $this->locale); - default: return Yii::t('yii', '{nFormatted} {n, plural, =1{petabyte} other{petabytes}}', $params, $this->locale); + case 0: + return Yii::t('yii', '{nFormatted} {n, plural, =1{byte} other{bytes}}', $params, $this->locale); + case 1: + return Yii::t('yii', '{nFormatted} {n, plural, =1{kilobyte} other{kilobytes}}', $params, $this->locale); + case 2: + return Yii::t('yii', '{nFormatted} {n, plural, =1{megabyte} other{megabytes}}', $params, $this->locale); + case 3: + return Yii::t('yii', '{nFormatted} {n, plural, =1{gigabyte} other{gigabytes}}', $params, $this->locale); + case 4: + return Yii::t('yii', '{nFormatted} {n, plural, =1{terabyte} other{terabytes}}', $params, $this->locale); + default: + return Yii::t('yii', '{nFormatted} {n, plural, =1{petabyte} other{petabytes}}', $params, $this->locale); } } } diff --git a/framework/messages/config.php b/framework/messages/config.php index fbd456f..4efd6f8 100644 --- a/framework/messages/config.php +++ b/framework/messages/config.php @@ -7,7 +7,7 @@ return [ 'messagePath' => __DIR__, // array, required, list of language codes that the extracted messages // should be translated to. For example, ['zh-CN', 'de']. - 'languages' => ['ar', 'az', 'bg', 'bs', 'ca', 'cs', 'da', 'de', 'el', 'es', 'et', 'fa', 'fi', 'fr', 'he', 'hr', 'hu', 'id', 'it', 'ja', 'ka', 'kk', 'ko', 'lt', 'lv', 'ms', 'nb-NO', 'nl', 'pl', 'pt', 'pt-BR', 'ro', 'ru', 'sk', 'sl', 'sr', 'sr-Latn', 'sv', 'th', 'tj', 'uk', 'vi', 'zh-CN','zh-TW'], + 'languages' => ['ar', 'az', 'bg', 'bs', 'ca', 'cs', 'da', 'de', 'el', 'es', 'et', 'fa', 'fi', 'fr', 'he', 'hr', 'hu', 'id', 'it', 'ja', 'ka', 'kk', 'ko', 'lt', 'lv', 'ms', 'nb-NO', 'nl', 'pl', 'pt', 'pt-BR', 'ro', 'ru', 'sk', 'sl', 'sr', 'sr-Latn', 'sv', 'th', 'tj', 'uk', 'vi', 'zh-CN', 'zh-TW'], // string, the name of the function for translating messages. // Defaults to 'Yii::t'. This is used as a mark to find the messages to be // translated. You may use a string for single function name or an array for diff --git a/framework/test/ArrayFixture.php b/framework/test/ArrayFixture.php index 5109e19..09a6571 100644 --- a/framework/test/ArrayFixture.php +++ b/framework/test/ArrayFixture.php @@ -73,5 +73,4 @@ class ArrayFixture extends Fixture implements \IteratorAggregate, \ArrayAccess, parent::unload(); $this->data = []; } - } diff --git a/framework/validators/FileValidator.php b/framework/validators/FileValidator.php index a427570..5c6c9d1 100644 --- a/framework/validators/FileValidator.php +++ b/framework/validators/FileValidator.php @@ -236,8 +236,8 @@ class FileValidator extends Validator [ 'file' => $file->name, 'limit' => $this->getSizeLimit(), - 'formattedLimit' => Yii::$app->formatter->asShortSize($this->getSizeLimit()) - ] + 'formattedLimit' => Yii::$app->formatter->asShortSize($this->getSizeLimit()), + ], ]; } elseif ($this->minSize !== null && $file->size < $this->minSize) { return [ @@ -245,22 +245,21 @@ class FileValidator extends Validator [ 'file' => $file->name, 'limit' => $this->minSize, - 'formattedLimit' => Yii::$app->formatter->asShortSize($this->minSize) - ] + 'formattedLimit' => Yii::$app->formatter->asShortSize($this->minSize), + ], ]; } elseif (!empty($this->extensions) && !$this->validateExtension($file)) { return [$this->wrongExtension, ['file' => $file->name, 'extensions' => implode(', ', $this->extensions)]]; } elseif (!empty($this->mimeTypes) && !$this->validateMimeType($file)) { return [$this->wrongMimeType, ['file' => $file->name, 'mimeTypes' => implode(', ', $this->mimeTypes)]]; - } else { - return null; } + return null; case UPLOAD_ERR_INI_SIZE: case UPLOAD_ERR_FORM_SIZE: return [$this->tooBig, [ 'file' => $file->name, 'limit' => $this->getSizeLimit(), - 'formattedLimit' => Yii::$app->formatter->asShortSize($this->getSizeLimit()) + 'formattedLimit' => Yii::$app->formatter->asShortSize($this->getSizeLimit()), ]]; case UPLOAD_ERR_PARTIAL: Yii::warning('File was only partially uploaded: ' . $file->name, __METHOD__); diff --git a/framework/validators/ImageValidator.php b/framework/validators/ImageValidator.php index e2fd930..4e72f63 100644 --- a/framework/validators/ImageValidator.php +++ b/framework/validators/ImageValidator.php @@ -180,7 +180,7 @@ class ImageValidator extends FileValidator if ($this->notImage !== null) { $options['notImage'] = Yii::$app->getI18n()->format($this->notImage, [ - 'attribute' => $label + 'attribute' => $label, ], Yii::$app->language); } @@ -188,7 +188,7 @@ class ImageValidator extends FileValidator $options['minWidth'] = $this->minWidth; $options['underWidth'] = Yii::$app->getI18n()->format($this->underWidth, [ 'attribute' => $label, - 'limit' => $this->minWidth + 'limit' => $this->minWidth, ], Yii::$app->language); } @@ -196,7 +196,7 @@ class ImageValidator extends FileValidator $options['maxWidth'] = $this->maxWidth; $options['overWidth'] = Yii::$app->getI18n()->format($this->overWidth, [ 'attribute' => $label, - 'limit' => $this->maxWidth + 'limit' => $this->maxWidth, ], Yii::$app->language); } @@ -204,7 +204,7 @@ class ImageValidator extends FileValidator $options['minHeight'] = $this->minHeight; $options['underHeight'] = Yii::$app->getI18n()->format($this->underHeight, [ 'attribute' => $label, - 'limit' => $this->minHeight + 'limit' => $this->minHeight, ], Yii::$app->language); } @@ -212,7 +212,7 @@ class ImageValidator extends FileValidator $options['maxHeight'] = $this->maxHeight; $options['overHeight'] = Yii::$app->getI18n()->format($this->overHeight, [ 'attribute' => $label, - 'limit' => $this->maxHeight + 'limit' => $this->maxHeight, ], Yii::$app->language); } diff --git a/framework/validators/IpValidator.php b/framework/validators/IpValidator.php index e861565..455788a 100644 --- a/framework/validators/IpValidator.php +++ b/framework/validators/IpValidator.php @@ -455,7 +455,8 @@ class IpValidator extends Validator * - boolean: whether the string is negated * - string: the string without negation (when the negation were present) */ - private function parseNegatedRange ($string) { + private function parseNegatedRange($string) + { $isNegated = strpos($string, static::NEGATION_CHAR) === 0; return [$isNegated, $isNegated ? substr($string, strlen(static::NEGATION_CHAR)) : $string]; } @@ -470,7 +471,8 @@ class IpValidator extends Validator * @return array * @see networks */ - private function prepareRanges($ranges) { + private function prepareRanges($ranges) + { $result = []; foreach ($ranges as $string) { list($isRangeNegated, $range) = $this->parseNegatedRange($string); @@ -607,7 +609,7 @@ class IpValidator extends Validator 'ipv6' => (boolean)$this->ipv6, 'ipParsePattern' => new JsExpression(Html::escapeJsRegularExpression($this->getIpParsePattern())), 'negation' => $this->negation, - 'subnet' => $this->subnet + 'subnet' => $this->subnet, ]; if ($this->skipOnEmpty) { $options['skipOnEmpty'] = 1; diff --git a/framework/web/MultiFieldSession.php b/framework/web/MultiFieldSession.php index 03ed7c4..c43b80a 100644 --- a/framework/web/MultiFieldSession.php +++ b/framework/web/MultiFieldSession.php @@ -138,4 +138,4 @@ abstract class MultiFieldSession extends Session return isset($fields['data']) ? $fields['data'] : ''; } } -} \ No newline at end of file +} diff --git a/framework/web/Request.php b/framework/web/Request.php index 6398eb7..9ead092 100644 --- a/framework/web/Request.php +++ b/framework/web/Request.php @@ -1266,7 +1266,7 @@ class Request extends \yii\base\Request /** * Returns the token used to perform CSRF validation. * - * This token is generated in a way to prevent [BREACH attacks](http://breachattack.com/). It may be passed + * This token is generated in a way to prevent [BREACH attacks](http://breachattack.com/). It may be passed * along via a hidden field of an HTML form or an HTTP header value to support CSRF validation. * @param boolean $regenerate whether to regenerate CSRF token. When this parameter is true, each time * this method is called, a new CSRF token will be generated and persisted (in session or cookie). diff --git a/framework/web/UrlRule.php b/framework/web/UrlRule.php index 73aabce..5a78d1b 100644 --- a/framework/web/UrlRule.php +++ b/framework/web/UrlRule.php @@ -383,8 +383,8 @@ class UrlRule extends Object implements UrlRuleInterface * @see placeholders * @since 2.0.7 */ - protected function substitutePlaceholderNames (array $matches) - { + protected function substitutePlaceholderNames(array $matches) + { foreach ($this->placeholders as $placeholder => $name) { if (isset($matches[$placeholder])) { $matches[$name] = $matches[$placeholder]; diff --git a/framework/web/User.php b/framework/web/User.php index 36687e6..78ec442 100644 --- a/framework/web/User.php +++ b/framework/web/User.php @@ -544,7 +544,7 @@ class User extends Component } /** - * Determines if an identity cookie has a valid format and contains a valid auth key. + * Determines if an identity cookie has a valid format and contains a valid auth key. * This method is used when [[enableAutoLogin]] is true. * This method attempts to authenticate a user using the information in the identity cookie. * @return array|null Returns an array of 'identity' and 'duration' if valid, otherwise null. @@ -609,7 +609,7 @@ class User extends Component return; } - /* Ensure any existing identity cookies are removed. */ + /* Ensure any existing identity cookies are removed. */ if ($this->enableAutoLogin) { $this->removeIdentityCookie(); }