From 8b50a4942aa0427182e29dbabb809956b66eea19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=BA=D1=81=D0=B8=D0=BC=20=D0=A1=D0=BF=D0=B8?= =?UTF-8?q?=D1=80=D0=BA=D0=BE=D0=B2?= <63721828+max-s-lab@users.noreply.github.com> Date: Tue, 3 Jun 2025 20:57:08 +0400 Subject: [PATCH] Fix @var tags syntax in framework folder (#20392) --- framework/captcha/CaptchaValidator.php | 2 +- framework/console/UnknownCommandException.php | 4 +- .../console/controllers/HelpController.php | 4 +- framework/data/ActiveDataProvider.php | 4 +- framework/db/ActiveQuery.php | 16 +++---- framework/db/ActiveQueryTrait.php | 6 +-- framework/db/ActiveRecord.php | 2 +- framework/db/ActiveRelationTrait.php | 14 +++--- framework/db/BaseActiveRecord.php | 44 +++++++++---------- framework/db/Command.php | 2 +- framework/db/Connection.php | 4 +- framework/db/Schema.php | 4 +- framework/db/mssql/QueryBuilder.php | 4 +- framework/db/sqlite/Schema.php | 2 +- framework/di/Container.php | 2 +- framework/filters/AccessControl.php | 2 +- framework/grid/DataColumn.php | 6 +-- framework/grid/GridView.php | 10 ++--- framework/helpers/BaseMarkdown.php | 2 +- framework/log/Target.php | 4 +- framework/rbac/PhpManager.php | 12 ++--- framework/requirements/requirements.php | 8 ++-- .../requirements/views/console/index.php | 8 ++-- framework/requirements/views/web/index.php | 8 ++-- framework/rest/Action.php | 2 +- framework/rest/CreateAction.php | 2 +- framework/rest/IndexAction.php | 2 +- framework/rest/UpdateAction.php | 2 +- framework/rest/UrlRule.php | 4 +- framework/test/ActiveFixture.php | 2 +- framework/test/BaseActiveFixture.php | 2 +- framework/test/FixtureTrait.php | 2 - framework/validators/ExistValidator.php | 2 +- framework/validators/UniqueValidator.php | 2 +- framework/views/_addComments.php | 5 ++- framework/views/_createTable.php | 7 +-- framework/views/_dropTable.php | 5 ++- framework/views/_foreignTables.php | 3 +- framework/views/addColumnMigration.php | 10 ++--- framework/views/createJunctionMigration.php | 12 ++--- framework/views/createTableMigration.php | 14 +++--- framework/views/dropColumnMigration.php | 10 ++--- framework/views/dropTableMigration.php | 10 ++--- .../views/errorHandler/callStackItem.php | 22 +++++----- framework/views/errorHandler/error.php | 6 ++- framework/views/errorHandler/exception.php | 8 ++-- .../views/errorHandler/previousException.php | 6 ++- framework/views/migration.php | 6 +-- framework/web/AssetManager.php | 2 +- framework/web/CompositeUrlRule.php | 4 +- framework/web/UrlManager.php | 6 +-- framework/web/User.php | 6 +-- framework/widgets/ActiveField.php | 4 +- framework/widgets/ActiveForm.php | 4 +- framework/widgets/BaseListView.php | 4 +- 55 files changed, 180 insertions(+), 170 deletions(-) diff --git a/framework/captcha/CaptchaValidator.php b/framework/captcha/CaptchaValidator.php index c84f199c50..641abbd041 100644 --- a/framework/captcha/CaptchaValidator.php +++ b/framework/captcha/CaptchaValidator.php @@ -72,7 +72,7 @@ class CaptchaValidator extends Validator { $ca = Yii::$app->createController($this->captchaAction); if ($ca !== false) { - /* @var $controller \yii\base\Controller */ + /** @var \yii\base\Controller $controller */ list($controller, $actionID) = $ca; $action = $controller->createAction($actionID); if ($action !== null) { diff --git a/framework/console/UnknownCommandException.php b/framework/console/UnknownCommandException.php index 917887c86b..a0e09674b4 100644 --- a/framework/console/UnknownCommandException.php +++ b/framework/console/UnknownCommandException.php @@ -70,13 +70,13 @@ class UnknownCommandException extends Exception if ($help === false || $this->command === '') { return []; } - /** @var $helpController HelpController */ + /** @var HelpController $helpController */ list($helpController, $actionID) = $help; $availableActions = []; foreach ($helpController->getCommands() as $command) { $result = $this->application->createController($command); - /** @var $controller Controller */ + /** @var Controller $controller */ list($controller, $actionID) = $result; if ($controller->createAction($controller->defaultAction) !== null) { // add the command itself (default action) diff --git a/framework/console/controllers/HelpController.php b/framework/console/controllers/HelpController.php index c620f26cd4..8c0a951e00 100644 --- a/framework/console/controllers/HelpController.php +++ b/framework/console/controllers/HelpController.php @@ -77,7 +77,7 @@ class HelpController extends Controller { foreach ($this->getCommandDescriptions() as $command => $description) { $result = Yii::$app->createController($command); - /** @var $controller Controller */ + /** @var Controller $controller */ list($controller, $actionID) = $result; $actions = $this->getActions($controller); $prefix = $controller->getUniqueId(); @@ -300,7 +300,7 @@ class HelpController extends Controller $maxLength = 0; foreach ($commands as $command => $description) { $result = Yii::$app->createController($command); - /** @var $controller Controller */ + /** @var Controller $controller */ list($controller, $actionID) = $result; $actions = $this->getActions($controller); $prefix = $controller->getUniqueId(); diff --git a/framework/data/ActiveDataProvider.php b/framework/data/ActiveDataProvider.php index 3a129aa729..47555c326a 100644 --- a/framework/data/ActiveDataProvider.php +++ b/framework/data/ActiveDataProvider.php @@ -132,7 +132,7 @@ class ActiveDataProvider extends BaseDataProvider return $keys; } elseif ($this->query instanceof ActiveQueryInterface) { - /* @var $class \yii\db\ActiveRecordInterface */ + /** @var \yii\db\ActiveRecordInterface $class */ $class = $this->query->modelClass; $pks = $class::primaryKey(); if (count($pks) === 1) { @@ -175,7 +175,7 @@ class ActiveDataProvider extends BaseDataProvider { parent::setSort($value); if ($this->query instanceof ActiveQueryInterface && ($sort = $this->getSort()) !== false) { - /* @var $modelClass Model */ + /** @var Model $modelClass */ $modelClass = $this->query->modelClass; $model = $modelClass::instance(); if (empty($sort->attributes)) { diff --git a/framework/db/ActiveQuery.php b/framework/db/ActiveQuery.php index 7bfa3b8206..a01d76688c 100644 --- a/framework/db/ActiveQuery.php +++ b/framework/db/ActiveQuery.php @@ -188,7 +188,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface $this->filterByModels($viaModels); } elseif (is_array($this->via)) { // via relation - /* @var $viaQuery ActiveQuery */ + /** @var self $viaQuery */ list($viaName, $viaQuery, $viaCallableUsed) = $this->via; if ($viaQuery->multiple) { if ($viaCallableUsed) { @@ -266,7 +266,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface private function removeDuplicatedModels($models) { $hash = []; - /* @var $class ActiveRecord */ + /** @var ActiveRecord $class */ $class = $this->modelClass; $pks = $class::primaryKey(); @@ -339,7 +339,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface */ public function createCommand($db = null) { - /* @var $modelClass ActiveRecord */ + /** @var ActiveRecord $modelClass */ $modelClass = $this->modelClass; if ($db === null) { $db = $modelClass::getDb(); @@ -363,7 +363,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface */ protected function queryScalar($selectExpression, $db) { - /* @var $modelClass ActiveRecord */ + /** @var ActiveRecord $modelClass */ $modelClass = $this->modelClass; if ($db === null) { $db = $modelClass::getDb(); @@ -452,7 +452,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface list(, $relation, $alias) = $matches; $name = $relation; $callback = function ($query) use ($callback, $alias) { - /* @var $query ActiveQuery */ + /** @var self $query */ $query->alias($alias); if ($callback !== null) { call_user_func($callback, $query); @@ -475,7 +475,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface $join = $this->join; $this->join = []; - /* @var $modelClass ActiveRecordInterface */ + /** @var ActiveRecordInterface $modelClass */ $modelClass = $this->modelClass; $model = $modelClass::instance(); foreach ($this->joinWith as $config) { @@ -570,7 +570,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface } else { $relation = $relations[$fullName]; } - /* @var $relationModelClass ActiveRecordInterface */ + /** @var ActiveRecordInterface $relationModelClass */ $relationModelClass = $relation->modelClass; $primaryModel = $relationModelClass::instance(); $parent = $relation; @@ -870,7 +870,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface */ protected function getPrimaryTableName() { - /* @var $modelClass ActiveRecord */ + /** @var ActiveRecord $modelClass */ $modelClass = $this->modelClass; return $modelClass::tableName(); } diff --git a/framework/db/ActiveQueryTrait.php b/framework/db/ActiveQueryTrait.php index d49fa0fba8..d8cb893ee9 100644 --- a/framework/db/ActiveQueryTrait.php +++ b/framework/db/ActiveQueryTrait.php @@ -115,7 +115,7 @@ trait ActiveQueryTrait return $rows; } else { $models = []; - /* @var $class ActiveRecord */ + /** @var ActiveRecord $class */ $class = $this->modelClass; foreach ($rows as $row) { $model = $class::instantiate($row); @@ -141,12 +141,12 @@ trait ActiveQueryTrait $primaryModel = reset($models); if (!$primaryModel instanceof ActiveRecordInterface) { - /* @var $modelClass ActiveRecordInterface */ + /** @var ActiveRecordInterface $modelClass */ $modelClass = $this->modelClass; $primaryModel = $modelClass::instance(); } $relations = $this->normalizeRelations($primaryModel, $with); - /* @var $relation ActiveQuery */ + /** @var ActiveQuery $relation */ foreach ($relations as $name => $relation) { if ($relation->asArray === null) { // inherit asArray from primary query diff --git a/framework/db/ActiveRecord.php b/framework/db/ActiveRecord.php index 3714e43a84..3a0f367429 100644 --- a/framework/db/ActiveRecord.php +++ b/framework/db/ActiveRecord.php @@ -295,7 +295,7 @@ class ActiveRecord extends BaseActiveRecord } $query->where($pk); - /* @var $record BaseActiveRecord */ + /** @var BaseActiveRecord $record */ $record = $query->noCache()->one(); return $this->refreshInternal($record); } diff --git a/framework/db/ActiveRelationTrait.php b/framework/db/ActiveRelationTrait.php index 73b935fdb9..0a4f903ce0 100644 --- a/framework/db/ActiveRelationTrait.php +++ b/framework/db/ActiveRelationTrait.php @@ -206,7 +206,7 @@ trait ActiveRelationTrait $relatedModel->populateRelation($this->inverseOf, $inverseRelation->multiple ? [$this->primaryModel] : $this->primaryModel); } else { if (!isset($inverseRelation)) { - /* @var $modelClass ActiveRecordInterface */ + /** @var ActiveRecordInterface $modelClass */ $modelClass = $this->modelClass; $inverseRelation = $modelClass::instance()->getRelation($this->inverseOf); } @@ -230,13 +230,13 @@ trait ActiveRelationTrait if ($this->via instanceof self) { // via junction table - /* @var $viaQuery ActiveRelationTrait */ + /** @var self $viaQuery */ $viaQuery = $this->via; $viaModels = $viaQuery->findJunctionRows($primaryModels); $this->filterByModels($viaModels); } elseif (is_array($this->via)) { // via relation - /* @var $viaQuery ActiveRelationTrait|ActiveQueryTrait */ + /** @var self|ActiveQueryTrait $viaQuery */ list($viaName, $viaQuery) = $this->via; if ($viaQuery->asArray === null) { // inherit asArray from primary query @@ -339,11 +339,11 @@ trait ActiveRelationTrait return; } $model = reset($models); - /* @var $relation ActiveQueryInterface|ActiveQuery */ + /** @var ActiveQueryInterface|ActiveQuery $relation */ if ($model instanceof ActiveRecordInterface) { $relation = $model->getRelation($name); } else { - /* @var $modelClass ActiveRecordInterface */ + /** @var ActiveRecordInterface $modelClass */ $modelClass = $this->modelClass; $relation = $modelClass::instance()->getRelation($name); } @@ -496,7 +496,7 @@ trait ActiveRelationTrait { if ($this instanceof ActiveQuery && (!empty($this->join) || !empty($this->joinWith))) { if (empty($this->from)) { - /* @var $modelClass ActiveRecord */ + /** @var ActiveRecord $modelClass */ $modelClass = $this->modelClass; $alias = $modelClass::tableName(); } else { @@ -625,7 +625,7 @@ trait ActiveRelationTrait return []; } $this->filterByModels($primaryModels); - /* @var $primaryModel ActiveRecord */ + /** @var ActiveRecord $primaryModel */ $primaryModel = reset($primaryModels); if (!$primaryModel instanceof ActiveRecordInterface) { // when primaryModels are array of arrays (asArray case) diff --git a/framework/db/BaseActiveRecord.php b/framework/db/BaseActiveRecord.php index 761bc2cb99..021f83a511 100644 --- a/framework/db/BaseActiveRecord.php +++ b/framework/db/BaseActiveRecord.php @@ -442,8 +442,8 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface */ protected function createRelationQuery($class, $link, $multiple) { - /* @var $class ActiveRecordInterface */ - /* @var $query ActiveQuery */ + /** @var ActiveRecordInterface $class */ + /** @var ActiveQuery $query */ $query = $class::find(); $query->primaryModel = $this; $query->link = $link; @@ -1061,7 +1061,7 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface */ public function refresh() { - /* @var $record BaseActiveRecord */ + /** @var self $record */ $record = static::findOne($this->getPrimaryKey(true)); return $this->refreshInternal($record); } @@ -1300,7 +1300,7 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface */ public function link($name, $model, $extraColumns = []) { - /* @var $relation ActiveQueryInterface|ActiveQuery */ + /** @var ActiveQueryInterface|ActiveQuery $relation */ $relation = $this->getRelation($name); if ($relation->via !== null) { @@ -1308,7 +1308,7 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface throw new InvalidCallException('Unable to link models: the models being linked cannot be newly created.'); } if (is_array($relation->via)) { - /* @var $viaRelation ActiveQuery */ + /** @var ActiveQuery $viaRelation */ list($viaName, $viaRelation) = $relation->via; $viaClass = $viaRelation->modelClass; // unset $viaName so that it can be reloaded to reflect the change @@ -1328,15 +1328,15 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface $columns[$k] = $v; } if (is_array($relation->via)) { - /* @var $viaClass ActiveRecordInterface */ - /* @var $record ActiveRecordInterface */ + /** @var ActiveRecordInterface $viaClass */ + /** @var ActiveRecordInterface $record */ $record = Yii::createObject($viaClass); foreach ($columns as $column => $value) { $record->$column = $value; } $record->insert(false); } else { - /* @var $viaTable string */ + /** @var string $viaTable */ static::getDb()->createCommand()->insert($viaTable, $columns)->execute(); } } else { @@ -1396,12 +1396,12 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface */ public function unlink($name, $model, $delete = false) { - /* @var $relation ActiveQueryInterface|ActiveQuery */ + /** @var ActiveQueryInterface|ActiveQuery $relation */ $relation = $this->getRelation($name); if ($relation->via !== null) { if (is_array($relation->via)) { - /* @var $viaRelation ActiveQuery */ + /** @var ActiveQuery $viaRelation */ list($viaName, $viaRelation) = $relation->via; $viaClass = $viaRelation->modelClass; unset($this->_related[$viaName]); @@ -1424,15 +1424,15 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface $columns = ['and', $columns, $viaRelation->on]; } if (is_array($relation->via)) { - /* @var $viaClass ActiveRecordInterface */ + /** @var ActiveRecordInterface $viaClass */ if ($delete) { $viaClass::deleteAll($columns); } else { $viaClass::updateAll($nulls, $columns); } } else { - /* @var $viaTable string */ - /* @var $command Command */ + /** @var string $viaTable */ + /** @var Command $command */ $command = static::getDb()->createCommand(); if ($delete) { $command->delete($viaTable, $columns)->execute(); @@ -1473,7 +1473,7 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface if (!$relation->multiple) { unset($this->_related[$name]); } elseif (isset($this->_related[$name])) { - /* @var $b ActiveRecordInterface */ + /** @var ActiveRecordInterface $b */ foreach ($this->_related[$name] as $a => $b) { if ($model->getPrimaryKey() === $b->getPrimaryKey()) { unset($this->_related[$name][$a]); @@ -1499,12 +1499,12 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface */ public function unlinkAll($name, $delete = false) { - /* @var $relation ActiveQueryInterface|ActiveQuery */ + /** @var ActiveQueryInterface|ActiveQuery $relation */ $relation = $this->getRelation($name); if ($relation->via !== null) { if (is_array($relation->via)) { - /* @var $viaRelation ActiveQuery */ + /** @var ActiveQuery $viaRelation */ list($viaName, $viaRelation) = $relation->via; $viaClass = $viaRelation->modelClass; unset($this->_related[$viaName]); @@ -1525,15 +1525,15 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface $condition = ['and', $condition, $viaRelation->on]; } if (is_array($relation->via)) { - /* @var $viaClass ActiveRecordInterface */ + /** @var ActiveRecordInterface $viaClass */ if ($delete) { $viaClass::deleteAll($condition); } else { $viaClass::updateAll($nulls, $condition); } } else { - /* @var $viaTable string */ - /* @var $command Command */ + /** @var string $viaTable */ + /** @var Command $command */ $command = static::getDb()->createCommand(); if ($delete) { $command->delete($viaTable, $condition)->execute(); @@ -1542,7 +1542,7 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface } } } else { - /* @var $relatedModel ActiveRecordInterface */ + /** @var ActiveRecordInterface $relatedModel */ $relatedModel = $relation->modelClass; if (!$delete && count($relation->link) === 1 && is_array($this->{$b = reset($relation->link)})) { // relation via array valued attribute @@ -1648,7 +1648,7 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface } catch (InvalidArgumentException $e) { break; } - /* @var $modelClass ActiveRecordInterface */ + /** @var ActiveRecordInterface $modelClass */ $modelClass = $relation->modelClass; $model = $modelClass::instance(); } @@ -1684,7 +1684,7 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface } catch (InvalidParamException $e) { return ''; } - /* @var $modelClass ActiveRecordInterface */ + /** @var ActiveRecordInterface $modelClass */ $modelClass = $relation->modelClass; $relatedModel = $modelClass::instance(); } diff --git a/framework/db/Command.php b/framework/db/Command.php index fb32071d21..3595509509 100644 --- a/framework/db/Command.php +++ b/framework/db/Command.php @@ -1167,7 +1167,7 @@ class Command extends Component if ($method !== '') { $info = $this->db->getQueryCacheInfo($this->queryCacheDuration, $this->queryCacheDependency); if (is_array($info)) { - /* @var $cache \yii\caching\CacheInterface */ + /** @var \yii\caching\CacheInterface $cache */ $cache = $info[0]; $cacheKey = $this->getCacheKey($method, $fetchMode, ''); $result = $cache->get($cacheKey); diff --git a/framework/db/Connection.php b/framework/db/Connection.php index 0c3eca41c2..51f0ee750a 100644 --- a/framework/db/Connection.php +++ b/framework/db/Connection.php @@ -1210,7 +1210,7 @@ class Connection extends Component continue; } - /* @var $db Connection */ + /** @var self $db */ $db = Yii::createObject($config); try { @@ -1232,7 +1232,7 @@ class Connection extends Component // ignore the cache and try to connect anyway // $pool now only contains servers we did not already try in the loop above foreach ($pool as $config) { - /* @var $db Connection */ + /** @var self $db */ $db = Yii::createObject($config); try { $db->open(); diff --git a/framework/db/Schema.php b/framework/db/Schema.php index 53c0af9882..6e7dd20beb 100644 --- a/framework/db/Schema.php +++ b/framework/db/Schema.php @@ -278,7 +278,7 @@ abstract class Schema extends BaseObject */ public function refresh() { - /* @var $cache CacheInterface */ + /** @var CacheInterface $cache */ $cache = is_string($this->db->schemaCache) ? Yii::$app->get($this->db->schemaCache, false) : $this->db->schemaCache; if ($this->db->enableSchemaCache && $cache instanceof CacheInterface) { TagDependency::invalidate($cache, $this->getCacheTag()); @@ -299,7 +299,7 @@ abstract class Schema extends BaseObject $rawName = $this->getRawTableName($name); unset($this->_tableMetadata[$rawName]); $this->_tableNames = []; - /* @var $cache CacheInterface */ + /** @var CacheInterface $cache */ $cache = is_string($this->db->schemaCache) ? Yii::$app->get($this->db->schemaCache, false) : $this->db->schemaCache; if ($this->db->enableSchemaCache && $cache instanceof CacheInterface) { $cache->delete($this->getCacheKey($rawName)); diff --git a/framework/db/mssql/QueryBuilder.php b/framework/db/mssql/QueryBuilder.php index 1605e44524..d2fbb3b7b7 100644 --- a/framework/db/mssql/QueryBuilder.php +++ b/framework/db/mssql/QueryBuilder.php @@ -425,7 +425,7 @@ class QueryBuilder extends \yii\db\QueryBuilder if (!$modelClass) { return null; } - /* @var $modelClass \yii\db\ActiveRecord */ + /** @var \yii\db\ActiveRecord $modelClass */ $schema = $modelClass::getTableSchema(); return array_keys($schema->columns); } @@ -488,7 +488,7 @@ class QueryBuilder extends \yii\db\QueryBuilder $cols = []; $outputColumns = []; if ($version2005orLater) { - /* @var $schema TableSchema */ + /** @var TableSchema $schema */ $schema = $this->db->getTableSchema($table); foreach ($schema->columns as $column) { if ($column->isComputed) { diff --git a/framework/db/sqlite/Schema.php b/framework/db/sqlite/Schema.php index 32b209b225..719f4e770f 100644 --- a/framework/db/sqlite/Schema.php +++ b/framework/db/sqlite/Schema.php @@ -160,7 +160,7 @@ class Schema extends \yii\db\Schema implements ConstraintFinderInterface $sql = $this->db->createCommand('SELECT `sql` FROM `sqlite_master` WHERE name = :tableName', [ ':tableName' => $tableName, ])->queryScalar(); - /** @var $code SqlToken[]|SqlToken[][]|SqlToken[][][] */ + /** @var SqlToken[]|SqlToken[][]|SqlToken[][][] $code */ $code = (new SqlTokenizer($sql))->tokenize(); $pattern = (new SqlTokenizer('any CREATE any TABLE any()'))->tokenize(); if (!$code[0]->matches($pattern, 0, $firstMatchIndex, $lastMatchIndex)) { diff --git a/framework/di/Container.php b/framework/di/Container.php index 1d34887f45..9c88b61869 100644 --- a/framework/di/Container.php +++ b/framework/di/Container.php @@ -387,7 +387,7 @@ class Container extends Component */ protected function build($class, $params, $config) { - /* @var $reflection ReflectionClass */ + /** @var ReflectionClass $reflection */ list($reflection, $dependencies) = $this->getDependencies($class); $addDependencies = []; diff --git a/framework/filters/AccessControl.php b/framework/filters/AccessControl.php index 7ec2c5e553..d031a20e1a 100644 --- a/framework/filters/AccessControl.php +++ b/framework/filters/AccessControl.php @@ -118,7 +118,7 @@ class AccessControl extends ActionFilter { $user = $this->user; $request = Yii::$app->getRequest(); - /* @var $rule AccessRule */ + /** @var AccessRule $rule */ foreach ($this->rules as $rule) { if ($allow = $rule->allows($action, $user, $request)) { return true; diff --git a/framework/grid/DataColumn.php b/framework/grid/DataColumn.php index 453fc099e0..0995ffaf4e 100644 --- a/framework/grid/DataColumn.php +++ b/framework/grid/DataColumn.php @@ -172,12 +172,12 @@ class DataColumn extends Column if ($this->attribute === null) { $label = ''; } elseif ($provider instanceof ActiveDataProvider && $provider->query instanceof ActiveQueryInterface) { - /* @var $modelClass Model */ + /** @var Model $modelClass */ $modelClass = $provider->query->modelClass; $model = $modelClass::instance(); $label = $model->getAttributeLabel($this->attribute); } elseif ($provider instanceof ArrayDataProvider && $provider->modelClass !== null) { - /* @var $modelClass Model */ + /** @var Model $modelClass */ $modelClass = $provider->modelClass; $model = $modelClass::instance(); $label = $model->getAttributeLabel($this->attribute); @@ -186,7 +186,7 @@ class DataColumn extends Column } else { $models = $provider->getModels(); if (($model = reset($models)) instanceof Model) { - /* @var $model Model */ + /** @var Model $model */ $label = $model->getAttributeLabel($this->attribute); } else { $label = Inflector::camel2words($this->attribute); diff --git a/framework/grid/GridView.php b/framework/grid/GridView.php index 7ee0e06bbc..8e4401f907 100644 --- a/framework/grid/GridView.php +++ b/framework/grid/GridView.php @@ -400,7 +400,7 @@ class GridView extends BaseListView public function renderColumnGroup() { foreach ($this->columns as $column) { - /* @var $column Column */ + /** @var Column $column */ if (!empty($column->options)) { $cols = []; foreach ($this->columns as $col) { @@ -422,7 +422,7 @@ class GridView extends BaseListView { $cells = []; foreach ($this->columns as $column) { - /* @var $column Column */ + /** @var Column $column */ $cells[] = $column->renderHeaderCell(); } $content = Html::tag('tr', implode('', $cells), $this->headerRowOptions); @@ -443,7 +443,7 @@ class GridView extends BaseListView { $cells = []; foreach ($this->columns as $column) { - /* @var $column Column */ + /** @var Column $column */ $cells[] = $column->renderFooterCell(); } $content = Html::tag('tr', implode('', $cells), $this->footerRowOptions); @@ -463,7 +463,7 @@ class GridView extends BaseListView if ($this->filterModel !== null) { $cells = []; foreach ($this->columns as $column) { - /* @var $column Column */ + /** @var Column $column */ $cells[] = $column->renderFilterCell(); } @@ -520,7 +520,7 @@ class GridView extends BaseListView public function renderTableRow($model, $key, $index) { $cells = []; - /* @var $column Column */ + /** @var Column $column */ foreach ($this->columns as $column) { $cells[] = $column->renderDataCell($model, $key, $index); } diff --git a/framework/helpers/BaseMarkdown.php b/framework/helpers/BaseMarkdown.php index b0c7117330..df7e38c78a 100644 --- a/framework/helpers/BaseMarkdown.php +++ b/framework/helpers/BaseMarkdown.php @@ -95,7 +95,7 @@ class BaseMarkdown if ($flavor === null) { $flavor = static::$defaultFlavor; } - /* @var $parser \cebe\markdown\Markdown */ + /** @var \cebe\markdown\Markdown $parser */ if (!isset(static::$flavors[$flavor])) { throw new InvalidArgumentException("Markdown flavor '$flavor' is not defined.'"); } elseif (!is_object($config = static::$flavors[$flavor])) { diff --git a/framework/log/Target.php b/framework/log/Target.php index 1d9a22f23d..8d5d2e3655 100644 --- a/framework/log/Target.php +++ b/framework/log/Target.php @@ -344,7 +344,7 @@ abstract class Target extends Component $request = Yii::$app->getRequest(); $ip = $request instanceof Request ? $request->getUserIP() : '-'; - /* @var $user \yii\web\User */ + /** @var \yii\web\User $user */ $user = Yii::$app->has('user', true) ? Yii::$app->get('user') : null; if ($user && ($identity = $user->getIdentity(false))) { $userID = $identity->getId(); @@ -352,7 +352,7 @@ abstract class Target extends Component $userID = '-'; } - /* @var $session \yii\web\Session */ + /** @var \yii\web\Session $session */ $session = Yii::$app->has('session', true) ? Yii::$app->get('session') : null; $sessionID = $session && $session->getIsActive() ? $session->getId() : '-'; diff --git a/framework/rbac/PhpManager.php b/framework/rbac/PhpManager.php index 291d72976b..e09d23c15a 100644 --- a/framework/rbac/PhpManager.php +++ b/framework/rbac/PhpManager.php @@ -134,7 +134,7 @@ class PhpManager extends BaseManager return false; } - /* @var $item Item */ + /** @var Item $item */ $item = $this->items[$itemName]; Yii::debug($item instanceof Role ? "Checking role: $itemName" : "Checking permission : $itemName", __METHOD__); @@ -208,7 +208,7 @@ class PhpManager extends BaseManager return false; } foreach ($this->children[$child->name] as $grandchild) { - /* @var $grandchild Item */ + /** @var Item $grandchild */ if ($this->detectLoop($parent, $grandchild)) { return true; } @@ -320,7 +320,7 @@ class PhpManager extends BaseManager $items = []; foreach ($this->items as $name => $item) { - /* @var $item Item */ + /** @var Item $item */ if ($item->type == $type) { $items[$name] = $item; } @@ -822,7 +822,7 @@ class PhpManager extends BaseManager { $items = []; foreach ($this->items as $name => $item) { - /* @var $item Item */ + /** @var Item $item */ $items[$name] = array_filter( [ 'type' => $item->type, @@ -833,7 +833,7 @@ class PhpManager extends BaseManager ); if (isset($this->children[$name])) { foreach ($this->children[$name] as $child) { - /* @var $child Item */ + /** @var Item $child */ $items[$name]['children'][] = $child->name; } } @@ -849,7 +849,7 @@ class PhpManager extends BaseManager $assignmentData = []; foreach ($this->assignments as $userId => $assignments) { foreach ($assignments as $name => $assignment) { - /* @var $assignment Assignment */ + /** @var Assignment $assignment */ $assignmentData[$userId][] = $assignment->roleName; } } diff --git a/framework/requirements/requirements.php b/framework/requirements/requirements.php index 1bf372aee5..2790d1fe9c 100644 --- a/framework/requirements/requirements.php +++ b/framework/requirements/requirements.php @@ -3,11 +3,9 @@ * @link https://www.yiiframework.com/ * @copyright Copyright (c) 2008 Yii Software LLC * @license https://www.yiiframework.com/license/ - */ - -/* @var $this YiiRequirementChecker */ - -/** + * + * @var YiiRequirementChecker $this + * * These are the Yii core requirements for the [[YiiRequirementChecker]] instance. * These requirements are mandatory for any Yii application. */ diff --git a/framework/requirements/views/console/index.php b/framework/requirements/views/console/index.php index acf912698a..eb6aae19c7 100644 --- a/framework/requirements/views/console/index.php +++ b/framework/requirements/views/console/index.php @@ -3,12 +3,12 @@ * @link https://www.yiiframework.com/ * @copyright Copyright (c) 2008 Yii Software LLC * @license https://www.yiiframework.com/license/ + * + * @var YiiRequirementChecker $this + * @var array $summary + * @var array[] $requirements */ -/* @var $this YiiRequirementChecker */ -/* @var $summary array */ -/* @var $requirements array[] */ - echo "\nYii Application Requirement Checker\n\n"; echo "This script checks if your server configuration meets the requirements\n"; diff --git a/framework/requirements/views/web/index.php b/framework/requirements/views/web/index.php index 15b2233d53..4c672a76e2 100644 --- a/framework/requirements/views/web/index.php +++ b/framework/requirements/views/web/index.php @@ -1,7 +1,9 @@ diff --git a/framework/rest/Action.php b/framework/rest/Action.php index 49cc4236f6..3b6b2e2eb9 100644 --- a/framework/rest/Action.php +++ b/framework/rest/Action.php @@ -84,7 +84,7 @@ class Action extends \yii\base\Action return call_user_func($this->findModel, $id, $this); } - /* @var $modelClass ActiveRecordInterface */ + /** @var ActiveRecordInterface $modelClass */ $modelClass = $this->modelClass; $keys = $modelClass::primaryKey(); if (count($keys) > 1) { diff --git a/framework/rest/CreateAction.php b/framework/rest/CreateAction.php index be6e3e3552..0dab7044f7 100644 --- a/framework/rest/CreateAction.php +++ b/framework/rest/CreateAction.php @@ -43,7 +43,7 @@ class CreateAction extends Action call_user_func($this->checkAccess, $this->id); } - /* @var $model \yii\db\ActiveRecord */ + /** @var \yii\db\ActiveRecord $model */ $model = new $this->modelClass([ 'scenario' => $this->scenario, ]); diff --git a/framework/rest/IndexAction.php b/framework/rest/IndexAction.php index 81b19cab78..f1f177b301 100644 --- a/framework/rest/IndexAction.php +++ b/framework/rest/IndexAction.php @@ -143,7 +143,7 @@ class IndexAction extends Action return call_user_func($this->prepareDataProvider, $this, $filter); } - /* @var $modelClass \yii\db\BaseActiveRecord */ + /** @var \yii\db\BaseActiveRecord $modelClass */ $modelClass = $this->modelClass; $query = $modelClass::find(); diff --git a/framework/rest/UpdateAction.php b/framework/rest/UpdateAction.php index c307144231..62cbf5e4be 100644 --- a/framework/rest/UpdateAction.php +++ b/framework/rest/UpdateAction.php @@ -36,7 +36,7 @@ class UpdateAction extends Action */ public function run($id) { - /* @var $model ActiveRecord */ + /** @var ActiveRecord $model */ $model = $this->findModel($id); if ($this->checkAccess) { diff --git a/framework/rest/UrlRule.php b/framework/rest/UrlRule.php index 48b1bbe799..18855eb3f2 100644 --- a/framework/rest/UrlRule.php +++ b/framework/rest/UrlRule.php @@ -227,7 +227,7 @@ class UrlRule extends CompositeUrlRule foreach ($this->rules as $urlName => $rules) { if (strpos($pathInfo, $urlName) !== false) { foreach ($rules as $rule) { - /* @var $rule WebUrlRule */ + /** @var WebUrlRule $rule */ $result = $rule->parseRequest($manager, $request); if (YII_DEBUG) { Yii::debug([ @@ -254,7 +254,7 @@ class UrlRule extends CompositeUrlRule $this->createStatus = WebUrlRule::CREATE_STATUS_SUCCESS; foreach ($this->controller as $urlName => $controller) { if (strpos($route, $controller) !== false) { - /* @var $rules UrlRuleInterface[] */ + /** @var UrlRuleInterface[] $rules */ $rules = $this->rules[$urlName]; $url = $this->iterateRules($rules, $manager, $route, $params); if ($url !== false) { diff --git a/framework/test/ActiveFixture.php b/framework/test/ActiveFixture.php index 61974c1884..c4cb4b2c9d 100644 --- a/framework/test/ActiveFixture.php +++ b/framework/test/ActiveFixture.php @@ -151,7 +151,7 @@ class ActiveFixture extends BaseActiveFixture $db = $this->db; $tableName = $this->tableName; if ($tableName === null) { - /* @var $modelClass \yii\db\ActiveRecord */ + /** @var \yii\db\ActiveRecord $modelClass */ $modelClass = $this->modelClass; $tableName = $modelClass::tableName(); } diff --git a/framework/test/BaseActiveFixture.php b/framework/test/BaseActiveFixture.php index f953f91803..0fb45dd483 100644 --- a/framework/test/BaseActiveFixture.php +++ b/framework/test/BaseActiveFixture.php @@ -58,7 +58,7 @@ abstract class BaseActiveFixture extends DbFixture implements \IteratorAggregate throw new InvalidConfigException('The "modelClass" property must be set.'); } $row = $this->data[$name]; - /* @var $modelClass \yii\db\ActiveRecord */ + /** @var \yii\db\ActiveRecord $modelClass */ $modelClass = $this->modelClass; $keys = []; foreach ($modelClass::primaryKey() as $key) { diff --git a/framework/test/FixtureTrait.php b/framework/test/FixtureTrait.php index cd4bd14310..4be70470ea 100644 --- a/framework/test/FixtureTrait.php +++ b/framework/test/FixtureTrait.php @@ -88,7 +88,6 @@ trait FixtureTrait $fixtures = $this->getFixtures(); } - /* @var $fixture Fixture */ foreach ($fixtures as $fixture) { $fixture->beforeLoad(); } @@ -112,7 +111,6 @@ trait FixtureTrait $fixtures = $this->getFixtures(); } - /* @var $fixture Fixture */ foreach ($fixtures as $fixture) { $fixture->beforeUnload(); } diff --git a/framework/validators/ExistValidator.php b/framework/validators/ExistValidator.php index 738d938cb7..c0f72f6910 100644 --- a/framework/validators/ExistValidator.php +++ b/framework/validators/ExistValidator.php @@ -299,7 +299,7 @@ class ExistValidator extends Validator */ protected function createQuery($targetClass, $condition) { - /* @var $targetClass \yii\db\ActiveRecordInterface */ + /** @var \yii\db\ActiveRecordInterface $targetClass */ $query = $targetClass::find()->andWhere($condition); if ($this->filter instanceof \Closure) { call_user_func($this->filter, $query); diff --git a/framework/validators/UniqueValidator.php b/framework/validators/UniqueValidator.php index 74edcfd661..8c99955c97 100644 --- a/framework/validators/UniqueValidator.php +++ b/framework/validators/UniqueValidator.php @@ -142,7 +142,7 @@ class UniqueValidator extends Validator $conditions[] = [$key => $value]; } - /* @var $targetClass ActiveRecordInterface */ + /** @var ActiveRecordInterface $targetClass */ $targetClass = $this->getTargetClass($model); $db = $targetClass::getDb(); diff --git a/framework/views/_addComments.php b/framework/views/_addComments.php index fe5992139a..e8956a6778 100644 --- a/framework/views/_addComments.php +++ b/framework/views/_addComments.php @@ -1,7 +1,8 @@ $this->addCommentOnTable('', ''); diff --git a/framework/views/_createTable.php b/framework/views/_createTable.php index 0768299142..6f241b8a05 100644 --- a/framework/views/_createTable.php +++ b/framework/views/_createTable.php @@ -2,10 +2,11 @@ /** * Creates a call for the method `yii\db\Migration::createTable()`. + * + * @var string $table the name table + * @var array $fields the fields + * @var array $foreignKeys the foreign keys */ -/* @var $table string the name table */ -/* @var $fields array the fields */ -/* @var $foreignKeys array the foreign keys */ ?> $this->createTable('', [ render('_dropForeignKeys', [ 'table' => $table, diff --git a/framework/views/_foreignTables.php b/framework/views/_foreignTables.php index 2baacda47e..a884759c4e 100644 --- a/framework/views/_foreignTables.php +++ b/framework/views/_foreignTables.php @@ -2,8 +2,9 @@ /** * Creates a call for the method `yii\db\Migration::createTable()`. + * + * @var array $foreignKeys the foreign keys */ -/* @var $foreignKeys array the foreign keys */ if (!empty($foreignKeys)):?> * Has foreign keys to the tables: diff --git a/framework/views/addColumnMigration.php b/framework/views/addColumnMigration.php index 9e84d2283b..3973f30d3d 100644 --- a/framework/views/addColumnMigration.php +++ b/framework/views/addColumnMigration.php @@ -4,13 +4,13 @@ * This view is used by console/controllers/MigrateController.php. * * The following variables are available in this view: + * + * @var string $className the new migration class name without namespace + * @var string $namespace the new migration class namespace + * @var string $table the name table + * @var array $fields the fields */ -/* @var $className string the new migration class name without namespace */ -/* @var $namespace string the new migration class namespace */ -/* @var $table string the name table */ -/* @var $fields array the fields */ - echo " diff --git a/framework/views/errorHandler/error.php b/framework/views/errorHandler/error.php index 630bbec034..3c3d46b096 100644 --- a/framework/views/errorHandler/error.php +++ b/framework/views/errorHandler/error.php @@ -1,6 +1,8 @@ statusCode; } else { diff --git a/framework/views/errorHandler/exception.php b/framework/views/errorHandler/exception.php index e22498984a..995bd4d33a 100644 --- a/framework/views/errorHandler/exception.php +++ b/framework/views/errorHandler/exception.php @@ -1,7 +1,9 @@ beginPage() ?> diff --git a/framework/views/errorHandler/previousException.php b/framework/views/errorHandler/previousException.php index a93f59f79d..af7034359b 100644 --- a/framework/views/errorHandler/previousException.php +++ b/framework/views/errorHandler/previousException.php @@ -1,6 +1,8 @@