Skip to content

Commit

Permalink
Normalize PhpDoc types in CRUD generator (#503)
Browse files Browse the repository at this point in the history
  • Loading branch information
WinterSilence committed May 31, 2022
1 parent d348dfe commit 4f24ccc
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/generators/crud/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@
/**
* Generates CRUD controller and views.
*
* @property-read array $columnNames Model column/attribute names.
* @property-read string[] $columnNames Model column/attribute names.
* @property-read string $controllerID The controller ID (without the module ID prefix).
* @property-read string $nameAttribute
* @property-read array $searchAttributes Searchable attributes.
* @property-read \yii\db\TableSchema|bool $tableSchema
* @property-read string $viewPath The controller view path.
* @property-read string[] $searchAttributes Searchable attributes.
* @property-read \yii\db\TableSchema|false $tableSchema
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
Expand Down Expand Up @@ -90,7 +89,7 @@ public function getDescription()
public function rules()
{
return array_merge(parent::rules(), [
[['controllerClass', 'modelClass', 'searchModelClass', 'baseControllerClass'], 'filter', 'filter' => 'trim'],
[['controllerClass', 'modelClass', 'searchModelClass', 'baseControllerClass'], 'trim', 'chars' => '\ '],
[['modelClass', 'controllerClass', 'baseControllerClass', 'indexWidgetType'], 'required'],
[['searchModelClass'], 'compare', 'compareAttribute' => 'modelClass', 'operator' => '!==', 'message' => 'Search Model Class must not be equal to Model Class.'],
[['modelClass', 'controllerClass', 'baseControllerClass', 'searchModelClass'], 'match', 'pattern' => '/^[\w\\\\]*$/', 'message' => 'Only word characters and backslashes are allowed.'],
Expand Down Expand Up @@ -389,7 +388,7 @@ public function generateSearchRules()
}

/**
* @return array searchable attributes
* @return string[] searchable attributes
*/
public function getSearchAttributes()
{
Expand All @@ -398,7 +397,7 @@ public function getSearchAttributes()

/**
* Generates the attribute labels for the search model.
* @return array the generated attribute labels (name => label)
* @return string[] the generated attribute labels (name => label)
*/
public function generateSearchLabels()
{
Expand Down Expand Up @@ -551,7 +550,7 @@ public function generateActionParamComments()

/**
* Returns table schema for current model class or false if it is not an active record
* @return \yii\db\TableSchema|bool
* @return \yii\db\TableSchema|false
*/
public function getTableSchema()
{
Expand All @@ -564,7 +563,7 @@ public function getTableSchema()
}

/**
* @return array model column/attribute names
* @return string[] model column/attribute names
*/
public function getColumnNames()
{
Expand Down

0 comments on commit 4f24ccc

Please sign in to comment.