Commit 6488fe47 by Alexander Makarov

Better phpdoc for chained method calls

parent fceb2d6e
......@@ -168,7 +168,7 @@ class ActiveQuery extends Query
/**
* Sets the [[asArray]] property.
* @param boolean $value whether to return the query results in terms of arrays instead of Active Records.
* @return ActiveQuery the query object itself
* @return static the query object itself
*/
public function asArray($value = true)
{
......@@ -196,7 +196,7 @@ class ActiveQuery extends Query
* ))->all();
* ~~~
*
* @return ActiveQuery the query object itself
* @return static the query object itself
*/
public function with()
{
......@@ -223,12 +223,11 @@ class ActiveQuery extends Query
* }
* ~~~
*
* @return ActiveQuery the query object itself
* @return static the query object itself
*/
public function indexBy($column)
{
$this->indexBy = $column;
return $this;
parent::indexBy($column);
}
private function createModels($rows)
......
......@@ -66,7 +66,7 @@ class ActiveRelation extends ActiveQuery
* @param string $relationName the relation name. This refers to a relation declared in [[primaryModel]].
* @param callable $callable a PHP callback for customizing the relation associated with the pivot table.
* Its signature should be `function($query)`, where `$query` is the query to be customized.
* @return ActiveRelation the relation object itself.
* @return static the relation object itself.
*/
public function via($relationName, $callable = null)
{
......@@ -86,7 +86,7 @@ class ActiveRelation extends ActiveQuery
* in the [[primaryModel]] table.
* @param callable $callable a PHP callback for customizing the relation associated with the pivot table.
* Its signature should be `function($query)`, where `$query` is the query to be customized.
* @return ActiveRelation
* @return static
*/
public function viaTable($tableName, $link, $callable = null)
{
......
......@@ -88,7 +88,7 @@ class Command extends \yii\base\Component
* Specifies the SQL statement to be executed.
* The previous SQL execution (if any) will be cancelled, and [[params]] will be cleared as well.
* @param string $sql the SQL statement to be set.
* @return Command this command instance
* @return static this command instance
*/
public function setSql($sql)
{
......@@ -174,7 +174,7 @@ class Command extends \yii\base\Component
* @param integer $dataType SQL data type of the parameter. If null, the type is determined by the PHP type of the value.
* @param integer $length length of the data type
* @param mixed $driverOptions the driver-specific options
* @return Command the current command being executed
* @return static the current command being executed
* @see http://www.php.net/manual/en/function.PDOStatement-bindParam.php
*/
public function bindParam($name, &$value, $dataType = null, $length = null, $driverOptions = null)
......@@ -201,7 +201,7 @@ class Command extends \yii\base\Component
* placeholders, this will be the 1-indexed position of the parameter.
* @param mixed $value The value to bind to the parameter
* @param integer $dataType SQL data type of the parameter. If null, the type is determined by the PHP type of the value.
* @return Command the current command being executed
* @return static the current command being executed
* @see http://www.php.net/manual/en/function.PDOStatement-bindValue.php
*/
public function bindValue($name, $value, $dataType = null)
......@@ -225,7 +225,7 @@ class Command extends \yii\base\Component
* e.g. `array(':name' => 'John', ':age' => 25)`. By default, the PDO type of each value is determined
* by its PHP type. You may explicitly specify the PDO type by using an array: `array(value, type)`,
* e.g. `array(':name' => 'John', ':profile' => array($profile, \PDO::PARAM_LOB))`.
* @return Command the current command being executed
* @return static the current command being executed
*/
public function bindValues($values)
{
......
......@@ -166,7 +166,7 @@ class Query extends Component
* }
* ~~~
*
* @return Query the query object itself
* @return static the query object itself
*/
public function indexBy($column)
{
......@@ -325,7 +325,7 @@ class Query extends Component
* (which means the column contains a DB expression).
* @param string $option additional option that should be appended to the 'SELECT' keyword. For example,
* in MySQL, the option 'SQL_CALC_FOUND_ROWS' can be used.
* @return Query the query object itself
* @return static the query object itself
*/
public function select($columns, $option = null)
{
......@@ -340,7 +340,7 @@ class Query extends Component
/**
* Sets the value indicating whether to SELECT DISTINCT or not.
* @param bool $value whether to SELECT DISTINCT or not.
* @return Query the query object itself
* @return static the query object itself
*/
public function distinct($value = true)
{
......@@ -355,7 +355,7 @@ class Query extends Component
* Table names can contain schema prefixes (e.g. `'public.tbl_user'`) and/or table aliases (e.g. `'tbl_user u'`).
* The method will automatically quote the table names unless it contains some parenthesis
* (which means the table is given as a sub-query or DB expression).
* @return Query the query object itself
* @return static the query object itself
*/
public function from($tables)
{
......@@ -431,7 +431,7 @@ class Query extends Component
*
* @param string|array $condition the conditions that should be put in the WHERE part.
* @param array $params the parameters (name => value) to be bound to the query.
* @return Query the query object itself
* @return static the query object itself
* @see andWhere()
* @see orWhere()
*/
......@@ -448,7 +448,7 @@ class Query extends Component
* @param string|array $condition the new WHERE condition. Please refer to [[where()]]
* on how to specify this parameter.
* @param array $params the parameters (name => value) to be bound to the query.
* @return Query the query object itself
* @return static the query object itself
* @see where()
* @see orWhere()
*/
......@@ -469,7 +469,7 @@ class Query extends Component
* @param string|array $condition the new WHERE condition. Please refer to [[where()]]
* on how to specify this parameter.
* @param array $params the parameters (name => value) to be bound to the query.
* @return Query the query object itself
* @return static the query object itself
* @see where()
* @see andWhere()
*/
......@@ -560,7 +560,7 @@ class Query extends Component
* Columns can be specified in either a string (e.g. "id, name") or an array (e.g. array('id', 'name')).
* The method will automatically quote the column names unless a column contains some parenthesis
* (which means the column contains a DB expression).
* @return Query the query object itself
* @return static the query object itself
* @see addGroupBy()
*/
public function groupBy($columns)
......@@ -578,7 +578,7 @@ class Query extends Component
* Columns can be specified in either a string (e.g. "id, name") or an array (e.g. array('id', 'name')).
* The method will automatically quote the column names unless a column contains some parenthesis
* (which means the column contains a DB expression).
* @return Query the query object itself
* @return static the query object itself
* @see groupBy()
*/
public function addGroupBy($columns)
......@@ -599,7 +599,7 @@ class Query extends Component
* @param string|array $condition the conditions to be put after HAVING.
* Please refer to [[where()]] on how to specify this parameter.
* @param array $params the parameters (name => value) to be bound to the query.
* @return Query the query object itself
* @return static the query object itself
* @see andHaving()
* @see orHaving()
*/
......@@ -616,7 +616,7 @@ class Query extends Component
* @param string|array $condition the new HAVING condition. Please refer to [[where()]]
* on how to specify this parameter.
* @param array $params the parameters (name => value) to be bound to the query.
* @return Query the query object itself
* @return static the query object itself
* @see having()
* @see orHaving()
*/
......@@ -637,7 +637,7 @@ class Query extends Component
* @param string|array $condition the new HAVING condition. Please refer to [[where()]]
* on how to specify this parameter.
* @param array $params the parameters (name => value) to be bound to the query.
* @return Query the query object itself
* @return static the query object itself
* @see having()
* @see andHaving()
*/
......@@ -659,7 +659,7 @@ class Query extends Component
* (e.g. `array('id' => Query::SORT_ASC, 'name' => Query::SORT_DESC)`).
* The method will automatically quote the column names unless a column contains some parenthesis
* (which means the column contains a DB expression).
* @return Query the query object itself
* @return static the query object itself
* @see addOrderBy()
*/
public function orderBy($columns)
......@@ -675,7 +675,7 @@ class Query extends Component
* (e.g. `array('id' => Query::SORT_ASC, 'name' => Query::SORT_DESC)`).
* The method will automatically quote the column names unless a column contains some parenthesis
* (which means the column contains a DB expression).
* @return Query the query object itself
* @return static the query object itself
* @see orderBy()
*/
public function addOrderBy($columns)
......@@ -710,7 +710,7 @@ class Query extends Component
/**
* Sets the LIMIT part of the query.
* @param integer $limit the limit. Use null or negative value to disable limit.
* @return Query the query object itself
* @return static the query object itself
*/
public function limit($limit)
{
......@@ -721,7 +721,7 @@ class Query extends Component
/**
* Sets the OFFSET part of the query.
* @param integer $offset the offset. Use null or negative value to disable offset.
* @return Query the query object itself
* @return static the query object itself
*/
public function offset($offset)
{
......@@ -732,7 +732,7 @@ class Query extends Component
/**
* Appends a SQL statement using UNION operator.
* @param string|Query $sql the SQL statement to be appended using UNION
* @return Query the query object itself
* @return static the query object itself
*/
public function union($sql)
{
......@@ -744,7 +744,7 @@ class Query extends Component
* Sets the parameters to be bound to the query.
* @param array $params list of query parameter values indexed by parameter placeholders.
* For example, `array(':name' => 'Dan', ':age' => 31)`.
* @return Query the query object itself
* @return static the query object itself
* @see addParams()
*/
public function params($params)
......@@ -757,7 +757,7 @@ class Query extends Component
* Adds additional parameters to be bound to the query.
* @param array $params list of query parameter values indexed by parameter placeholders.
* For example, `array(':name' => 'Dan', ':age' => 31)`.
* @return Query the query object itself
* @return static the query object itself
* @see params()
*/
public function addParams($params)
......
......@@ -32,6 +32,10 @@ class ActiveField extends \yii\widgets\ActiveField
}
}
/**
* Makes filed remember its value between page reloads
* @return static the field object itself
*/
public function sticky()
{
$this->options['class'] .= ' sticky';
......
......@@ -63,7 +63,7 @@ class YiiRequirementChecker
* @param array|string $requirements requirements to be checked.
* If an array, it is treated as the set of requirements;
* If a string, it is treated as the path of the file, which contains the requirements;
* @return YiiRequirementChecker self instance.
* @return static self instance.
*/
function check($requirements)
{
......
......@@ -83,7 +83,7 @@ class HeaderCollection extends Object implements \IteratorAggregate, \ArrayAcces
* If there is already a header with the same name, it will be replaced.
* @param string $name the name of the header
* @param string $value the value of the header
* @return HeaderCollection the collection object itself
* @return static the collection object itself
*/
public function set($name, $value = '')
{
......@@ -98,7 +98,7 @@ class HeaderCollection extends Object implements \IteratorAggregate, \ArrayAcces
* be appended to it instead of replacing it.
* @param string $name the name of the header
* @param string $value the value of the header
* @return HeaderCollection the collection object itself
* @return static the collection object itself
*/
public function add($name, $value)
{
......@@ -112,7 +112,7 @@ class HeaderCollection extends Object implements \IteratorAggregate, \ArrayAcces
* If there is already a header with the same name, the new one will be ignored.
* @param string $name the name of the header
* @param string $value the value of the header
* @return HeaderCollection the collection object itself
* @return static the collection object itself
*/
public function setDefault($name, $value)
{
......
......@@ -605,7 +605,7 @@ class Response extends \yii\base\Response
* @param integer $statusCode the HTTP status code. If null, it will use 302.
* See [[http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html]]
* for details about HTTP status code
* @return Response the response object itself
* @return static the response object itself
*/
public function redirect($url, $statusCode = null)
{
......
......@@ -221,7 +221,7 @@ class ActiveField extends Component
* @param array $options the tag options in terms of name-value pairs. It will be merged with [[labelOptions]].
* The options will be rendered as the attributes of the resulting tag. The values will be HTML-encoded
* using [[Html::encode()]]. If a value is null, the corresponding attribute will not be rendered.
* @return ActiveField the field object itself
* @return static the field object itself
*/
public function label($label = null, $options = array())
{
......@@ -244,7 +244,7 @@ class ActiveField extends Component
*
* - tag: this specifies the tag name. If not set, "div" will be used.
*
* @return ActiveField the field object itself
* @return static the field object itself
*/
public function error($options = array())
{
......@@ -263,7 +263,7 @@ class ActiveField extends Component
*
* - tag: this specifies the tag name. If not set, "div" will be used.
*
* @return ActiveField the field object itself
* @return static the field object itself
*/
public function hint($content, $options = array())
{
......@@ -278,7 +278,7 @@ class ActiveField extends Component
* @param string $type the input type (e.g. 'text', 'password')
* @param array $options the tag options in terms of name-value pairs. These will be rendered as
* the attributes of the resulting tag. The values will be HTML-encoded using [[Html::encode()]].
* @return ActiveField the field object itself
* @return static the field object itself
*/
public function input($type, $options = array())
{
......@@ -293,7 +293,7 @@ class ActiveField extends Component
* unless they are explicitly specified in `$options`.
* @param array $options the tag options in terms of name-value pairs. These will be rendered as
* the attributes of the resulting tag. The values will be HTML-encoded using [[Html::encode()]].
* @return ActiveField the field object itself
* @return static the field object itself
*/
public function textInput($options = array())
{
......@@ -308,7 +308,7 @@ class ActiveField extends Component
* unless they are explicitly specified in `$options`.
* @param array $options the tag options in terms of name-value pairs. These will be rendered as
* the attributes of the resulting tag. The values will be HTML-encoded using [[Html::encode()]].
* @return ActiveField the field object itself
* @return static the field object itself
*/
public function passwordInput($options = array())
{
......@@ -323,7 +323,7 @@ class ActiveField extends Component
* unless they are explicitly specified in `$options`.
* @param array $options the tag options in terms of name-value pairs. These will be rendered as
* the attributes of the resulting tag. The values will be HTML-encoded using [[Html::encode()]].
* @return ActiveField the field object itself
* @return static the field object itself
*/
public function fileInput($options = array())
{
......@@ -339,7 +339,7 @@ class ActiveField extends Component
* The model attribute value will be used as the content in the textarea.
* @param array $options the tag options in terms of name-value pairs. These will be rendered as
* the attributes of the resulting tag. The values will be HTML-encoded using [[Html::encode()]].
* @return ActiveField the field object itself
* @return static the field object itself
*/
public function textarea($options = array())
{
......@@ -367,7 +367,7 @@ class ActiveField extends Component
* @param boolean $enclosedByLabel whether to enclose the radio within the label.
* If true, the method will still use [[template]] to layout the checkbox and the error message
* except that the radio is enclosed by the label tag.
* @return ActiveField the field object itself
* @return static the field object itself
*/
public function radio($options = array(), $enclosedByLabel = true)
{
......@@ -402,7 +402,7 @@ class ActiveField extends Component
* @param boolean $enclosedByLabel whether to enclose the checkbox within the label.
* If true, the method will still use [[template]] to layout the checkbox and the error message
* except that the checkbox is enclosed by the label tag.
* @return ActiveField the field object itself
* @return static the field object itself
*/
public function checkbox($options = array(), $enclosedByLabel = true)
{
......@@ -448,7 +448,7 @@ class ActiveField extends Component
* The rest of the options will be rendered as the attributes of the resulting tag. The values will
* be HTML-encoded using [[Html::encode()]]. If a value is null, the corresponding attribute will not be rendered.
*
* @return ActiveField the field object itself
* @return static the field object itself
*/
public function dropDownList($items, $options = array())
{
......@@ -490,7 +490,7 @@ class ActiveField extends Component
* The rest of the options will be rendered as the attributes of the resulting tag. The values will
* be HTML-encoded using [[Html::encode()]]. If a value is null, the corresponding attribute will not be rendered.
*
* @return ActiveField the field object itself
* @return static the field object itself
*/
public function listBox($items, $options = array())
{
......@@ -522,7 +522,7 @@ class ActiveField extends Component
* where $index is the zero-based index of the checkbox in the whole list; $label
* is the label for the checkbox; and $name, $value and $checked represent the name,
* value and the checked status of the checkbox input.
* @return ActiveField the field object itself
* @return static the field object itself
*/
public function checkboxList($items, $options = array())
{
......@@ -552,7 +552,7 @@ class ActiveField extends Component
* where $index is the zero-based index of the radio button in the whole list; $label
* is the label for the radio button; and $name, $value and $checked represent the name,
* value and the checked status of the radio button input.
* @return ActiveField the field object itself
* @return static the field object itself
*/
public function radioList($items, $options = array())
{
......@@ -571,7 +571,7 @@ class ActiveField extends Component
*
* @param string $class the widget class name
* @param array $config name-value pairs that will be used to initialize the widget
* @return ActiveField the field object itself
* @return static the field object itself
*/
public function widget($class, $config = array())
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment