diff --git a/apps/advanced/common/models/LoginForm.php b/apps/advanced/common/models/LoginForm.php index 80a5f6a..6ec31f2 100644 --- a/apps/advanced/common/models/LoginForm.php +++ b/apps/advanced/common/models/LoginForm.php @@ -15,6 +15,7 @@ class LoginForm extends Model private $_user = false; + /** * @inheritdoc */ diff --git a/apps/advanced/frontend/models/ResetPasswordForm.php b/apps/advanced/frontend/models/ResetPasswordForm.php index 93d1a69..5ed3d2e 100644 --- a/apps/advanced/frontend/models/ResetPasswordForm.php +++ b/apps/advanced/frontend/models/ResetPasswordForm.php @@ -18,6 +18,7 @@ class ResetPasswordForm extends Model */ private $_user; + /** * Creates a form model given a token. * diff --git a/apps/basic/models/LoginForm.php b/apps/basic/models/LoginForm.php index 687d29d..7bd44d4 100644 --- a/apps/basic/models/LoginForm.php +++ b/apps/basic/models/LoginForm.php @@ -16,6 +16,7 @@ class LoginForm extends Model private $_user = false; + /** * @return array the validation rules. */ diff --git a/build/controllers/TranslationController.php b/build/controllers/TranslationController.php index d510de4..75a4d7d 100644 --- a/build/controllers/TranslationController.php +++ b/build/controllers/TranslationController.php @@ -128,14 +128,11 @@ class TranslationController extends Controller foreach ($lines as $key => $val) { if (mb_substr($val, 0, 1, 'utf-8') === '@') { $lines[$key] = '<span class="info">' . Html::encode($val) . '</span>'; - } - else if (mb_substr($val, 0, 1, 'utf-8') === '+') { + } elseif (mb_substr($val, 0, 1, 'utf-8') === '+') { $lines[$key] = '<ins>' . Html::encode($val) . '</ins>'; - } - else if (mb_substr($val, 0, 1, 'utf-8') === '-') { + } elseif (mb_substr($val, 0, 1, 'utf-8') === '-') { $lines[$key] = '<del>' . Html::encode($val) . '</del>'; - } - else { + } else { $lines[$key] = Html::encode($val); } } diff --git a/docs/internals/core-code-style.md b/docs/internals/core-code-style.md index 9db5adf..ef4c097 100644 --- a/docs/internals/core-code-style.md +++ b/docs/internals/core-code-style.md @@ -269,14 +269,14 @@ Use the following formatting for switch: ```php switch ($this->phpType) { case 'string': - $a = (string)$value; + $a = (string) $value; break; case 'integer': case 'int': - $a = (integer)$value; + $a = (int) $value; break; case 'boolean': - $a = (boolean)$value; + $a = (bool) $value; break; default: $a = null; diff --git a/extensions/authclient/AuthAction.php b/extensions/authclient/AuthAction.php index 0d7245e..549b0d6 100644 --- a/extensions/authclient/AuthAction.php +++ b/extensions/authclient/AuthAction.php @@ -86,6 +86,12 @@ class AuthAction extends Action */ public $successCallback; /** + * @var string name or alias of the view file, which should be rendered in order to perform redirection. + * If not set default one will be used. + */ + public $redirectView; + + /** * @var string the redirect url after successful authorization. */ private $_successUrl = ''; @@ -96,12 +102,6 @@ class AuthAction extends Action /** - * @var string name or alias of the view file, which should be rendered in order to perform redirection. - * If not set default one will be used. - */ - public $redirectView; - - /** * @param string $url successful URL. */ public function setSuccessUrl($url) diff --git a/extensions/authclient/OAuthToken.php b/extensions/authclient/OAuthToken.php index f40ad27..d366172 100644 --- a/extensions/authclient/OAuthToken.php +++ b/extensions/authclient/OAuthToken.php @@ -35,6 +35,11 @@ class OAuthToken extends Object */ public $tokenSecretParamKey = 'oauth_token_secret'; /** + * @var integer object creation timestamp. + */ + public $createTimestamp; + + /** * @var string key in [[params]] array, which stores token expiration duration. * If not set will attempt to fetch its value automatically. */ @@ -45,11 +50,6 @@ class OAuthToken extends Object private $_params = []; - /** - * @var integer object creation timestamp. - */ - public $createTimestamp; - public function init() { if ($this->createTimestamp === null) { diff --git a/extensions/authclient/OpenId.php b/extensions/authclient/OpenId.php index fc82936..b0471bc 100644 --- a/extensions/authclient/OpenId.php +++ b/extensions/authclient/OpenId.php @@ -82,20 +82,6 @@ class OpenId extends BaseClient implements ClientInterface */ public $cainfo; /** - * @var string authentication return URL. - */ - private $_returnUrl; - /** - * @var string claimed identifier (identity) - */ - private $_claimedId; - /** - * @var string client trust root (realm), by default [[\yii\web\Request::hostInfo]] value will be used. - */ - private $_trustRoot; - - - /** * @var array data, which should be used to retrieve the OpenID response. * If not set combination of GET and POST will be used. */ @@ -116,6 +102,20 @@ class OpenId extends BaseClient implements ClientInterface ]; /** + * @var string authentication return URL. + */ + private $_returnUrl; + /** + * @var string claimed identifier (identity) + */ + private $_claimedId; + /** + * @var string client trust root (realm), by default [[\yii\web\Request::hostInfo]] value will be used. + */ + private $_trustRoot; + + + /** * @inheritdoc */ public function init() diff --git a/extensions/authclient/signature/RsaSha1.php b/extensions/authclient/signature/RsaSha1.php index ae75af9..c950c4e 100644 --- a/extensions/authclient/signature/RsaSha1.php +++ b/extensions/authclient/signature/RsaSha1.php @@ -24,6 +24,15 @@ use yii\base\NotSupportedException; class RsaSha1 extends BaseMethod { /** + * @var string path to the file, which holds private key certificate. + */ + public $privateCertificateFile = ''; + /** + * @var string path to the file, which holds public key certificate. + */ + public $publicCertificateFile = ''; + + /** * @var string OpenSSL private key certificate content. * This value can be fetched from file specified by [[privateCertificateFile]]. */ @@ -36,15 +45,6 @@ class RsaSha1 extends BaseMethod /** - * @var string path to the file, which holds private key certificate. - */ - public $privateCertificateFile = ''; - /** - * @var string path to the file, which holds public key certificate. - */ - public $publicCertificateFile = ''; - - /** * @inheritdoc */ public function init() diff --git a/extensions/bootstrap/ActiveField.php b/extensions/bootstrap/ActiveField.php index f24d775..ac7de5f 100644 --- a/extensions/bootstrap/ActiveField.php +++ b/extensions/bootstrap/ActiveField.php @@ -92,7 +92,7 @@ use yii\helpers\ArrayHelper; class ActiveField extends \yii\widgets\ActiveField { /** - * @var bool whether to render [[checkboxList()]] and [[radioList()]] inline. + * @var boolean whether to render [[checkboxList()]] and [[radioList()]] inline. */ public $inline = false; /** @@ -137,11 +137,11 @@ class ActiveField extends \yii\widgets\ActiveField */ public $inlineRadioListTemplate = "{label}\n{beginWrapper}\n{input}\n{error}\n{endWrapper}\n{hint}"; /** - * @var bool whether to render the error. Default is `true` except for layout `inline`. + * @var boolean whether to render the error. Default is `true` except for layout `inline`. */ public $enableError = true; /** - * @var bool whether to render the label. Default is `true`. + * @var boolean whether to render the label. Default is `true`. */ public $enableLabel = true; @@ -303,13 +303,13 @@ class ActiveField extends \yii\widgets\ActiveField } /** - * @param bool $value whether to render a inline list + * @param boolean $value whether to render a inline list * @return static the field object itself * Make sure you call this method before [[checkboxList()]] or [[radioList()]] to have any effect. */ public function inline($value = true) { - $this->inline = (bool)$value; + $this->inline = (bool) $value; return $this; } diff --git a/extensions/debug/LogTarget.php b/extensions/debug/LogTarget.php index ab7e42d..84c6278 100644 --- a/extensions/debug/LogTarget.php +++ b/extensions/debug/LogTarget.php @@ -139,7 +139,7 @@ class LogTarget extends Target $summary = [ 'tag' => $this->tag, 'url' => $request->getAbsoluteUrl(), - 'ajax' => (int)$request->getIsAjax(), + 'ajax' => (int) $request->getIsAjax(), 'method' => $request->getMethod(), 'ip' => $request->getUserIP(), 'time' => time(), diff --git a/extensions/faker/FixtureController.php b/extensions/faker/FixtureController.php index 4c5a191..ccf5d7e 100644 --- a/extensions/faker/FixtureController.php +++ b/extensions/faker/FixtureController.php @@ -138,7 +138,6 @@ use yii\helpers\VarDumper; */ class FixtureController extends \yii\console\controllers\FixtureController { - /** * @var string Alias to the template path, where all tables templates are stored. */ diff --git a/extensions/gii/console/GenerateAction.php b/extensions/gii/console/GenerateAction.php index 4aa6ffc..ff9637d 100644 --- a/extensions/gii/console/GenerateAction.php +++ b/extensions/gii/console/GenerateAction.php @@ -102,7 +102,7 @@ class GenerateAction extends \yii\base\Action return; } - if ($this->generator->save($files, (array)$answers, $results)) { + if ($this->generator->save($files, (array) $answers, $results)) { $this->controller->stdout("\nFiles were generated successfully!\n", Console::FG_GREEN); } else { $this->controller->stdout("\nSome errors occurred while generating the files.", Console::FG_RED); diff --git a/extensions/mongodb/Migration.php b/extensions/mongodb/Migration.php index 265f2fa..1897a99 100644 --- a/extensions/mongodb/Migration.php +++ b/extensions/mongodb/Migration.php @@ -89,7 +89,7 @@ abstract class Migration extends Component implements MigrationInterface */ public function createIndex($collection, $columns, $options = []) { - echo " > create index on " . $this->composeCollectionLogName($collection) . " (" . Json::encode((array)$columns) . empty($options) ? "" : ", " . Json::encode($options) . ") ..."; + echo " > create index on " . $this->composeCollectionLogName($collection) . " (" . Json::encode((array) $columns) . empty($options) ? "" : ", " . Json::encode($options) . ") ..."; $time = microtime(true); $this->db->getCollection($collection)->createIndex($columns, $options); echo " done (time: " . sprintf('%.3f', microtime(true) - $time) . "s)\n"; @@ -102,7 +102,7 @@ abstract class Migration extends Component implements MigrationInterface */ public function dropIndex($collection, $columns) { - echo " > drop index on " . $this->composeCollectionLogName($collection) . " (" . Json::encode((array)$columns) . ") ..."; + echo " > drop index on " . $this->composeCollectionLogName($collection) . " (" . Json::encode((array) $columns) . ") ..."; $time = microtime(true); $this->db->getCollection($collection)->dropIndex($columns); echo " done (time: " . sprintf('%.3f', microtime(true) - $time) . "s)\n"; diff --git a/extensions/mongodb/README.md b/extensions/mongodb/README.md index 19171b5..445962c 100644 --- a/extensions/mongodb/README.md +++ b/extensions/mongodb/README.md @@ -81,7 +81,7 @@ To get actual Mongo ID string your should typecast [[\MongoId]] instance to stri $query = new Query; $row = $query->from('customer')->one(); var_dump($row['_id']); // outputs: "object(MongoId)" -var_dump((string)$row['_id']); // outputs "string 'acdfgdacdhcbdafa'" +var_dump((string) $row['_id']); // outputs "string 'acdfgdacdhcbdafa'" ``` Although this fact is very useful sometimes, it often produces some problems. @@ -90,7 +90,7 @@ In these cases, ensure you have converted [[\MongoId]] into the string: ```php /* @var $this yii\web\View */ -echo $this->createUrl(['item/update', 'id' => (string)$row['_id']]); +echo $this->createUrl(['item/update', 'id' => (string) $row['_id']]); ``` While building condition, values for the key '_id' will be automatically cast to [[\MongoId]] instance, diff --git a/extensions/redis/ActiveRecord.php b/extensions/redis/ActiveRecord.php index 3a4129d..81f71dc 100644 --- a/extensions/redis/ActiveRecord.php +++ b/extensions/redis/ActiveRecord.php @@ -124,7 +124,7 @@ class ActiveRecord extends BaseActiveRecord // only insert attributes that are not null if ($value !== null) { if (is_bool($value)) { - $value = (int)$value; + $value = (int) $value; } $setArgs[] = $attribute; $setArgs[] = $value; @@ -175,7 +175,7 @@ class ActiveRecord extends BaseActiveRecord } if ($value !== null) { if (is_bool($value)) { - $value = (int)$value; + $value = (int) $value; } $setArgs[] = $attribute; $setArgs[] = $value; diff --git a/extensions/redis/LuaScriptBuilder.php b/extensions/redis/LuaScriptBuilder.php index d93ed56..2ba8111 100644 --- a/extensions/redis/LuaScriptBuilder.php +++ b/extensions/redis/LuaScriptBuilder.php @@ -270,7 +270,7 @@ EOF; $parts[] = $this->buildInCondition('in', [$column, $value], $columns); } else { if (is_bool($value)) { - $value = (int)$value; + $value = (int) $value; } if ($value === null) { $parts[] = "redis.call('HEXISTS',key .. ':a:' .. pk, ".$this->quoteValue($column).")==0"; diff --git a/extensions/smarty/Extension.php b/extensions/smarty/Extension.php index 9c55ecb..15958e4 100644 --- a/extensions/smarty/Extension.php +++ b/extensions/smarty/Extension.php @@ -26,7 +26,6 @@ class Extension * @var ViewRenderer */ protected $viewRenderer; - /** * @var Smarty */ diff --git a/extensions/smarty/ViewRenderer.php b/extensions/smarty/ViewRenderer.php index 5f79014..d72ddab 100644 --- a/extensions/smarty/ViewRenderer.php +++ b/extensions/smarty/ViewRenderer.php @@ -32,7 +32,6 @@ class ViewRenderer extends BaseViewRenderer * @var string the directory or path alias pointing to where Smarty compiled templates will be stored. */ public $compilePath = '@runtime/Smarty/compile'; - /** * @var array Add additional directories to Smarty's search path for plugins. */ @@ -46,21 +45,20 @@ class ViewRenderer extends BaseViewRenderer */ public $widgets = ['functions' => [], 'blocks' => []]; /** - * @var Smarty The Smarty object used for rendering - */ - protected $smarty; - - /** * @var array additional Smarty options * @see http://www.smarty.net/docs/en/api.variables.tpl */ public $options = []; - /** * @var string extension class name */ public $extensionClass = '\yii\smarty\Extension'; + /** + * @var Smarty The Smarty object used for rendering + */ + protected $smarty; + /** * Instantiates and configures the Smarty object. diff --git a/extensions/sphinx/ColumnSchema.php b/extensions/sphinx/ColumnSchema.php index 3c7632c..c8afb1c 100644 --- a/extensions/sphinx/ColumnSchema.php +++ b/extensions/sphinx/ColumnSchema.php @@ -73,9 +73,9 @@ class ColumnSchema extends Object case 'string': return is_resource($value) ? $value : (string) $value; case 'integer': - return (integer) $value; + return (int) $value; case 'boolean': - return (boolean) $value; + return (bool) $value; case 'double': return (double) $value; } diff --git a/extensions/sphinx/QueryBuilder.php b/extensions/sphinx/QueryBuilder.php index 99a0f16..801cc3f 100644 --- a/extensions/sphinx/QueryBuilder.php +++ b/extensions/sphinx/QueryBuilder.php @@ -822,7 +822,7 @@ class QueryBuilder extends Object if ($values instanceof Query) { // sub-query list($sql, $params) = $this->build($values, $params); - $column = (array)$column; + $column = (array) $column; if (is_array($column)) { foreach ($column as $i => $col) { if (strpos($col, '(') === false) { diff --git a/extensions/sphinx/Schema.php b/extensions/sphinx/Schema.php index 83fbb96..ea340da 100644 --- a/extensions/sphinx/Schema.php +++ b/extensions/sphinx/Schema.php @@ -43,6 +43,7 @@ class Schema extends Object * @var Connection the Sphinx connection */ public $db; + /** * @var array list of ALL index names in the Sphinx */ diff --git a/extensions/twig/Extension.php b/extensions/twig/Extension.php index d8d9581..4fdde15 100644 --- a/extensions/twig/Extension.php +++ b/extensions/twig/Extension.php @@ -159,7 +159,7 @@ class Extension extends \Twig_Extension public function addUses($args) { - foreach ((array)$args as $key => $value) { + foreach ((array) $args as $key => $value) { $value = str_replace('/', '\\', $value); if (is_int($key)) { // namespace or class import diff --git a/framework/base/Security.php b/framework/base/Security.php index ab98084..eac00a5 100644 --- a/framework/base/Security.php +++ b/framework/base/Security.php @@ -176,7 +176,7 @@ class Security extends Component /** * Encrypts data. * @param string $data data to be encrypted - * @param bool $passwordBased set true to use password-based key derivation + * @param boolean $passwordBased set true to use password-based key derivation * @param string $secret the encryption password or key * @param string $info context/application specific information, e.g. a user ID * See [RFC 5869 Section 3.2](https://tools.ietf.org/html/rfc5869#section-3.2) for more details. @@ -217,7 +217,7 @@ class Security extends Component /** * Decrypts data. * @param string $data encrypted data to be decrypted. - * @param bool $passwordBased set true to use password-based key derivation + * @param boolean $passwordBased set true to use password-based key derivation * @param string $secret the decryption password or key * @param string $info context/application specific information, @see encrypt() * @return bool|string the decrypted data or false on authentication failure @@ -290,7 +290,7 @@ class Security extends Component * @param string $info optional info to bind the derived key material to application- * and context-specific information, e.g. a user ID or API version, see * [RFC 5869](https://tools.ietf.org/html/rfc5869) - * @param int $length length of the output key in bytes. If 0, the output key is + * @param integer $length length of the output key in bytes. If 0, the output key is * the length of the hash algorithm output. * @throws InvalidParamException when HMAC generation fails. * @return string the derived key @@ -335,9 +335,9 @@ class Security extends Component * @param string $algo a hash algorithm supported by `hash_hmac()`, e.g. 'SHA-256' * @param string $password the source password * @param string $salt the random salt - * @param int $iterations the number of iterations of the hash algorithm. Set as high as + * @param integer $iterations the number of iterations of the hash algorithm. Set as high as * possible to hinder dictionary password attacks. - * @param int $length length of the output key in bytes. If 0, the output key is + * @param integer $length length of the output key in bytes. If 0, the output key is * the length of the hash algorithm output. * @return string the derived key * @throws InvalidParamException when hash generation fails due to invalid params given. @@ -595,7 +595,7 @@ class Security extends Component */ protected function generateSalt($cost = 13) { - $cost = (int)$cost; + $cost = (int) $cost; if ($cost < 4 || $cost > 31) { throw new InvalidParamException('Cost must be between 4 and 31.'); } diff --git a/framework/behaviors/SluggableBehavior.php b/framework/behaviors/SluggableBehavior.php index 97310c7..0e099df 100644 --- a/framework/behaviors/SluggableBehavior.php +++ b/framework/behaviors/SluggableBehavior.php @@ -128,7 +128,7 @@ class SluggableBehavior extends AttributeBehavior $isNewSlug = true; if ($this->attribute !== null) { - $attributes = (array)$this->attribute; + $attributes = (array) $this->attribute; /* @var $owner BaseActiveRecord */ $owner = $this->owner; if (!$owner->getIsNewRecord() && !empty($owner->{$this->slugAttribute})) { diff --git a/framework/caching/TagDependency.php b/framework/caching/TagDependency.php index 9aa75c5..5caa8fa 100644 --- a/framework/caching/TagDependency.php +++ b/framework/caching/TagDependency.php @@ -65,7 +65,7 @@ class TagDependency extends Dependency public static function invalidate($cache, $tags) { $keys = []; - foreach ((array)$tags as $tag) { + foreach ((array) $tags as $tag) { $keys[] = $cache->buildKey([__CLASS__, $tag]); } static::touchKeys($cache, $keys); diff --git a/framework/console/controllers/AssetController.php b/framework/console/controllers/AssetController.php index 95a43ae..fb1dc78 100644 --- a/framework/console/controllers/AssetController.php +++ b/framework/console/controllers/AssetController.php @@ -601,7 +601,7 @@ EOD; /** * Creates template of configuration file for [[actionCompress]]. * @param string $configFile output file name. - * @return int CLI exit code + * @return integer CLI exit code * @throws \yii\console\Exception on failure. */ public function actionTemplate($configFile) diff --git a/framework/console/controllers/BaseMigrateController.php b/framework/console/controllers/BaseMigrateController.php index 7cf8e3a..bf49f01 100644 --- a/framework/console/controllers/BaseMigrateController.php +++ b/framework/console/controllers/BaseMigrateController.php @@ -302,7 +302,7 @@ abstract class BaseMigrateController extends Controller * * @param string $version the version at which the migration history should be marked. * This can be either the timestamp or the full name of the migration. - * @return int CLI exit code + * @return integer CLI exit code * @throws Exception if the version argument is invalid or the version cannot be found. */ public function actionMark($version) @@ -562,7 +562,7 @@ abstract class BaseMigrateController extends Controller /** * Migrates to the certain version. * @param string $version name in the full format. - * @return int CLI exit code + * @return integer CLI exit code * @throws Exception if the provided version cannot be found. */ protected function migrateToVersion($version) diff --git a/framework/console/controllers/FixtureController.php b/framework/console/controllers/FixtureController.php index 27cf47e..15a2b4a 100644 --- a/framework/console/controllers/FixtureController.php +++ b/framework/console/controllers/FixtureController.php @@ -55,7 +55,7 @@ class FixtureController extends Controller */ public $namespace = 'tests\unit\fixtures'; /** - * @var bool whether to append new fixture data to the existing ones. + * @var boolean whether to append new fixture data to the existing ones. * Defaults to false, meaning if there is any existing fixture data, it will be removed. */ public $append = false; diff --git a/framework/console/controllers/MessageController.php b/framework/console/controllers/MessageController.php index e5ab688..8c52010 100644 --- a/framework/console/controllers/MessageController.php +++ b/framework/console/controllers/MessageController.php @@ -50,7 +50,7 @@ class MessageController extends Controller * you may use this configuration file with the "extract" command. * * @param string $filePath output file name or alias. - * @return int CLI exit code + * @return integer CLI exit code * @throws Exception on failure. */ public function actionConfig($filePath) diff --git a/framework/db/ActiveQuery.php b/framework/db/ActiveQuery.php index 8f7f87f..64188a0 100644 --- a/framework/db/ActiveQuery.php +++ b/framework/db/ActiveQuery.php @@ -152,7 +152,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface } if (empty($this->select) && !empty($this->join)) { - foreach ((array)$this->from as $alias => $table) { + foreach ((array) $this->from as $alias => $table) { if (is_string($alias)) { $this->select = ["$alias.*"]; } elseif (is_string($table)) { diff --git a/framework/db/ColumnSchema.php b/framework/db/ColumnSchema.php index 128bc38..447ae25 100644 --- a/framework/db/ColumnSchema.php +++ b/framework/db/ColumnSchema.php @@ -98,9 +98,9 @@ class ColumnSchema extends Object case 'string': return is_resource($value) ? $value : (string) $value; case 'integer': - return (integer) $value; + return (int) $value; case 'boolean': - return (boolean) $value; + return (bool) $value; case 'double': return (double) $value; } diff --git a/framework/db/Connection.php b/framework/db/Connection.php index 7e16f60..5cf61a9 100644 --- a/framework/db/Connection.php +++ b/framework/db/Connection.php @@ -531,7 +531,7 @@ class Connection extends Component Yii::endProfile($token, __METHOD__); } catch (\PDOException $e) { Yii::endProfile($token, __METHOD__); - throw new Exception($e->getMessage(), $e->errorInfo, (int)$e->getCode(), $e); + throw new Exception($e->getMessage(), $e->errorInfo, (int) $e->getCode(), $e); } } diff --git a/framework/db/QueryBuilder.php b/framework/db/QueryBuilder.php index 77a700e..d5521c8 100644 --- a/framework/db/QueryBuilder.php +++ b/framework/db/QueryBuilder.php @@ -680,7 +680,7 @@ class QueryBuilder extends \yii\base\Object } // 0:join type, 1:join table, 2:on-condition (optional) list ($joinType, $table) = $join; - $tables = $this->quoteTableNames((array)$table, $params); + $tables = $this->quoteTableNames((array) $table, $params); $table = reset($tables); $joins[$i] = "$joinType $table"; if (isset($join[2])) { @@ -1055,7 +1055,7 @@ class QueryBuilder extends \yii\base\Object if ($values instanceof Query) { // sub-query list($sql, $params) = $this->build($values, $params); - $column = (array)$column; + $column = (array) $column; if (is_array($column)) { foreach ($column as $i => $col) { if (strpos($col, '(') === false) { diff --git a/framework/db/pgsql/Schema.php b/framework/db/pgsql/Schema.php index 8ccfa72..37a30c1 100644 --- a/framework/db/pgsql/Schema.php +++ b/framework/db/pgsql/Schema.php @@ -425,7 +425,7 @@ SQL; $column->name = $info['column_name']; $column->precision = $info['numeric_precision']; $column->scale = $info['numeric_scale']; - $column->size = $info['size'] === null ? null : (int)$info['size']; + $column->size = $info['size'] === null ? null : (int) $info['size']; if (isset($this->typeMap[$column->dbType])) { $column->type = $this->typeMap[$column->dbType]; } else { diff --git a/framework/db/sqlite/QueryBuilder.php b/framework/db/sqlite/QueryBuilder.php index e1a1284..4014d9b 100644 --- a/framework/db/sqlite/QueryBuilder.php +++ b/framework/db/sqlite/QueryBuilder.php @@ -150,7 +150,7 @@ class QueryBuilder extends \yii\db\QueryBuilder */ public function checkIntegrity($check = true, $schema = '', $table = '') { - return 'PRAGMA foreign_keys='.(int)$check; + return 'PRAGMA foreign_keys='.(int) $check; } /** diff --git a/framework/grid/CheckboxColumn.php b/framework/grid/CheckboxColumn.php index 7be244d..32e8f7b 100644 --- a/framework/grid/CheckboxColumn.php +++ b/framework/grid/CheckboxColumn.php @@ -50,7 +50,7 @@ class CheckboxColumn extends Column */ public $checkboxOptions = []; /** - * @var bool whether it is possible to select multiple rows. Defaults to `true`. + * @var boolean whether it is possible to select multiple rows. Defaults to `true`. */ public $multiple = true; diff --git a/framework/grid/GridView.php b/framework/grid/GridView.php index 75dc71f..4804f20 100644 --- a/framework/grid/GridView.php +++ b/framework/grid/GridView.php @@ -459,7 +459,7 @@ class GridView extends BaseListView } else { $options = $this->rowOptions; } - $options['data-key'] = is_array($key) ? json_encode($key) : (string)$key; + $options['data-key'] = is_array($key) ? json_encode($key) : (string) $key; return Html::tag('tr', implode('', $cells), $options); } diff --git a/framework/helpers/BaseConsole.php b/framework/helpers/BaseConsole.php index 2b78fe0..dc65a0a 100644 --- a/framework/helpers/BaseConsole.php +++ b/framework/helpers/BaseConsole.php @@ -332,7 +332,7 @@ class BaseConsole /** * Returns the length of the string without ANSI color codes. * @param string $string the string to measure - * @return int the length of the string not counting ANSI format characters + * @return integer the length of the string not counting ANSI format characters */ public static function ansiStrlen($string) { return mb_strlen(static::stripAnsiFormat($string)); diff --git a/framework/helpers/BaseFileHelper.php b/framework/helpers/BaseFileHelper.php index b9d2dde..a12101b 100644 --- a/framework/helpers/BaseFileHelper.php +++ b/framework/helpers/BaseFileHelper.php @@ -33,6 +33,7 @@ class BaseFileHelper */ public static $mimeMagicFile = '@yii/helpers/mimeTypes.php'; + /** * Normalizes a file/directory path. * The normalization does the following work: diff --git a/framework/helpers/BaseHtml.php b/framework/helpers/BaseHtml.php index 4d17db5..39f7066 100644 --- a/framework/helpers/BaseHtml.php +++ b/framework/helpers/BaseHtml.php @@ -636,7 +636,7 @@ class BaseHtml */ public static function radio($name, $checked = false, $options = []) { - $options['checked'] = (boolean) $checked; + $options['checked'] = (bool) $checked; $value = array_key_exists('value', $options) ? $options['value'] : '1'; if (isset($options['uncheck'])) { // add a hidden field so that if the radio button is not selected, it still submits a value @@ -678,7 +678,7 @@ class BaseHtml */ public static function checkbox($name, $checked = false, $options = []) { - $options['checked'] = (boolean) $checked; + $options['checked'] = (bool) $checked; $value = array_key_exists('value', $options) ? $options['value'] : '1'; if (isset($options['uncheck'])) { // add a hidden field so that if the checkbox is not selected, it still submits a value diff --git a/framework/helpers/BaseInflector.php b/framework/helpers/BaseInflector.php index def691a..64d7a0f 100644 --- a/framework/helpers/BaseInflector.php +++ b/framework/helpers/BaseInflector.php @@ -238,6 +238,7 @@ class BaseInflector */ public static $transliterator = 'Any-Latin; NFKD'; + /** * Converts a word to its plural form. * Note that this is for English only! diff --git a/framework/helpers/BaseUrl.php b/framework/helpers/BaseUrl.php index 8b9418b..f525bb3 100644 --- a/framework/helpers/BaseUrl.php +++ b/framework/helpers/BaseUrl.php @@ -81,7 +81,7 @@ class BaseUrl */ public static function toRoute($route, $scheme = false) { - $route = (array)$route; + $route = (array) $route; $route[0] = static::normalizeRoute($route[0]); if ($scheme) { diff --git a/framework/mutex/MysqlMutex.php b/framework/mutex/MysqlMutex.php index 1a82111..6c45e25 100644 --- a/framework/mutex/MysqlMutex.php +++ b/framework/mutex/MysqlMutex.php @@ -57,7 +57,7 @@ class MysqlMutex extends DbMutex */ protected function acquireLock($name, $timeout = 0) { - return (boolean) $this->db + return (bool) $this->db ->createCommand('SELECT GET_LOCK(:name, :timeout)', [':name' => $name, ':timeout' => $timeout]) ->queryScalar(); } @@ -70,7 +70,7 @@ class MysqlMutex extends DbMutex */ protected function releaseLock($name) { - return (boolean) $this->db + return (bool) $this->db ->createCommand('SELECT RELEASE_LOCK(:name)', [':name' => $name]) ->queryScalar(); } diff --git a/framework/rbac/DbManager.php b/framework/rbac/DbManager.php index 775c6e8..8eca7ed 100644 --- a/framework/rbac/DbManager.php +++ b/framework/rbac/DbManager.php @@ -349,7 +349,7 @@ class DbManager extends BaseManager $query = (new Query)->select('b.*') ->from(['a' => $this->assignmentTable, 'b' => $this->itemTable]) ->where('a.item_name=b.name') - ->andWhere(['a.user_id' => (string)$userId]); + ->andWhere(['a.user_id' => (string) $userId]); $roles = []; foreach ($query->all($this->db) as $row) { @@ -391,7 +391,7 @@ class DbManager extends BaseManager $query = (new Query)->select('item_name') ->from($this->assignmentTable) - ->where(['user_id' => (string)$userId]); + ->where(['user_id' => (string) $userId]); $childrenList = $this->getChildrenList(); $result = []; @@ -482,7 +482,7 @@ class DbManager extends BaseManager } $row = (new Query)->from($this->assignmentTable) - ->where(['user_id' => (string)$userId, 'item_name' => $roleName]) + ->where(['user_id' => (string) $userId, 'item_name' => $roleName]) ->one($this->db); if ($row === false) { @@ -507,7 +507,7 @@ class DbManager extends BaseManager $query = (new Query) ->from($this->assignmentTable) - ->where(['user_id' => (string)$userId]); + ->where(['user_id' => (string) $userId]); $assignments = []; foreach ($query->all($this->db) as $row) { @@ -644,7 +644,7 @@ class DbManager extends BaseManager } return $this->db->createCommand() - ->delete($this->assignmentTable, ['user_id' => (string)$userId, 'item_name' => $role->name]) + ->delete($this->assignmentTable, ['user_id' => (string) $userId, 'item_name' => $role->name]) ->execute() > 0; } @@ -658,7 +658,7 @@ class DbManager extends BaseManager } return $this->db->createCommand() - ->delete($this->assignmentTable, ['user_id' => (string)$userId]) + ->delete($this->assignmentTable, ['user_id' => (string) $userId]) ->execute() > 0; } diff --git a/framework/requirements/YiiRequirementChecker.php b/framework/requirements/YiiRequirementChecker.php index a3dde22..131e26e 100644 --- a/framework/requirements/YiiRequirementChecker.php +++ b/framework/requirements/YiiRequirementChecker.php @@ -199,7 +199,7 @@ class YiiRequirementChecker return false; } - return ((integer) $value == 1 || strtolower($value) == 'on'); + return ((int) $value == 1 || strtolower($value) == 'on'); } /** @@ -244,7 +244,7 @@ class YiiRequirementChecker return 0; } if (is_numeric($verboseSize)) { - return (integer) $verboseSize; + return (int) $verboseSize; } $sizeUnit = trim($verboseSize, '0123456789'); $size = str_replace($sizeUnit, '', $verboseSize); diff --git a/framework/web/UrlRule.php b/framework/web/UrlRule.php index b195319..8979803 100644 --- a/framework/web/UrlRule.php +++ b/framework/web/UrlRule.php @@ -84,7 +84,7 @@ class UrlRule extends Object implements UrlRuleInterface */ public $mode; /** - * @var bool a value indicating if parameters should be url encoded. + * @var boolean a value indicating if parameters should be url encoded. */ public $encodeParams = true; diff --git a/framework/widgets/ActiveForm.php b/framework/widgets/ActiveForm.php index 49990e3..2fa24ef 100644 --- a/framework/widgets/ActiveForm.php +++ b/framework/widgets/ActiveForm.php @@ -157,6 +157,7 @@ class ActiveForm extends Widget * @internal */ public $attributes = []; + /** * @var ActiveField[] the ActiveField objects that are currently active */ diff --git a/tests/unit/data/ar/Type.php b/tests/unit/data/ar/Type.php index a0ae65b..7922ba5 100644 --- a/tests/unit/data/ar/Type.php +++ b/tests/unit/data/ar/Type.php @@ -5,9 +5,9 @@ namespace yiiunit\data\ar; /** * Model representing type table * - * @property int $int_col - * @property int $int_col2 DEFAULT 1 - * @property int $smallint_col DEFAULT 1 + * @property integer $int_col + * @property integer $int_col2 DEFAULT 1 + * @property integer $smallint_col DEFAULT 1 * @property string $char_col * @property string $char_col2 DEFAULT 'something' * @property string $char_col3 diff --git a/tests/unit/framework/base/SecurityTest.php b/tests/unit/framework/base/SecurityTest.php index a807c8e..2596277 100644 --- a/tests/unit/framework/base/SecurityTest.php +++ b/tests/unit/framework/base/SecurityTest.php @@ -215,8 +215,8 @@ class SecurityTest extends TestCase * @param string $hash * @param string $password * @param string $salt - * @param int $iterations - * @param int $length + * @param integer $iterations + * @param integer $length * @param string $okm */ public function testPbkdf2($hash, $password, $salt, $iterations, $length, $okm) @@ -303,7 +303,7 @@ class SecurityTest extends TestCase * @param string $ikm * @param string $salt * @param string $info - * @param int $l + * @param integer $l * @param string $prk * @param string $okm */ diff --git a/tests/unit/framework/caching/CacheTestCase.php b/tests/unit/framework/caching/CacheTestCase.php index f31d600..4d976c4 100644 --- a/tests/unit/framework/caching/CacheTestCase.php +++ b/tests/unit/framework/caching/CacheTestCase.php @@ -13,7 +13,7 @@ function time() /** * Mock for the microtime() function for caching classes - * @param bool $float + * @param boolean $float * @return float */ function microtime($float = false) diff --git a/tests/unit/framework/db/CommandTest.php b/tests/unit/framework/db/CommandTest.php index 936db53..3343aaf 100644 --- a/tests/unit/framework/db/CommandTest.php +++ b/tests/unit/framework/db/CommandTest.php @@ -189,7 +189,7 @@ class CommandTest extends DatabaseTestCase } $this->assertEquals($numericCol, $row['numeric_col']); if ($this->driverName === 'mysql' || defined('HHVM_VERSION') && $this->driverName === 'sqlite') { - $this->assertEquals($boolCol, (int)$row['bool_col']); + $this->assertEquals($boolCol, (int) $row['bool_col']); } else { $this->assertEquals($boolCol, $row['bool_col']); }