diff --git a/apps/advanced/backend/config/main.php b/apps/advanced/backend/config/main.php
index 07658dd..f2745e2 100644
--- a/apps/advanced/backend/config/main.php
+++ b/apps/advanced/backend/config/main.php
@@ -1,5 +1,5 @@
'app-backend',
'basePath' => dirname(__DIR__),
- 'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',
+ 'vendorPath' => $rootDir . '/vendor',
'preload' => ['log'],
'controllerNamespace' => 'backend\controllers',
'modules' => [],
- 'extensions' => require(__DIR__ . '/../../vendor/yiisoft/extensions.php'),
+ 'extensions' => require($rootDir . '/vendor/yiisoft/extensions.php'),
'components' => [
'request' => [
'enableCsrfValidation' => true,
diff --git a/apps/advanced/backend/controllers/SiteController.php b/apps/advanced/backend/controllers/SiteController.php
index 6850fe9..ecf684c 100644
--- a/apps/advanced/backend/controllers/SiteController.php
+++ b/apps/advanced/backend/controllers/SiteController.php
@@ -50,7 +50,7 @@ class SiteController extends Controller
$model = new LoginForm();
if ($model->load($_POST) && $model->login()) {
- return $this->goHome();
+ return $this->goBack();
} else {
return $this->render('login', [
'model' => $model,
diff --git a/apps/advanced/backend/views/layouts/main.php b/apps/advanced/backend/views/layouts/main.php
index 0e9d501..0ef33d0 100644
--- a/apps/advanced/backend/views/layouts/main.php
+++ b/apps/advanced/backend/views/layouts/main.php
@@ -6,8 +6,8 @@ use yii\bootstrap\NavBar;
use yii\widgets\Breadcrumbs;
/**
- * @var $this \yii\web\View
- * @var $content string
+ * @var \yii\web\View $this
+ * @var string $content
*/
AppAsset::register($this);
?>
@@ -45,9 +45,9 @@ AppAsset::register($this);
?>
- =Breadcrumbs::widget([
+ = Breadcrumbs::widget([
'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
- ]); ?>
+ ]) ?>
= $content ?>
diff --git a/apps/advanced/frontend/controllers/SiteController.php b/apps/advanced/frontend/controllers/SiteController.php
index 02b9bca..184d16c 100644
--- a/apps/advanced/frontend/controllers/SiteController.php
+++ b/apps/advanced/frontend/controllers/SiteController.php
@@ -60,7 +60,7 @@ class SiteController extends Controller
$model = new LoginForm();
if ($model->load($_POST) && $model->login()) {
- return $this->goHome();
+ return $this->goBack();
} else {
return $this->render('login', [
'model' => $model,
diff --git a/apps/advanced/frontend/views/emails/passwordResetToken.php b/apps/advanced/frontend/views/emails/passwordResetToken.php
index ac2155c..b617bd9 100644
--- a/apps/advanced/frontend/views/emails/passwordResetToken.php
+++ b/apps/advanced/frontend/views/emails/passwordResetToken.php
@@ -9,8 +9,8 @@ use yii\helpers\Html;
$resetLink = Yii::$app->urlManager->createAbsoluteUrl('site/reset-password', ['token' => $user->password_reset_token]);
?>
-Hello =Html::encode($user->username)?>,
+Hello = Html::encode($user->username) ?>,
Follow the link below to reset your password:
-=Html::a(Html::encode($resetLink), $resetLink)?>
+= Html::a(Html::encode($resetLink), $resetLink) ?>
diff --git a/apps/advanced/frontend/views/layouts/main.php b/apps/advanced/frontend/views/layouts/main.php
index 5da179c..d00b837 100644
--- a/apps/advanced/frontend/views/layouts/main.php
+++ b/apps/advanced/frontend/views/layouts/main.php
@@ -1,14 +1,14 @@
@@ -49,10 +49,10 @@ AppAsset::register($this);
?>
- =Breadcrumbs::widget([
+ = Breadcrumbs::widget([
'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
- ]); ?>
- =Alert::widget()?>
+ ]) ?>
+ = Alert::widget() ?>
= $content ?>
diff --git a/apps/advanced/frontend/views/site/login.php b/apps/advanced/frontend/views/site/login.php
index 74c5ffa..75dd4ca 100644
--- a/apps/advanced/frontend/views/site/login.php
+++ b/apps/advanced/frontend/views/site/login.php
@@ -22,7 +22,7 @@ $this->params['breadcrumbs'][] = $this->title;
= $form->field($model, 'password')->passwordInput() ?>
= $form->field($model, 'rememberMe')->checkbox() ?>
- If you forgot your password you can =Html::a('reset it', ['site/request-password-reset'])?>.
+ If you forgot your password you can = Html::a('reset it', ['site/request-password-reset']) ?>.
= Html::submitButton('Login', ['class' => 'btn btn-primary']) ?>
diff --git a/apps/basic/views/layouts/main.php b/apps/basic/views/layouts/main.php
index 278aa1d..3bc4d37 100644
--- a/apps/basic/views/layouts/main.php
+++ b/apps/basic/views/layouts/main.php
@@ -3,12 +3,13 @@ use yii\helpers\Html;
use yii\bootstrap\Nav;
use yii\bootstrap\NavBar;
use yii\widgets\Breadcrumbs;
+use app\config\AppAsset;
/**
- * @var $this \yii\web\View
- * @var $content string
+ * @var \yii\web\View $this
+ * @var string $content
*/
-app\config\AppAsset::register($this);
+AppAsset::register($this);
?>
beginPage(); ?>
@@ -36,7 +37,7 @@ app\config\AppAsset::register($this);
['label' => 'Contact', 'url' => ['/site/contact']],
Yii::$app->user->isGuest ?
['label' => 'Login', 'url' => ['/site/login']] :
- ['label' => 'Logout (' . Yii::$app->user->identity->username .')' ,
+ ['label' => 'Logout (' . Yii::$app->user->identity->username . ')' ,
'url' => ['/site/logout'],
'linkOptions' => ['data-method' => 'post']],
],
@@ -45,9 +46,9 @@ app\config\AppAsset::register($this);
?>
- =Breadcrumbs::widget([
+ = Breadcrumbs::widget([
'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
- ]); ?>
+ ]) ?>
= $content ?>
diff --git a/extensions/bootstrap/composer.json b/extensions/bootstrap/composer.json
index b8eaacf..e80de80 100644
--- a/extensions/bootstrap/composer.json
+++ b/extensions/bootstrap/composer.json
@@ -11,7 +11,12 @@
"irc": "irc://irc.freenode.net/yii",
"source": "https://github.com/yiisoft/yii2"
},
- "minimum-stability": "dev",
+ "authors": [
+ {
+ "name": "Qiang Xue",
+ "email": "qiang.xue@gmail.com"
+ }
+ ],
"require": {
"yiisoft/yii2": "*",
"twbs/bootstrap": "3.0.*"
diff --git a/extensions/composer/composer.json b/extensions/composer/composer.json
index ff0785c..652ee14 100644
--- a/extensions/composer/composer.json
+++ b/extensions/composer/composer.json
@@ -17,7 +17,6 @@
"email": "qiang.xue@gmail.com"
}
],
- "minimum-stability": "dev",
"autoload": {
"psr-0": { "yii\\composer\\": "" }
},
diff --git a/extensions/debug/composer.json b/extensions/debug/composer.json
index e1e57b2..f60d1df 100644
--- a/extensions/debug/composer.json
+++ b/extensions/debug/composer.json
@@ -11,7 +11,12 @@
"irc": "irc://irc.freenode.net/yii",
"source": "https://github.com/yiisoft/yii2"
},
- "minimum-stability": "dev",
+ "authors": [
+ {
+ "name": "Qiang Xue",
+ "email": "qiang.xue@gmail.com"
+ }
+ ],
"require": {
"yiisoft/yii2": "*",
"yiisoft/yii2-bootstrap": "*"
diff --git a/extensions/gii/composer.json b/extensions/gii/composer.json
index fc74a7e..8654621 100644
--- a/extensions/gii/composer.json
+++ b/extensions/gii/composer.json
@@ -11,7 +11,12 @@
"irc": "irc://irc.freenode.net/yii",
"source": "https://github.com/yiisoft/yii2"
},
- "minimum-stability": "dev",
+ "authors": [
+ {
+ "name": "Qiang Xue",
+ "email": "qiang.xue@gmail.com"
+ }
+ ],
"require": {
"yiisoft/yii2": "*",
"yiisoft/yii2-bootstrap": "*"
diff --git a/extensions/gii/views/default/index.php b/extensions/gii/views/default/index.php
index f6d6855..2e48816 100644
--- a/extensions/gii/views/default/index.php
+++ b/extensions/gii/views/default/index.php
@@ -2,10 +2,10 @@
use yii\helpers\Html;
/**
- * @var $this \yii\web\View
- * @var $content string
- * @var yii\gii\Generator[] $generators
- * @var yii\gii\Generator $activeGenerator
+ * @var \yii\web\View $this
+ * @var \yii\gii\Generator[] $generators
+ * @var \yii\gii\Generator $activeGenerator
+ * @var string $content
*/
$generators = Yii::$app->controller->module->generators;
$activeGenerator = Yii::$app->controller->generator;
diff --git a/extensions/gii/views/default/view/files.php b/extensions/gii/views/default/view/files.php
index 3da2d97..d8d5f0f 100644
--- a/extensions/gii/views/default/view/files.php
+++ b/extensions/gii/views/default/view/files.php
@@ -4,8 +4,8 @@ use yii\helpers\Html;
use yii\gii\CodeFile;
/**
- * @var $this \yii\web\View
- * @var $generator \yii\gii\Generator
+ * @var \yii\web\View $this
+ * @var \yii\gii\Generator $generator
* @var CodeFile[] $files
* @var array $answers
*/
diff --git a/extensions/gii/views/layouts/generator.php b/extensions/gii/views/layouts/generator.php
index c03f09a..245cd29 100644
--- a/extensions/gii/views/layouts/generator.php
+++ b/extensions/gii/views/layouts/generator.php
@@ -2,10 +2,10 @@
use yii\helpers\Html;
/**
- * @var $this \yii\web\View
- * @var $content string
- * @var yii\gii\Generator[] $generators
- * @var yii\gii\Generator $activeGenerator
+ * @var \yii\web\View $this
+ * @var \yii\gii\Generator[] $generators
+ * @var \yii\gii\Generator $activeGenerator
+ * @var string $content
*/
$generators = Yii::$app->controller->module->generators;
$activeGenerator = Yii::$app->controller->generator;
diff --git a/extensions/gii/views/layouts/main.php b/extensions/gii/views/layouts/main.php
index 69afeb2..baea45e 100644
--- a/extensions/gii/views/layouts/main.php
+++ b/extensions/gii/views/layouts/main.php
@@ -4,8 +4,8 @@ use yii\bootstrap\Nav;
use yii\helpers\Html;
/**
- * @var $this \yii\web\View
- * @var $content string
+ * @var \yii\web\View $this
+ * @var string $content
*/
$asset = yii\gii\GiiAsset::register($this);
?>
diff --git a/extensions/jui/composer.json b/extensions/jui/composer.json
index 0888ab1..ff54422 100644
--- a/extensions/jui/composer.json
+++ b/extensions/jui/composer.json
@@ -11,7 +11,12 @@
"irc": "irc://irc.freenode.net/yii",
"source": "https://github.com/yiisoft/yii2"
},
- "minimum-stability": "dev",
+ "authors": [
+ {
+ "name": "Qiang Xue",
+ "email": "qiang.xue@gmail.com"
+ }
+ ],
"require": {
"yiisoft/yii2": "*"
},
diff --git a/extensions/smarty/composer.json b/extensions/smarty/composer.json
index 566187a..88b75a3 100644
--- a/extensions/smarty/composer.json
+++ b/extensions/smarty/composer.json
@@ -17,10 +17,9 @@
"email": "sam@rmcreative.ru"
}
],
- "minimum-stability": "dev",
"require": {
"yiisoft/yii2": "*",
- "smarty/smarty": ">=v3.1.13"
+ "smarty/smarty": "*"
},
"autoload": {
"psr-0": { "yii\\smarty\\": "" }
diff --git a/extensions/swiftmailer/Message.php b/extensions/swiftmailer/Message.php
index bc9c14a..b0ebd63 100644
--- a/extensions/swiftmailer/Message.php
+++ b/extensions/swiftmailer/Message.php
@@ -192,7 +192,7 @@ class Message extends BaseMessage
$partFound = false;
foreach ($parts as $key => $part) {
if (!($part instanceof \Swift_Mime_Attachment)) {
- /* @var $part \Swift_Mime_MimePart */
+ /* @var \Swift_Mime_MimePart $part */
if ($part->getContentType() == $contentType) {
unset($parts[$key]);
$partFound = true;
diff --git a/extensions/swiftmailer/composer.json b/extensions/swiftmailer/composer.json
index e995b2f..5a47397 100644
--- a/extensions/swiftmailer/composer.json
+++ b/extensions/swiftmailer/composer.json
@@ -17,10 +17,9 @@
"email": "klimov.paul@gmail.com"
}
],
- "minimum-stability": "dev",
"require": {
"yiisoft/yii2": "*",
- "swiftmailer/swiftmailer": "@stable"
+ "swiftmailer/swiftmailer": "*"
},
"autoload": {
"psr-0": { "yii\\swiftmailer\\": "" }
diff --git a/extensions/twig/composer.json b/extensions/twig/composer.json
index c57c65d..8fe6431 100644
--- a/extensions/twig/composer.json
+++ b/extensions/twig/composer.json
@@ -17,10 +17,9 @@
"email": "sam@rmcreative.ru"
}
],
- "minimum-stability": "dev",
"require": {
"yiisoft/yii2": "*",
- "twig/twig": "1.13.*"
+ "twig/twig": "*"
},
"autoload": {
"psr-0": { "yii\\twig\\": "" }
diff --git a/framework/composer.json b/framework/composer.json
index 0d8a407..637471c 100644
--- a/framework/composer.json
+++ b/framework/composer.json
@@ -65,10 +65,10 @@
},
"require": {
"php": ">=5.4.0",
- "yiisoft/yii2-composer": "*",
- "yiisoft/jquery": "1.10.*",
"ext-mbstring": "*",
"lib-pcre": "*",
+ "yiisoft/yii2-composer": "*",
+ "yiisoft/jquery": "1.10.*",
"phpspec/php-diff": ">=1.0.2",
"ezyang/htmlpurifier": "4.5.*",
"michelf/php-markdown": "1.3.*"
diff --git a/framework/yii/BaseYii.php b/framework/yii/BaseYii.php
index 011a9c7..357a1e7 100644
--- a/framework/yii/BaseYii.php
+++ b/framework/yii/BaseYii.php
@@ -63,8 +63,7 @@ class BaseYii
* The array keys are the class names (without leading backslashes), and the array values
* are the corresponding class file paths (or path aliases). This property mainly affects
* how [[autoload()]] works.
- * @see import
- * @see autoload
+ * @see autoload()
*/
public static $classMap = [];
/**
@@ -73,8 +72,8 @@ class BaseYii
public static $app;
/**
* @var array registered path aliases
- * @see getAlias
- * @see setAlias
+ * @see getAlias()
+ * @see setAlias()
*/
public static $aliases = ['@yii' => __DIR__];
/**
@@ -95,7 +94,7 @@ class BaseYii
* ]
* ~~~
*
- * @see createObject
+ * @see createObject()
*/
public static $objectConfig = [];
@@ -136,7 +135,7 @@ class BaseYii
* If this is false and an invalid alias is given, false will be returned by this method.
* @return string|boolean the path corresponding to the alias, false if the root alias is not previously registered.
* @throws InvalidParamException if the alias is invalid while $throwException is true.
- * @see setAlias
+ * @see setAlias()
*/
public static function getAlias($alias, $throwException = true)
{
@@ -219,7 +218,7 @@ class BaseYii
* actual path first by calling [[getAlias()]].
*
* @throws InvalidParamException if $path is an invalid alias.
- * @see getAlias
+ * @see getAlias()
*/
public static function setAlias($alias, $path)
{
@@ -368,7 +367,7 @@ class BaseYii
}
if (($n = func_num_args()) > 1) {
- /** @var $reflection \ReflectionClass */
+ /** @var \ReflectionClass $reflection */
if (isset($reflections[$class])) {
$reflection = $reflections[$class];
} else {
@@ -450,7 +449,7 @@ class BaseYii
* ~~~
* @param string $token token for the code block
* @param string $category the category of this log message
- * @see endProfile
+ * @see endProfile()
*/
public static function beginProfile($token, $category = 'application')
{
@@ -462,7 +461,7 @@ class BaseYii
* This has to be matched with a previous call to [[beginProfile]] with the same category name.
* @param string $token token for the code block
* @param string $category the category of this log message
- * @see beginProfile
+ * @see beginProfile()
*/
public static function endProfile($token, $category = 'application')
{
diff --git a/framework/yii/base/ActionFilter.php b/framework/yii/base/ActionFilter.php
index 60be177..648211c 100644
--- a/framework/yii/base/ActionFilter.php
+++ b/framework/yii/base/ActionFilter.php
@@ -8,6 +8,11 @@
namespace yii\base;
/**
+ * ActionFilter provides a base implementation for action filters that can be added to a controller
+ * to handle the `beforeAction` event.
+ *
+ * Check implementation of [[AccessControl]], [[PageCache]] and [[HttpCache]] as examples on how to use it.
+ *
* @author Qiang Xue
* @since 2.0
*/
diff --git a/framework/yii/base/Application.php b/framework/yii/base/Application.php
index 1dbe8e7..b729158 100644
--- a/framework/yii/base/Application.php
+++ b/framework/yii/base/Application.php
@@ -616,10 +616,8 @@ abstract class Application extends Module
{
$category = get_class($exception);
if ($exception instanceof HttpException) {
- /** @var $exception HttpException */
$category .= '\\' . $exception->statusCode;
} elseif ($exception instanceof \ErrorException) {
- /** @var $exception \ErrorException */
$category .= '\\' . $exception->getSeverity();
}
Yii::error((string)$exception, $category);
diff --git a/framework/yii/base/Component.php b/framework/yii/base/Component.php
index b67a09f..2ef4ead 100644
--- a/framework/yii/base/Component.php
+++ b/framework/yii/base/Component.php
@@ -10,6 +10,8 @@ namespace yii\base;
use Yii;
/**
+ * Component is the base class that implements the *property*, *event* and *behavior* features.
+ *
* @include @yii/base/Component.md
*
* @property Behavior[] $behaviors List of behaviors attached to this component. This property is read-only.
@@ -41,7 +43,7 @@ class Component extends Object
* @return mixed the property value or the value of a behavior's property
* @throws UnknownPropertyException if the property is not defined
* @throws InvalidCallException if the property is write-only.
- * @see __set
+ * @see __set()
*/
public function __get($name)
{
@@ -80,7 +82,7 @@ class Component extends Object
* @param mixed $value the property value
* @throws UnknownPropertyException if the property is not defined
* @throws InvalidCallException if the property is read-only.
- * @see __get
+ * @see __get()
*/
public function __set($name, $value)
{
@@ -225,8 +227,8 @@ class Component extends Object
* @param boolean $checkVars whether to treat member variables as properties
* @param boolean $checkBehaviors whether to treat behaviors' properties as properties of this component
* @return boolean whether the property is defined
- * @see canGetProperty
- * @see canSetProperty
+ * @see canGetProperty()
+ * @see canSetProperty()
*/
public function hasProperty($name, $checkVars = true, $checkBehaviors = true)
{
@@ -246,7 +248,7 @@ class Component extends Object
* @param boolean $checkVars whether to treat member variables as properties
* @param boolean $checkBehaviors whether to treat behaviors' properties as properties of this component
* @return boolean whether the property can be read
- * @see canSetProperty
+ * @see canSetProperty()
*/
public function canGetProperty($name, $checkVars = true, $checkBehaviors = true)
{
@@ -276,7 +278,7 @@ class Component extends Object
* @param boolean $checkVars whether to treat member variables as properties
* @param boolean $checkBehaviors whether to treat behaviors' properties as properties of this component
* @return boolean whether the property can be written
- * @see canGetProperty
+ * @see canGetProperty()
*/
public function canSetProperty($name, $checkVars = true, $checkBehaviors = true)
{
@@ -492,7 +494,7 @@ class Component extends Object
* - an object configuration array that will be passed to [[Yii::createObject()]] to create the behavior object.
*
* @return Behavior the behavior object
- * @see detachBehavior
+ * @see detachBehavior()
*/
public function attachBehavior($name, $behavior)
{
@@ -505,7 +507,7 @@ class Component extends Object
* Each behavior is indexed by its name and should be a [[Behavior]] object,
* a string specifying the behavior class, or an configuration array for creating the behavior.
* @param array $behaviors list of behaviors to be attached to the component
- * @see attachBehavior
+ * @see attachBehavior()
*/
public function attachBehaviors($behaviors)
{
diff --git a/framework/yii/base/Controller.php b/framework/yii/base/Controller.php
index d2f491c..c8f2d48 100644
--- a/framework/yii/base/Controller.php
+++ b/framework/yii/base/Controller.php
@@ -111,7 +111,7 @@ class Controller extends Component implements ViewContextInterface
* @param array $params the parameters (name-value pairs) to be passed to the action.
* @return mixed the result of the action
* @throws InvalidRouteException if the requested action ID cannot be resolved into an action successfully.
- * @see createAction
+ * @see createAction()
*/
public function runAction($id, $params = [])
{
@@ -149,8 +149,7 @@ class Controller extends Component implements ViewContextInterface
* @param string $route the route to be handled, e.g., 'view', 'comment/view', '/admin/comment/view'.
* @param array $params the parameters to be passed to the action.
* @return mixed the result of the action
- * @see runAction
- * @see forward
+ * @see runAction()
*/
public function run($route, $params = [])
{
diff --git a/framework/yii/base/ErrorHandler.php b/framework/yii/base/ErrorHandler.php
index ead9646..c96ca5e 100644
--- a/framework/yii/base/ErrorHandler.php
+++ b/framework/yii/base/ErrorHandler.php
@@ -16,6 +16,9 @@ use yii\web\HttpException;
* ErrorHandler displays these errors using appropriate views based on the
* nature of the errors and the mode the application runs at.
*
+ * ErrorHandler is configured as an application component in [[yii\base\Application]] by default.
+ * You can access that instance via `Yii::$app->errorHandler`.
+ *
* @author Qiang Xue
* @author Timur Ruziev
* @since 2.0
diff --git a/framework/yii/base/Formatter.php b/framework/yii/base/Formatter.php
index 18faaff..30df3c3 100644
--- a/framework/yii/base/Formatter.php
+++ b/framework/yii/base/Formatter.php
@@ -19,6 +19,9 @@ use yii\helpers\Html;
* The behavior of some of them may be configured via the properties of Formatter. For example,
* by configuring [[dateFormat]], one may control how [[asDate()]] formats the value into a date string.
*
+ * Formatter is configured as an application component in [[yii\base\Application]] by default.
+ * You can access that instance via `Yii::$app->formatter`.
+ *
* @author Qiang Xue
* @since 2.0
*/
diff --git a/framework/yii/base/Model.php b/framework/yii/base/Model.php
index 99c1df9..8090ebc 100644
--- a/framework/yii/base/Model.php
+++ b/framework/yii/base/Model.php
@@ -46,7 +46,8 @@ use yii\validators\Validator;
* @property ArrayIterator $iterator An iterator for traversing the items in the list. This property is
* read-only.
* @property string $scenario The scenario that this model is in. Defaults to [[DEFAULT_SCENARIO]].
- * @property ArrayObject $validators All the validators declared in the model. This property is read-only.
+ * @property ArrayObject|\yii\validators\Validator[] $validators All the validators declared in the model.
+ * This property is read-only.
*
* @author Qiang Xue
* @since 2.0
@@ -144,7 +145,7 @@ class Model extends Component implements IteratorAggregate, ArrayAccess
* merge the parent rules with child rules using functions such as `array_merge()`.
*
* @return array validation rules
- * @see scenarios
+ * @see scenarios()
*/
public function rules()
{
@@ -255,7 +256,7 @@ class Model extends Component implements IteratorAggregate, ArrayAccess
* merge the parent labels with child labels using functions such as `array_merge()`.
*
* @return array attribute labels (name => label)
- * @see generateAttributeLabel
+ * @see generateAttributeLabel()
*/
public function attributeLabels()
{
@@ -349,7 +350,7 @@ class Model extends Component implements IteratorAggregate, ArrayAccess
* $model->validators[] = $newValidator;
* ~~~
*
- * @return ArrayObject all the validators declared in the model.
+ * @return ArrayObject|\yii\validators\Validator[] all the validators declared in the model.
*/
public function getValidators()
{
@@ -369,7 +370,6 @@ class Model extends Component implements IteratorAggregate, ArrayAccess
{
$validators = [];
$scenario = $this->getScenario();
- /** @var $validator Validator */
foreach ($this->getValidators() as $validator) {
if ($validator->isActive($scenario) && ($attribute === null || in_array($attribute, $validator->attributes, true))) {
$validators[] = $validator;
@@ -444,8 +444,8 @@ class Model extends Component implements IteratorAggregate, ArrayAccess
* Returns the text label for the specified attribute.
* @param string $attribute the attribute name
* @return string the attribute label
- * @see generateAttributeLabel
- * @see attributeLabels
+ * @see generateAttributeLabel()
+ * @see attributeLabels()
*/
public function getAttributeLabel($attribute)
{
@@ -483,8 +483,8 @@ class Model extends Component implements IteratorAggregate, ArrayAccess
* ]
* ~~~
*
- * @see getFirstErrors
- * @see getFirstError
+ * @see getFirstErrors()
+ * @see getFirstError()
*/
public function getErrors($attribute = null)
{
@@ -498,8 +498,8 @@ class Model extends Component implements IteratorAggregate, ArrayAccess
/**
* Returns the first error of every attribute in the model.
* @return array the first errors. An empty array will be returned if there is no error.
- * @see getErrors
- * @see getFirstError
+ * @see getErrors()
+ * @see getFirstError()
*/
public function getFirstErrors()
{
@@ -520,8 +520,8 @@ class Model extends Component implements IteratorAggregate, ArrayAccess
* Returns the first error of the specified attribute.
* @param string $attribute attribute name.
* @return string the error message. Null is returned if no error.
- * @see getErrors
- * @see getFirstErrors
+ * @see getErrors()
+ * @see getFirstErrors()
*/
public function getFirstError($attribute)
{
diff --git a/framework/yii/base/Module.php b/framework/yii/base/Module.php
index b3e28f6..1e5302c 100644
--- a/framework/yii/base/Module.php
+++ b/framework/yii/base/Module.php
@@ -578,7 +578,7 @@ abstract class Module extends Component
{
$parts = $this->createController($route);
if (is_array($parts)) {
- /** @var $controller Controller */
+ /** @var Controller $controller */
list($controller, $actionID) = $parts;
$oldController = Yii::$app->controller;
Yii::$app->controller = $controller;
diff --git a/framework/yii/base/Object.php b/framework/yii/base/Object.php
index f0bd92b..06fca50 100644
--- a/framework/yii/base/Object.php
+++ b/framework/yii/base/Object.php
@@ -10,7 +10,10 @@ namespace yii\base;
use Yii;
/**
+ * Object is the base class that implements the *property* feature.
+ *
* @include @yii/base/Object.md
+ *
* @author Qiang Xue
* @since 2.0
*/
@@ -64,7 +67,7 @@ class Object implements Arrayable
* @return mixed the property value
* @throws UnknownPropertyException if the property is not defined
* @throws InvalidCallException if the property is write-only
- * @see __set
+ * @see __set()
*/
public function __get($name)
{
@@ -87,7 +90,7 @@ class Object implements Arrayable
* @param mixed $value the property value
* @throws UnknownPropertyException if the property is not defined
* @throws InvalidCallException if the property is read-only
- * @see __get
+ * @see __get()
*/
public function __set($name, $value)
{
@@ -168,8 +171,8 @@ class Object implements Arrayable
* @param string $name the property name
* @param boolean $checkVars whether to treat member variables as properties
* @return boolean whether the property is defined
- * @see canGetProperty
- * @see canSetProperty
+ * @see canGetProperty()
+ * @see canSetProperty()
*/
public function hasProperty($name, $checkVars = true)
{
@@ -187,7 +190,7 @@ class Object implements Arrayable
* @param string $name the property name
* @param boolean $checkVars whether to treat member variables as properties
* @return boolean whether the property can be read
- * @see canSetProperty
+ * @see canSetProperty()
*/
public function canGetProperty($name, $checkVars = true)
{
@@ -205,7 +208,7 @@ class Object implements Arrayable
* @param string $name the property name
* @param boolean $checkVars whether to treat member variables as properties
* @return boolean whether the property can be written
- * @see canGetProperty
+ * @see canGetProperty()
*/
public function canSetProperty($name, $checkVars = true)
{
diff --git a/framework/yii/base/Request.php b/framework/yii/base/Request.php
index 0d660d6..cd3ffdc 100644
--- a/framework/yii/base/Request.php
+++ b/framework/yii/base/Request.php
@@ -8,6 +8,7 @@
namespace yii\base;
/**
+ * Request represents a request that is handled by an [[Application]].
*
* @property boolean $isConsoleRequest The value indicating whether the current request is made via console.
* @property string $scriptFile Entry script file path (processed w/ realpath()).
diff --git a/framework/yii/base/Response.php b/framework/yii/base/Response.php
index 467de9e..1403b69 100644
--- a/framework/yii/base/Response.php
+++ b/framework/yii/base/Response.php
@@ -8,6 +8,8 @@
namespace yii\base;
/**
+ * Response represents the response of an [[Application]] to a [[Request]].
+ *
* @author Qiang Xue
* @since 2.0
*/
diff --git a/framework/yii/base/View.php b/framework/yii/base/View.php
index c22b3c0..61d9373 100644
--- a/framework/yii/base/View.php
+++ b/framework/yii/base/View.php
@@ -123,7 +123,7 @@ class View extends Component
* existing [[context]] will be used.
* @return string the rendering result
* @throws InvalidParamException if the view cannot be resolved or the view file does not exist.
- * @see renderFile
+ * @see renderFile()
*/
public function render($view, $params = [], $context = null)
{
@@ -410,7 +410,7 @@ class View extends Component
{
$properties['id'] = $id;
$properties['view'] = $this;
- /** @var $cache FragmentCache */
+ /** @var FragmentCache $cache */
$cache = FragmentCache::begin($properties);
if ($cache->getCachedContent() !== false) {
$this->endCache();
diff --git a/framework/yii/base/ViewEvent.php b/framework/yii/base/ViewEvent.php
index b5734f4..d02e180 100644
--- a/framework/yii/base/ViewEvent.php
+++ b/framework/yii/base/ViewEvent.php
@@ -8,6 +8,8 @@
namespace yii\base;
/**
+ * ViewEvent represents events triggered by the [[View]] component.
+ *
* @author Qiang Xue
* @since 2.0
*/
diff --git a/framework/yii/captcha/CaptchaAsset.php b/framework/yii/captcha/CaptchaAsset.php
index adece3c..4fc722f 100644
--- a/framework/yii/captcha/CaptchaAsset.php
+++ b/framework/yii/captcha/CaptchaAsset.php
@@ -10,6 +10,8 @@ namespace yii\captcha;
use yii\web\AssetBundle;
/**
+ * This asset bundle provides the javascript files needed for the [[Captcha]] widget.
+ *
* @author Qiang Xue
* @since 2.0
*/
diff --git a/framework/yii/console/Request.php b/framework/yii/console/Request.php
index d99c321..d4d3af0 100644
--- a/framework/yii/console/Request.php
+++ b/framework/yii/console/Request.php
@@ -8,6 +8,10 @@
namespace yii\console;
/**
+ * The console Request represents the environment information for a console application.
+ *
+ * It is a wrapper for the PHP `$_SERVER` variable which holds information about the
+ * currently running PHP script and the command line arguments given to it.
*
* @property array $params The command line arguments. It does not include the entry script name.
*
diff --git a/framework/yii/console/Response.php b/framework/yii/console/Response.php
index 9c23e83..f6e6dd0 100644
--- a/framework/yii/console/Response.php
+++ b/framework/yii/console/Response.php
@@ -8,6 +8,8 @@
namespace yii\console;
/**
+ * The console Response represents the result of a console application by holding the [[exitCode]].
+ *
* @author Qiang Xue
* @since 2.0
*/
diff --git a/framework/yii/console/controllers/CacheController.php b/framework/yii/console/controllers/CacheController.php
index 1822b73..43932d1 100644
--- a/framework/yii/console/controllers/CacheController.php
+++ b/framework/yii/console/controllers/CacheController.php
@@ -52,7 +52,7 @@ class CacheController extends Controller
*/
public function actionFlush($component = 'cache')
{
- /** @var $cache Cache */
+ /** @var Cache $cache */
$cache = Yii::$app->getComponent($component);
if (!$cache || !$cache instanceof Cache) {
throw new Exception('Application component "'.$component.'" is not defined or not a cache.');
diff --git a/framework/yii/db/ActiveQuery.php b/framework/yii/db/ActiveQuery.php
index 015ce93..608ff5c 100644
--- a/framework/yii/db/ActiveQuery.php
+++ b/framework/yii/db/ActiveQuery.php
@@ -122,7 +122,7 @@ class ActiveQuery extends Query
if ($this->asArray) {
$model = $row;
} else {
- /** @var $class ActiveRecord */
+ /** @var ActiveRecord $class */
$class = $this->modelClass;
$model = $class::create($row);
}
@@ -145,7 +145,7 @@ class ActiveQuery extends Query
*/
public function createCommand($db = null)
{
- /** @var $modelClass ActiveRecord */
+ /** @var ActiveRecord $modelClass */
$modelClass = $this->modelClass;
if ($db === null) {
$db = $modelClass::getDb();
@@ -253,7 +253,7 @@ class ActiveQuery extends Query
$models[$key] = $row;
}
} else {
- /** @var $class ActiveRecord */
+ /** @var ActiveRecord $class */
$class = $this->modelClass;
if ($this->indexBy === null) {
foreach ($rows as $row) {
diff --git a/framework/yii/db/ActiveRecord.php b/framework/yii/db/ActiveRecord.php
index 380eb03..00a99c1 100644
--- a/framework/yii/db/ActiveRecord.php
+++ b/framework/yii/db/ActiveRecord.php
@@ -372,7 +372,7 @@ class ActiveRecord extends Model
* This method is overridden so that attributes and related objects can be accessed like properties.
* @param string $name property name
* @return mixed property value
- * @see getAttribute
+ * @see getAttribute()
*/
public function __get($name)
{
@@ -576,7 +576,7 @@ class ActiveRecord extends Model
* null will be returned.
* @param string $name the attribute name
* @return mixed the attribute value. Null if the attribute is not set or does not exist.
- * @see hasAttribute
+ * @see hasAttribute()
*/
public function getAttribute($name)
{
@@ -588,7 +588,7 @@ class ActiveRecord extends Model
* @param string $name the attribute name
* @param mixed $value the attribute value.
* @throws InvalidParamException if the named attribute does not exist.
- * @see hasAttribute
+ * @see hasAttribute()
*/
public function setAttribute($name, $value)
{
@@ -625,7 +625,7 @@ class ActiveRecord extends Model
* @param string $name the attribute name
* @return mixed the old attribute value. Null if the attribute is not loaded before
* or does not exist.
- * @see hasAttribute
+ * @see hasAttribute()
*/
public function getOldAttribute($name)
{
@@ -637,7 +637,7 @@ class ActiveRecord extends Model
* @param string $name the attribute name
* @param mixed $value the old attribute value.
* @throws InvalidParamException if the named attribute does not exist.
- * @see hasAttribute
+ * @see hasAttribute()
*/
public function setOldAttribute($name, $value)
{
@@ -1030,7 +1030,7 @@ class ActiveRecord extends Model
/**
* Sets the value indicating whether the record is new.
* @param boolean $value whether the record is new and should be inserted when calling [[save()]].
- * @see getIsNewRecord
+ * @see getIsNewRecord()
*/
public function setIsNewRecord($value)
{
@@ -1321,9 +1321,9 @@ class ActiveRecord extends Model
throw new InvalidCallException('Unable to link models: both models must NOT be newly created.');
}
if (is_array($relation->via)) {
- /** @var $viaRelation ActiveRelation */
+ /** @var ActiveRelation $viaRelation */
list($viaName, $viaRelation) = $relation->via;
- /** @var $viaClass ActiveRecord */
+ /** @var ActiveRecord $viaClass */
$viaClass = $viaRelation->modelClass;
$viaTable = $viaClass::tableName();
// unset $viaName so that it can be reloaded to reflect the change
@@ -1396,9 +1396,9 @@ class ActiveRecord extends Model
if ($relation->via !== null) {
if (is_array($relation->via)) {
- /** @var $viaRelation ActiveRelation */
+ /** @var ActiveRelation $viaRelation */
list($viaName, $viaRelation) = $relation->via;
- /** @var $viaClass ActiveRecord */
+ /** @var ActiveRecord $viaClass */
$viaClass = $viaRelation->modelClass;
$viaTable = $viaClass::tableName();
unset($this->_related[$viaName]);
@@ -1444,7 +1444,7 @@ class ActiveRecord extends Model
if (!$relation->multiple) {
unset($this->_related[$name]);
} elseif (isset($this->_related[$name])) {
- /** @var $b ActiveRecord */
+ /** @var ActiveRecord $b */
foreach ($this->_related[$name] as $a => $b) {
if ($model->getPrimaryKey() == $b->getPrimaryKey()) {
unset($this->_related[$name][$a]);
diff --git a/framework/yii/db/ActiveRelation.php b/framework/yii/db/ActiveRelation.php
index 1a7541a..91e21d8 100644
--- a/framework/yii/db/ActiveRelation.php
+++ b/framework/yii/db/ActiveRelation.php
@@ -55,9 +55,11 @@ class ActiveRelation extends ActiveQuery
*/
public function __clone()
{
+ // make a clone of "via" object so that the same query object can be reused multiple times
if (is_object($this->via)) {
- // make a clone of "via" object so that the same query object can be reused multiple times
$this->via = clone $this->via;
+ } elseif (is_array($this->via)) {
+ $this->via = [$this->via[0], clone $this->via[1]];
}
}
@@ -120,7 +122,7 @@ class ActiveRelation extends ActiveQuery
$this->filterByModels($viaModels);
} elseif (is_array($this->via)) {
// via relation
- /** @var $viaQuery ActiveRelation */
+ /** @var ActiveRelation $viaQuery */
list($viaName, $viaQuery) = $this->via;
if ($viaQuery->multiple) {
$viaModels = $viaQuery->all();
@@ -154,13 +156,13 @@ class ActiveRelation extends ActiveQuery
if ($this->via instanceof self) {
// via pivot table
- /** @var $viaQuery ActiveRelation */
+ /** @var ActiveRelation $viaQuery */
$viaQuery = $this->via;
$viaModels = $viaQuery->findPivotRows($primaryModels);
$this->filterByModels($viaModels);
} elseif (is_array($this->via)) {
// via relation
- /** @var $viaQuery ActiveRelation */
+ /** @var ActiveRelation $viaQuery */
list($viaName, $viaQuery) = $this->via;
$viaQuery->primaryModel = null;
$viaModels = $viaQuery->findWith($viaName, $primaryModels);
@@ -306,7 +308,7 @@ class ActiveRelation extends ActiveQuery
return [];
}
$this->filterByModels($primaryModels);
- /** @var $primaryModel ActiveRecord */
+ /** @var ActiveRecord $primaryModel */
$primaryModel = reset($primaryModels);
$db = $primaryModel->getDb();
list ($sql, $params) = $db->getQueryBuilder()->build($this);
diff --git a/framework/yii/db/Command.php b/framework/yii/db/Command.php
index 4dffb01..6ed0d9c 100644
--- a/framework/yii/db/Command.php
+++ b/framework/yii/db/Command.php
@@ -366,7 +366,7 @@ class Command extends \yii\base\Component
Yii::info($rawSql, __METHOD__);
- /** @var $cache \yii\caching\Cache */
+ /** @var \yii\caching\Cache $cache */
if ($db->enableQueryCache && $method !== '') {
$cache = is_string($db->queryCache) ? Yii::$app->getComponent($db->queryCache) : $db->queryCache;
}
diff --git a/framework/yii/db/Query.php b/framework/yii/db/Query.php
index 0839849..142a11d 100644
--- a/framework/yii/db/Query.php
+++ b/framework/yii/db/Query.php
@@ -39,12 +39,12 @@ class Query extends Component
{
/**
* Sort ascending
- * @see orderBy
+ * @see orderBy()
*/
const SORT_ASC = false;
/**
* Sort descending
- * @see orderBy
+ * @see orderBy()
*/
const SORT_DESC = true;
diff --git a/framework/yii/db/Schema.php b/framework/yii/db/Schema.php
index fbcec2c..f2ae94c 100644
--- a/framework/yii/db/Schema.php
+++ b/framework/yii/db/Schema.php
@@ -92,7 +92,7 @@ abstract class Schema extends Object
$realName = $this->getRawTableName($name);
if ($db->enableSchemaCache && !in_array($name, $db->schemaCacheExclude, true)) {
- /** @var $cache Cache */
+ /** @var Cache $cache */
$cache = is_string($db->schemaCache) ? Yii::$app->getComponent($db->schemaCache) : $db->schemaCache;
if ($cache instanceof Cache) {
$key = $this->getCacheKey($name);
@@ -215,7 +215,7 @@ abstract class Schema extends Object
*/
public function refresh()
{
- /** @var $cache Cache */
+ /** @var Cache $cache */
$cache = is_string($this->db->schemaCache) ? Yii::$app->getComponent($this->db->schemaCache) : $this->db->schemaCache;
if ($this->db->enableSchemaCache && $cache instanceof Cache) {
GroupDependency::invalidate($cache, $this->getCacheGroup());
@@ -291,7 +291,7 @@ abstract class Schema extends Object
* then this method will do nothing.
* @param string $name table name
* @return string the properly quoted table name
- * @see quoteSimpleTableName
+ * @see quoteSimpleTableName()
*/
public function quoteTableName($name)
{
@@ -316,7 +316,7 @@ abstract class Schema extends Object
* then this method will do nothing.
* @param string $name column name
* @return string the properly quoted column name
- * @see quoteSimpleColumnName
+ * @see quoteSimpleColumnName()
*/
public function quoteColumnName($name)
{
diff --git a/framework/yii/grid/ActionColumn.php b/framework/yii/grid/ActionColumn.php
index 794198e..2ee1db2 100644
--- a/framework/yii/grid/ActionColumn.php
+++ b/framework/yii/grid/ActionColumn.php
@@ -12,6 +12,8 @@ use Closure;
use yii\helpers\Html;
/**
+ * ActionColumn is a column for the [[GridView]] widget that displays buttons for viewing and manipulating the items.
+ *
* @author Qiang Xue
* @since 2.0
*/
diff --git a/framework/yii/grid/DataColumn.php b/framework/yii/grid/DataColumn.php
index e8a25a7..bd6eacb 100644
--- a/framework/yii/grid/DataColumn.php
+++ b/framework/yii/grid/DataColumn.php
@@ -15,6 +15,10 @@ use yii\helpers\Html;
use yii\helpers\Inflector;
/**
+ * DataColumn is the default column type for the [[GridView]] widget.
+ *
+ * It is used to show data columns and allows sorting them.
+ *
* @author Qiang Xue
* @since 2.0
*/
diff --git a/framework/yii/grid/GridView.php b/framework/yii/grid/GridView.php
index 6cef03a..de99a18 100644
--- a/framework/yii/grid/GridView.php
+++ b/framework/yii/grid/GridView.php
@@ -16,6 +16,10 @@ use yii\helpers\Json;
use yii\widgets\BaseListView;
/**
+ * The GridView widget is used to display data in a grid.
+ *
+ * It provides features like sorting, paging and also filtering the data.
+ *
* @author Qiang Xue
* @since 2.0
*/
diff --git a/framework/yii/grid/GridViewAsset.php b/framework/yii/grid/GridViewAsset.php
index ae49070..a67999d 100644
--- a/framework/yii/grid/GridViewAsset.php
+++ b/framework/yii/grid/GridViewAsset.php
@@ -10,6 +10,7 @@ namespace yii\grid;
use yii\web\AssetBundle;
/**
+ * This asset bundle provides the javascript files for the [[GridView]] widget.
*
* @author Qiang Xue
* @since 2.0
diff --git a/framework/yii/helpers/BaseHtml.php b/framework/yii/helpers/BaseHtml.php
index 9f3df0e..71ad9ea 100644
--- a/framework/yii/helpers/BaseHtml.php
+++ b/framework/yii/helpers/BaseHtml.php
@@ -86,7 +86,7 @@ class BaseHtml
* @param boolean $doubleEncode whether to encode HTML entities in `$content`. If false,
* HTML entities in `$content` will not be further encoded.
* @return string the encoded content
- * @see decode
+ * @see decode()
* @see http://www.php.net/manual/en/function.htmlspecialchars.php
*/
public static function encode($content, $doubleEncode = true)
@@ -99,7 +99,7 @@ class BaseHtml
* This is the opposite of [[encode()]].
* @param string $content the content to be decoded
* @return string the decoded content
- * @see encode
+ * @see encode()
* @see http://www.php.net/manual/en/function.htmlspecialchars-decode.php
*/
public static function decode($content)
@@ -116,8 +116,8 @@ class BaseHtml
* the attributes of the resulting tag. The values will be HTML-encoded using [[encode()]].
* If a value is null, the corresponding attribute will not be rendered.
* @return string the generated HTML tag
- * @see beginTag
- * @see endTag
+ * @see beginTag()
+ * @see endTag()
*/
public static function tag($name, $content = '', $options = [])
{
@@ -132,8 +132,8 @@ class BaseHtml
* the attributes of the resulting tag. The values will be HTML-encoded using [[encode()]].
* If a value is null, the corresponding attribute will not be rendered.
* @return string the generated start tag
- * @see endTag
- * @see tag
+ * @see endTag()
+ * @see tag()
*/
public static function beginTag($name, $options = [])
{
@@ -144,8 +144,8 @@ class BaseHtml
* Generates an end tag.
* @param string $name the tag name
* @return string the generated end tag
- * @see beginTag
- * @see tag
+ * @see beginTag()
+ * @see tag()
*/
public static function endTag($name)
{
@@ -187,7 +187,7 @@ class BaseHtml
* the attributes of the resulting tag. The values will be HTML-encoded using [[encode()]].
* If a value is null, the corresponding attribute will not be rendered.
* @return string the generated link tag
- * @see url
+ * @see url()
*/
public static function cssFile($url, $options = [])
{
@@ -203,7 +203,7 @@ class BaseHtml
* the attributes of the resulting tag. The values will be HTML-encoded using [[encode()]].
* If a value is null, the corresponding attribute will not be rendered.
* @return string the generated script tag
- * @see url
+ * @see url()
*/
public static function jsFile($url, $options = [])
{
@@ -222,7 +222,7 @@ class BaseHtml
* the attributes of the resulting tag. The values will be HTML-encoded using [[encode()]].
* If a value is null, the corresponding attribute will not be rendered.
* @return string the generated form start tag.
- * @see endForm
+ * @see endForm()
*/
public static function beginForm($action = '', $method = 'post', $options = [])
{
@@ -271,7 +271,7 @@ class BaseHtml
/**
* Generates a form end tag.
* @return string the generated tag
- * @see beginForm
+ * @see beginForm()
*/
public static function endForm()
{
@@ -290,7 +290,7 @@ class BaseHtml
* the attributes of the resulting tag. The values will be HTML-encoded using [[encode()]].
* If a value is null, the corresponding attribute will not be rendered.
* @return string the generated hyperlink
- * @see url
+ * @see url()
*/
public static function a($text, $url = null, $options = [])
{
diff --git a/framework/yii/helpers/BaseInflector.php b/framework/yii/helpers/BaseInflector.php
index 8d5fe28..deb8239 100644
--- a/framework/yii/helpers/BaseInflector.php
+++ b/framework/yii/helpers/BaseInflector.php
@@ -328,7 +328,7 @@ class BaseInflector
* Converts a word like "send_email" to "SendEmail". It
* will remove non alphanumeric character from the word, so
* "who's online" will be converted to "WhoSOnline"
- * @see variablize
+ * @see variablize()
* @param string $word the word to CamelCase
* @return string
*/
diff --git a/framework/yii/i18n/Formatter.php b/framework/yii/i18n/Formatter.php
index 1388dc1..2eeb056 100644
--- a/framework/yii/i18n/Formatter.php
+++ b/framework/yii/i18n/Formatter.php
@@ -19,6 +19,15 @@ use yii\base\InvalidConfigException;
* Formatter requires the PHP "intl" extension to be installed. Formatter supports localized
* formatting of date, time and numbers, based on the current [[locale]].
*
+ * This Formatter can replace the `formatter` application component that is configured by default.
+ * To do so, add the following to your application config under `components`:
+ *
+ * ```php
+ * 'formatter' => [
+ * 'class' => 'yii\i18n\Formatter',
+ * ]
+ * ```
+ *
* @author Qiang Xue
* @since 2.0
*/
diff --git a/framework/yii/i18n/I18N.php b/framework/yii/i18n/I18N.php
index fe0b533..5575621 100644
--- a/framework/yii/i18n/I18N.php
+++ b/framework/yii/i18n/I18N.php
@@ -14,6 +14,9 @@ use yii\base\InvalidConfigException;
/**
* I18N provides features related with internationalization (I18N) and localization (L10N).
*
+ * I18N is configured as an application component in [[yii\base\Application]] by default.
+ * You can access that instance via `Yii::$app->i18n`.
+ *
* @property MessageFormatter $messageFormatter The message formatter to be used to format message via ICU
* message format. Note that the type of this property differs in getter and setter. See
* [[getMessageFormatter()]] and [[setMessageFormatter()]] for details.
diff --git a/framework/yii/log/Target.php b/framework/yii/log/Target.php
index cd1256a..c9d5d97 100644
--- a/framework/yii/log/Target.php
+++ b/framework/yii/log/Target.php
@@ -112,7 +112,7 @@ abstract class Target extends Component
{
$context = [];
if ($this->logUser && ($user = Yii::$app->getComponent('user', false)) !== null) {
- /** @var $user \yii\web\User */
+ /** @var \yii\web\User $user */
$context[] = 'User: ' . $user->getId();
}
diff --git a/framework/yii/mail/BaseMailer.php b/framework/yii/mail/BaseMailer.php
index d907918..90565c9 100644
--- a/framework/yii/mail/BaseMailer.php
+++ b/framework/yii/mail/BaseMailer.php
@@ -281,7 +281,7 @@ abstract class BaseMailer extends Component implements MailerInterface, ViewCont
$file = $path . '/' . call_user_func($this->fileTransportCallback, $this, $message);
} else {
$time = microtime(true);
- $file = $path . '/' . date('Ymd-His-', $time) . sprintf('%04d', (int)(($time - (int)$time) * 10000)) . '-' . sprintf('%04d', mt_rand(0, 10000)) . '.txt';
+ $file = $path . '/' . date('Ymd-His-', $time) . sprintf('%04d', (int)(($time - (int)$time) * 10000)) . '-' . sprintf('%04d', mt_rand(0, 10000)) . '.eml';
}
file_put_contents($file, $message->toString());
return true;
diff --git a/framework/yii/rbac/PhpManager.php b/framework/yii/rbac/PhpManager.php
index a91d9bd..57ede09 100644
--- a/framework/yii/rbac/PhpManager.php
+++ b/framework/yii/rbac/PhpManager.php
@@ -36,8 +36,8 @@ class PhpManager extends Manager
* If not set, it will be using 'protected/data/rbac.php' as the data file.
* Make sure this file is writable by the Web server process if the authorization
* needs to be changed.
- * @see loadFromFile
- * @see saveToFile
+ * @see loadFromFile()
+ * @see saveToFile()
*/
public $authFile;
@@ -74,7 +74,7 @@ class PhpManager extends Manager
if (!isset($this->_items[$itemName])) {
return false;
}
- /** @var $item Item */
+ /** @var Item $item */
$item = $this->_items[$itemName];
Yii::trace('Checking permission: ' . $item->getName(), __METHOD__);
if (!isset($params['userId'])) {
@@ -85,7 +85,7 @@ class PhpManager extends Manager
return true;
}
if (isset($this->_assignments[$userId][$itemName])) {
- /** @var $assignment Assignment */
+ /** @var Assignment $assignment */
$assignment = $this->_assignments[$userId][$itemName];
if ($this->executeBizRule($assignment->bizRule, $params, $assignment->data)) {
return true;
@@ -113,9 +113,9 @@ class PhpManager extends Manager
if (!isset($this->_items[$childName], $this->_items[$itemName])) {
throw new Exception("Either '$itemName' or '$childName' does not exist.");
}
- /** @var $child Item */
+ /** @var Item $child */
$child = $this->_items[$childName];
- /** @var $item Item */
+ /** @var Item $item */
$item = $this->_items[$itemName];
$this->checkItemChildType($item->type, $child->type);
if ($this->detectLoop($itemName, $childName)) {
@@ -270,14 +270,14 @@ class PhpManager extends Manager
$items = [];
if ($userId === null) {
foreach ($this->_items as $name => $item) {
- /** @var $item Item */
+ /** @var Item $item */
if ($item->type == $type) {
$items[$name] = $item;
}
}
} elseif (isset($this->_assignments[$userId])) {
foreach ($this->_assignments[$userId] as $assignment) {
- /** @var $assignment Assignment */
+ /** @var Assignment $assignment */
$name = $assignment->itemName;
if (isset($this->_items[$name]) && ($type === null || $this->_items[$name]->type == $type)) {
$items[$name] = $this->_items[$name];
@@ -400,7 +400,7 @@ class PhpManager extends Manager
{
$items = [];
foreach ($this->_items as $name => $item) {
- /** @var $item Item */
+ /** @var Item $item */
$items[$name] = [
'type' => $item->type,
'description' => $item->description,
@@ -409,7 +409,7 @@ class PhpManager extends Manager
];
if (isset($this->_children[$name])) {
foreach ($this->_children[$name] as $child) {
- /** @var $child Item */
+ /** @var Item $child */
$items[$name]['children'][] = $child->getName();
}
}
@@ -417,7 +417,7 @@ class PhpManager extends Manager
foreach ($this->_assignments as $userId => $assignments) {
foreach ($assignments as $name => $assignment) {
- /** @var $assignment Assignment */
+ /** @var Assignment $assignment */
if (isset($items[$name])) {
$items[$name]['assignments'][$userId] = [
'bizRule' => $assignment->bizRule,
@@ -505,7 +505,7 @@ class PhpManager extends Manager
return false;
}
foreach ($this->_children[$childName] as $child) {
- /** @var $child Item */
+ /** @var Item $child */
if ($this->detectLoop($itemName, $child->getName())) {
return true;
}
@@ -517,7 +517,7 @@ class PhpManager extends Manager
* Loads the authorization data from a PHP script file.
* @param string $file the file path.
* @return array the authorization data
- * @see saveToFile
+ * @see saveToFile()
*/
protected function loadFromFile($file)
{
@@ -532,7 +532,7 @@ class PhpManager extends Manager
* Saves the authorization data to a PHP script file.
* @param array $data the authorization data
* @param string $file the file path.
- * @see loadFromFile
+ * @see loadFromFile()
*/
protected function saveToFile($data, $file)
{
diff --git a/framework/yii/requirements/requirements.php b/framework/yii/requirements/requirements.php
index f70f414..34b556e 100644
--- a/framework/yii/requirements/requirements.php
+++ b/framework/yii/requirements/requirements.php
@@ -3,7 +3,7 @@
* These are the Yii core requirements for the [[YiiRequirementChecker]] instance.
* These requirements are mandatory for any Yii application.
*
- * @var $this YiiRequirementChecker
+ * @var YiiRequirementChecker $this
*/
return array(
array(
diff --git a/framework/yii/requirements/views/console/index.php b/framework/yii/requirements/views/console/index.php
index 6935107..1d87fe9 100644
--- a/framework/yii/requirements/views/console/index.php
+++ b/framework/yii/requirements/views/console/index.php
@@ -1,7 +1,7 @@
diff --git a/framework/yii/validators/ExistValidator.php b/framework/yii/validators/ExistValidator.php
index 2746b06..ba3f332 100644
--- a/framework/yii/validators/ExistValidator.php
+++ b/framework/yii/validators/ExistValidator.php
@@ -65,7 +65,7 @@ class ExistValidator extends Validator
return;
}
- /** @var $className \yii\db\ActiveRecord */
+ /** @var \yii\db\ActiveRecord $className */
$className = $this->className === null ? get_class($object) : $this->className;
$attributeName = $this->attributeName === null ? $attribute : $this->attributeName;
$query = $className::find();
@@ -92,7 +92,7 @@ class ExistValidator extends Validator
if ($this->attributeName === null) {
throw new InvalidConfigException('The "attributeName" property must be set.');
}
- /** @var $className \yii\db\ActiveRecord */
+ /** @var \yii\db\ActiveRecord $className */
$className = $this->className;
$query = $className::find();
$query->where([$this->attributeName => $value]);
diff --git a/framework/yii/validators/PunycodeAsset.php b/framework/yii/validators/PunycodeAsset.php
index 08439bf..c0c1e2b 100644
--- a/framework/yii/validators/PunycodeAsset.php
+++ b/framework/yii/validators/PunycodeAsset.php
@@ -9,6 +9,8 @@ namespace yii\validators;
use yii\web\AssetBundle;
/**
+ * This asset bundle provides the javascript files needed for the [[EmailValidator]]s client validation.
+ *
* @author Qiang Xue
* @since 2.0
*/
diff --git a/framework/yii/validators/UniqueValidator.php b/framework/yii/validators/UniqueValidator.php
index 334d057..7006cc4 100644
--- a/framework/yii/validators/UniqueValidator.php
+++ b/framework/yii/validators/UniqueValidator.php
@@ -60,7 +60,7 @@ class UniqueValidator extends Validator
return;
}
- /** @var $className \yii\db\ActiveRecord */
+ /** @var \yii\db\ActiveRecord $className */
$className = $this->className === null ? get_class($object) : $this->className;
$attributeName = $this->attributeName === null ? $attribute : $this->attributeName;
diff --git a/framework/yii/validators/ValidationAsset.php b/framework/yii/validators/ValidationAsset.php
index 8ff1b2d..14d7ad0 100644
--- a/framework/yii/validators/ValidationAsset.php
+++ b/framework/yii/validators/ValidationAsset.php
@@ -9,6 +9,8 @@ namespace yii\validators;
use yii\web\AssetBundle;
/**
+ * This asset bundle provides the javascript files for client validation.
+ *
* @author Qiang Xue
* @since 2.0
*/
diff --git a/framework/yii/web/AccessControl.php b/framework/yii/web/AccessControl.php
index d11f59c..549f087 100644
--- a/framework/yii/web/AccessControl.php
+++ b/framework/yii/web/AccessControl.php
@@ -102,7 +102,7 @@ class AccessControl extends ActionFilter
{
$user = Yii::$app->getUser();
$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/yii/web/AssetConverter.php b/framework/yii/web/AssetConverter.php
index ba64aa9..a93b915 100644
--- a/framework/yii/web/AssetConverter.php
+++ b/framework/yii/web/AssetConverter.php
@@ -14,6 +14,8 @@ use yii\base\Exception;
/**
* AssetConverter supports conversion of several popular script formats into JS or CSS scripts.
*
+ * It is used by [[AssetManager]] to convert files after they have been published.
+ *
* @author Qiang Xue
* @since 2.0
*/
@@ -63,6 +65,8 @@ class AssetConverter extends Component implements AssetConverterInterface
* @param string $asset the name of the asset file
* @param string $result the name of the file to be generated by the converter command
* @return bool true on success, false on failure. Failures will be logged.
+ * @throws \yii\base\Exception when the command fails and YII_DEBUG is true.
+ * In production mode the error will be logged.
*/
protected function runCommand($command, $basePath, $asset, $result)
{
diff --git a/framework/yii/web/AssetManager.php b/framework/yii/web/AssetManager.php
index 49374f0..b562cf6 100644
--- a/framework/yii/web/AssetManager.php
+++ b/framework/yii/web/AssetManager.php
@@ -16,6 +16,22 @@ use yii\helpers\FileHelper;
/**
* AssetManager manages asset bundles and asset publishing.
*
+ * AssetManager is configured as an application component in [[yii\web\Application]] by default.
+ * You can access that instance via `Yii::$app->assetManager`.
+ *
+ * You can modify its configuration by adding an array to your application config under `components`
+ * as it is shown in the following example:
+ *
+ * ~~~
+ * 'assetManager' => [
+ * 'bundles' => [
+ * // you can override AssetBundle configs here
+ * ],
+ * //'linkAssets' => true,
+ * // ...
+ * ]
+ * ~~~
+ *
* @property AssetConverterInterface $converter The asset converter. Note that the type of this property
* differs in getter and setter. See [[getConverter()]] and [[setConverter()]] for details.
*
diff --git a/framework/yii/web/CacheSession.php b/framework/yii/web/CacheSession.php
index 84033b7..7b4a98d 100644
--- a/framework/yii/web/CacheSession.php
+++ b/framework/yii/web/CacheSession.php
@@ -19,7 +19,17 @@ use yii\base\InvalidConfigException;
*
* Beware, by definition cache storage are volatile, which means the data stored on them
* may be swapped out and get lost. Therefore, you must make sure the cache used by this component
- * is NOT volatile. If you want to use database as storage medium, use [[DbSession]] is a better choice.
+ * is NOT volatile. If you want to use database as storage medium, [[DbSession]] is a better choice.
+ *
+ * The following example shows how you can configure the application to use CacheSession:
+ * Add the following to your application config under `components`:
+ *
+ * ~~~
+ * 'session' => [
+ * 'class' => 'yii\web\CacheSession',
+ * // 'cache' => 'mycache',
+ * ]
+ * ~~~
*
* @property boolean $useCustomStorage Whether to use custom storage. This property is read-only.
*
diff --git a/framework/yii/web/Controller.php b/framework/yii/web/Controller.php
index 2ecd9e4..3b08b7e 100644
--- a/framework/yii/web/Controller.php
+++ b/framework/yii/web/Controller.php
@@ -150,6 +150,13 @@ class Controller extends \yii\base\Controller
* Redirects the browser to the specified URL.
* This method is a shortcut to [[Response::redirect()]].
*
+ * You can use it in an action by returning the [[Response]] directly:
+ *
+ * ```php
+ * // stop executing this action and redirect to login page
+ * return $this->redirect(['login']);
+ * ```
+ *
* @param string|array $url the URL to be redirected to. This can be in one of the following formats:
*
* - a string representing a URL (e.g. "http://example.com")
@@ -172,6 +179,14 @@ class Controller extends \yii\base\Controller
/**
* Redirects the browser to the home page.
+ *
+ * You can use this method in an action by returning the [[Response]] directly:
+ *
+ * ```php
+ * // stop executing this action and redirect to home page
+ * return $this->goHome();
+ * ```
+ *
* @return Response the current response object
*/
public function goHome()
@@ -181,6 +196,14 @@ class Controller extends \yii\base\Controller
/**
* Redirects the browser to the last visited page.
+ *
+ * You can use this method in an action by returning the [[Response]] directly:
+ *
+ * ```php
+ * // stop executing this action and redirect to last visited page
+ * return $this->goBack();
+ * ```
+ *
* @param string|array $defaultUrl the default return URL in case it was not set previously.
* If this is null and the return URL was not set previously, [[Application::homeUrl]] will be redirected to.
* Please refer to [[User::setReturnUrl()]] on accepted format of the URL.
@@ -195,6 +218,14 @@ class Controller extends \yii\base\Controller
/**
* Refreshes the current page.
* This method is a shortcut to [[Response::refresh()]].
+ *
+ * You can use it in an action by returning the [[Response]] directly:
+ *
+ * ```php
+ * // stop executing this action and refresh the current page
+ * return $this->refresh();
+ * ```
+ *
* @param string $anchor the anchor that should be appended to the redirection URL.
* Defaults to empty. Make sure the anchor starts with '#' if you want to specify it.
* @return Response the response object itself
diff --git a/framework/yii/web/DbSession.php b/framework/yii/web/DbSession.php
index 410439b..d5d1742 100644
--- a/framework/yii/web/DbSession.php
+++ b/framework/yii/web/DbSession.php
@@ -19,6 +19,7 @@ use yii\base\InvalidConfigException;
* must be pre-created. The table name can be changed by setting [[sessionTable]].
*
* The following example shows how you can configure the application to use DbSession:
+ * Add the following to your application config under `components`:
*
* ~~~
* 'session' => [
diff --git a/framework/yii/web/HttpCache.php b/framework/yii/web/HttpCache.php
index d2f3923..134df71 100644
--- a/framework/yii/web/HttpCache.php
+++ b/framework/yii/web/HttpCache.php
@@ -12,7 +12,32 @@ use yii\base\ActionFilter;
use yii\base\Action;
/**
- * The HttpCache provides functionality for caching via HTTP Last-Modified and Etag headers
+ * The HttpCache provides functionality for caching via HTTP Last-Modified and Etag headers.
+ *
+ * It is an action filter that can be added to a controller and handles the `beforeAction` event.
+ *
+ * To use AccessControl, declare it in the `behaviors()` method of your controller class.
+ * In the following example the filter will be applied to the `list`-action and
+ * the Last-Modified header will contain the date of the last update to the user table in the database.
+ *
+ * ~~~
+ * public function behaviors()
+ * {
+ * return [
+ * 'httpCache' => [
+ * 'class' => \yii\web\HttpCache::className(),
+ * 'only' => ['list'],
+ * 'lastModified' => function ($action, $params) {
+ * $q = new Query();
+ * return strtotime($q->from('users')->max('updated_timestamp'));
+ * },
+ * // 'etagSeed' => function ($action, $params) {
+ * // return // generate etag seed here
+ * // }
+ * ],
+ * ];
+ * }
+ * ~~~
*
* @author Da:Sourcerer
* @author Qiang Xue
diff --git a/framework/yii/web/HttpException.php b/framework/yii/web/HttpException.php
index 2e677d5..2398437 100644
--- a/framework/yii/web/HttpException.php
+++ b/framework/yii/web/HttpException.php
@@ -16,6 +16,14 @@ use yii\base\UserException;
* keeps a standard HTTP status code (e.g. 404, 500). Error handlers may use this status code
* to decide how to format the error page.
*
+ * Throwing an HttpException like in the following example will result in the 404 page to be displayed.
+ *
+ * ```php
+ * if ($item === null) { // item does not exist
+ * throw new \yii\web\HttpException(404, 'The requested Item could not be found.');
+ * }
+ * ```
+ *
* @author Qiang Xue
* @since 2.0
*/
diff --git a/framework/yii/web/PageCache.php b/framework/yii/web/PageCache.php
index 2a3187b..4c8cc50 100644
--- a/framework/yii/web/PageCache.php
+++ b/framework/yii/web/PageCache.php
@@ -15,6 +15,35 @@ use yii\caching\Dependency;
/**
* The PageCache provides functionality for whole page caching
*
+ * It is an action filter that can be added to a controller and handles the `beforeAction` event.
+ *
+ * To use PageCache, declare it in the `behaviors()` method of your controller class.
+ * In the following example the filter will be applied to the `list`-action and
+ * cache the whole page for maximum 60 seconds or until the count of entries in the post table changes.
+ * It also stores different versions of the page depended on the route ([[varyByRoute]] is true by default),
+ * the application language and user id.
+ *
+ * ~~~
+ * public function behaviors()
+ * {
+ * return [
+ * 'pageCache' => [
+ * 'class' => \yii\web\PageCache::className(),
+ * 'only' => ['list'],
+ * 'duration' => 60,
+ * 'dependecy' => [
+ * 'class' => 'yii\caching\DbDependency',
+ * 'sql' => 'SELECT COUNT(*) FROM post',
+ * ],
+ * 'variations' => [
+ * Yii::$app->language,
+ * Yii::$app->user->id
+ * ]
+ * ],
+ * ];
+ * }
+ * ~~~
+ *
* @author Qiang Xue
* @since 2.0
*/
@@ -60,6 +89,7 @@ class PageCache extends ActionFilter
* [
* Yii::$app->language,
* ]
+ * ~~~
*/
public $variations;
/**
diff --git a/framework/yii/web/Request.php b/framework/yii/web/Request.php
index 6bede5e..2071afa 100644
--- a/framework/yii/web/Request.php
+++ b/framework/yii/web/Request.php
@@ -18,6 +18,9 @@ use yii\helpers\Security;
* Also it provides an interface to retrieve request parameters from $_POST, $_GET, $_COOKIES and REST
* parameters sent via other HTTP methods like PUT or DELETE.
*
+ * Request is configured as an application component in [[yii\web\Application]] by default.
+ * You can access that instance via `Yii::$app->request`.
+ *
* @property string $absoluteUrl The currently requested absolute URL. This property is read-only.
* @property string $acceptTypes User browser accept types, null if not present. This property is read-only.
* @property array $acceptedContentTypes The content types ordered by the preference level. The first element
@@ -116,8 +119,8 @@ class Request extends \yii\base\Request
/**
* @var string|boolean the name of the POST parameter that is used to indicate if a request is a PUT, PATCH or DELETE
* request tunneled through POST. Default to '_method'.
- * @see getMethod
- * @see getRestParams
+ * @see getMethod()
+ * @see getRestParams()
*/
public $restVar = '_method';
@@ -242,7 +245,7 @@ class Request extends \yii\base\Request
/**
* Returns the request parameters for the RESTful request.
* @return array the RESTful request parameters
- * @see getMethod
+ * @see getMethod()
*/
public function getRestParams()
{
@@ -298,7 +301,7 @@ class Request extends \yii\base\Request
* @param string $name the GET parameter name. If not specified, whole $_GET is returned.
* @param mixed $defaultValue the default parameter value if the GET parameter does not exist.
* @return mixed the GET parameter value
- * @see getPost
+ * @see getPost()
*/
public function get($name = null, $defaultValue = null)
{
@@ -324,7 +327,7 @@ class Request extends \yii\base\Request
* @param mixed $defaultValue the default parameter value if the POST parameter does not exist.
* @property array the POST request parameter values
* @return mixed the POST parameter value
- * @see get
+ * @see get()
*/
public function getPost($name = null, $defaultValue = null)
{
@@ -387,7 +390,7 @@ class Request extends \yii\base\Request
* By default this is determined based on the user request information.
* You may explicitly specify it by setting the [[setHostInfo()|hostInfo]] property.
* @return string schema and hostname part (with port number if needed) of the request URL (e.g. `http://www.yiiframework.com`)
- * @see setHostInfo
+ * @see setHostInfo()
*/
public function getHostInfo()
{
@@ -426,7 +429,7 @@ class Request extends \yii\base\Request
* This is similar to [[scriptUrl]] except that it does not include the script file name,
* and the ending slashes are removed.
* @return string the relative URL for the application
- * @see setScriptUrl
+ * @see setScriptUrl()
*/
public function getBaseUrl()
{
@@ -743,7 +746,7 @@ class Request extends \yii\base\Request
* Defaults to 80, or the port specified by the server if the current
* request is insecure.
* @return integer port number for insecure requests.
- * @see setPort
+ * @see setPort()
*/
public function getPort()
{
@@ -774,7 +777,7 @@ class Request extends \yii\base\Request
* Defaults to 443, or the port specified by the server if the current
* request is secure.
* @return integer port number for secure requests.
- * @see setSecurePort
+ * @see setSecurePort()
*/
public function getSecurePort()
{
diff --git a/framework/yii/web/Response.php b/framework/yii/web/Response.php
index ea1f0d9..8934fa1 100644
--- a/framework/yii/web/Response.php
+++ b/framework/yii/web/Response.php
@@ -22,6 +22,20 @@ use yii\helpers\StringHelper;
* It holds the [[headers]], [[cookies]] and [[content]] that is to be sent to the client.
* It also controls the HTTP [[statusCode|status code]].
*
+ * Response is configured as an application component in [[yii\web\Application]] by default.
+ * You can access that instance via `Yii::$app->response`.
+ *
+ * You can modify its configuration by adding an array to your application config under `components`
+ * as it is shown in the following example:
+ *
+ * ~~~
+ * 'response' => [
+ * 'format' => yii\web\Response::FORMAT_JSON,
+ * 'charset' => 'UTF-8',
+ * // ...
+ * ]
+ * ~~~
+ *
* @property CookieCollection $cookies The cookie collection. This property is read-only.
* @property HeaderCollection $headers The header collection. This property is read-only.
* @property boolean $isClientError Whether this response indicates a client error. This property is
diff --git a/framework/yii/web/Session.php b/framework/yii/web/Session.php
index b3be392..9fba49a 100644
--- a/framework/yii/web/Session.php
+++ b/framework/yii/web/Session.php
@@ -15,7 +15,7 @@ use yii\base\InvalidParamException;
* Session provides session data management and the related configurations.
*
* Session is a Web application component that can be accessed via `Yii::$app->session`.
-
+ *
* To start the session, call [[open()]]; To complete and send out session data, call [[close()]];
* To destroy the session, call [[destroy()]].
*
@@ -82,6 +82,7 @@ class Session extends Component implements \IteratorAggregate, \ArrayAccess, \Co
public $flashVar = '__flash';
/**
* @var array parameter-value pairs to override default session cookie parameters that are used for session_set_cookie_params() function
+ * Array may have the following possible keys: 'lifetime', 'path', 'domain', 'secure', 'httpOnly'
* @see http://www.php.net/manual/en/function.session-set-cookie-params.php
*/
private $_cookieParams = ['httpOnly' => true];
diff --git a/framework/yii/web/UploadedFile.php b/framework/yii/web/UploadedFile.php
index 3cb6813..1de4d46 100644
--- a/framework/yii/web/UploadedFile.php
+++ b/framework/yii/web/UploadedFile.php
@@ -74,7 +74,7 @@ class UploadedFile extends Object
* For example, '[1]file' for tabular file uploading; and 'file[1]' for an element in a file array.
* @return UploadedFile the instance of the uploaded file.
* Null is returned if no file is uploaded for the specified model attribute.
- * @see getInstanceByName
+ * @see getInstanceByName()
*/
public static function getInstance($model, $attribute)
{
diff --git a/framework/yii/web/UrlManager.php b/framework/yii/web/UrlManager.php
index 42b12ff..540e8d5 100644
--- a/framework/yii/web/UrlManager.php
+++ b/framework/yii/web/UrlManager.php
@@ -14,6 +14,22 @@ use yii\caching\Cache;
/**
* UrlManager handles HTTP request parsing and creation of URLs based on a set of rules.
*
+ * UrlManager is configured as an application component in [[yii\base\Application]] by default.
+ * You can access that instance via `Yii::$app->urlManager`.
+ *
+ * You can modify its configuration by adding an array to your application config under `components`
+ * as it is shown in the following example:
+ *
+ * ~~~
+ * 'urlManager' => [
+ * 'enablePrettyUrl' => true,
+ * 'rules' => [
+ * // your rules go here
+ * ],
+ * // ...
+ * ]
+ * ~~~
+ *
* @property string $baseUrl The base URL that is used by [[createUrl()]] to prepend URLs it creates.
* @property string $hostInfo The host info (e.g. "http://www.example.com") that is used by
* [[createAbsoluteUrl()]] to prepend URLs it creates.
@@ -169,7 +185,7 @@ class UrlManager extends Component
{
if ($this->enablePrettyUrl) {
$pathInfo = $request->getPathInfo();
- /** @var $rule UrlRule */
+ /** @var UrlRule $rule */
foreach ($this->rules as $rule) {
if (($result = $rule->parseRequest($this, $request)) !== false) {
Yii::trace("Request parsed with URL rule: {$rule->name}", __METHOD__);
@@ -224,7 +240,7 @@ class UrlManager extends Component
$baseUrl = $this->getBaseUrl();
if ($this->enablePrettyUrl) {
- /** @var $rule UrlRule */
+ /** @var UrlRule $rule */
foreach ($this->rules as $rule) {
if (($url = $rule->createUrl($this, $route, $params)) !== false) {
if ($rule->host !== null) {
@@ -282,7 +298,7 @@ class UrlManager extends Component
public function getBaseUrl()
{
if ($this->_baseUrl === null) {
- /** @var $request \yii\web\Request */
+ /** @var \yii\web\Request $request */
$request = Yii::$app->getRequest();
$this->_baseUrl = $this->showScriptName || !$this->enablePrettyUrl ? $request->getScriptUrl() : $request->getBaseUrl();
}
diff --git a/framework/yii/web/UrlRule.php b/framework/yii/web/UrlRule.php
index 6ebc615..af227cd 100644
--- a/framework/yii/web/UrlRule.php
+++ b/framework/yii/web/UrlRule.php
@@ -11,7 +11,17 @@ use yii\base\Object;
use yii\base\InvalidConfigException;
/**
- * UrlRule represents a rule used for parsing and generating URLs.
+ * UrlRule represents a rule used by [[UrlManager]] for parsing and generating URLs.
+ *
+ * To define your own URL parsing and creation logic you can extend from this class
+ * and add it to [[UrlManager::rules]] like this:
+ *
+ * ~~~
+ * 'rules' => [
+ * ['class' => 'MyUrlRule', 'pattern' => '...', 'route' => 'site/index', ...],
+ * // ...
+ * ]
+ * ~~~
*
* @author Qiang Xue
* @since 2.0
diff --git a/framework/yii/web/User.php b/framework/yii/web/User.php
index b77af2b..682d78e 100644
--- a/framework/yii/web/User.php
+++ b/framework/yii/web/User.php
@@ -20,6 +20,21 @@ use yii\base\InvalidConfigException;
* User works with a class implementing the [[IdentityInterface]]. This class implements
* the actual user authentication logic and is often backed by a user database table.
*
+ * User is configured as an application component in [[yii\web\Application]] by default.
+ * You can access that instance via `Yii::$app->user`.
+ *
+ * You can modify its configuration by adding an array to your application config under `components`
+ * as it is shown in the following example:
+ *
+ * ~~~
+ * 'user' => [
+ * 'identityClass' => 'app\models\User', // User must implement the IdentityInterface
+ * 'enableAutoLogin' => true,
+ * // 'loginUrl' => ['user/login'],
+ * // ...
+ * ]
+ * ~~~
+ *
* @property string|integer $id The unique identifier for the user. If null, it means the user is a guest.
* This property is read-only.
* @property IdentityInterface $identity The identity object associated with the currently logged user. Null
@@ -129,8 +144,8 @@ class User extends Component
* Returns the identity object associated with the currently logged user.
* @return IdentityInterface the identity object associated with the currently logged user.
* Null is returned if the user is not logged in (not authenticated).
- * @see login
- * @see logout
+ * @see login()
+ * @see logout()
*/
public function getIdentity()
{
@@ -139,7 +154,7 @@ class User extends Component
if ($id === null) {
$this->_identity = null;
} else {
- /** @var $class IdentityInterface */
+ /** @var IdentityInterface $class */
$class = $this->identityClass;
$this->_identity = $class::findIdentity($id);
}
@@ -202,7 +217,7 @@ class User extends Component
$data = json_decode($value, true);
if (count($data) === 3 && isset($data[0], $data[1], $data[2])) {
list ($id, $authKey, $duration) = $data;
- /** @var $class IdentityInterface */
+ /** @var IdentityInterface $class */
$class = $this->identityClass;
$identity = $class::findIdentity($id);
if ($identity !== null && $identity->validateAuthKey($authKey)) {
@@ -266,7 +281,7 @@ class User extends Component
* If this is null and the return URL was not set previously, [[Application::homeUrl]] will be redirected to.
* Please refer to [[setReturnUrl()]] on accepted format of the URL.
* @return string the URL that the user should be redirected to after login.
- * @see loginRequired
+ * @see loginRequired()
*/
public function getReturnUrl($defaultUrl = null)
{
@@ -413,7 +428,7 @@ class User extends Component
* information in the cookie.
* @param IdentityInterface $identity
* @param integer $duration number of seconds that the user can remain in logged-in status.
- * @see loginByCookie
+ * @see loginByCookie()
*/
protected function sendIdentityCookie($identity, $duration)
{
diff --git a/framework/yii/web/View.php b/framework/yii/web/View.php
index ab78fc5..db0c500 100644
--- a/framework/yii/web/View.php
+++ b/framework/yii/web/View.php
@@ -22,6 +22,22 @@ use yii\base\InvalidConfigException;
*
* View provides a set of methods (e.g. [[render()]]) for rendering purpose.
*
+ * View is configured as an application component in [[yii\base\Application]] by default.
+ * You can access that instance via `Yii::$app->view`.
+ *
+ * You can modify its configuration by adding an array to your application config under `components`
+ * as it is shown in the following example:
+ *
+ * ~~~
+ * 'view' => [
+ * 'theme' => 'app\themes\MyTheme',
+ * 'renderers' => [
+ * // you may add Smarty or Twig renderer here
+ * ]
+ * // ...
+ * ]
+ * ~~~
+ *
* @property \yii\web\AssetManager $assetManager The asset manager. Defaults to the "assetManager" application
* component.
*
@@ -72,7 +88,7 @@ class View extends \yii\base\View
/**
* @var AssetBundle[] list of the registered asset bundles. The keys are the bundle names, and the values
* are the registered [[AssetBundle]] objects.
- * @see registerAssetBundle
+ * @see registerAssetBundle()
*/
public $assetBundles = [];
/**
@@ -81,32 +97,32 @@ class View extends \yii\base\View
public $title;
/**
* @var array the registered meta tags.
- * @see registerMetaTag
+ * @see registerMetaTag()
*/
public $metaTags;
/**
* @var array the registered link tags.
- * @see registerLinkTag
+ * @see registerLinkTag()
*/
public $linkTags;
/**
* @var array the registered CSS code blocks.
- * @see registerCss
+ * @see registerCss()
*/
public $css;
/**
* @var array the registered CSS files.
- * @see registerCssFile
+ * @see registerCssFile()
*/
public $cssFiles;
/**
* @var array the registered JS code blocks
- * @see registerJs
+ * @see registerJs()
*/
public $js;
/**
* @var array the registered JS files.
- * @see registerJsFile
+ * @see registerJsFile()
*/
public $jsFiles;
diff --git a/framework/yii/web/XmlResponseFormatter.php b/framework/yii/web/XmlResponseFormatter.php
index 05c2762..292424a 100644
--- a/framework/yii/web/XmlResponseFormatter.php
+++ b/framework/yii/web/XmlResponseFormatter.php
@@ -17,6 +17,8 @@ use yii\helpers\StringHelper;
/**
* XmlResponseFormatter formats the given data into an XML response content.
*
+ * It is used by [[Response]] to format response data.
+ *
* @author Qiang Xue
* @since 2.0
*/
diff --git a/framework/yii/web/YiiAsset.php b/framework/yii/web/YiiAsset.php
index e49082d..d38b711 100644
--- a/framework/yii/web/YiiAsset.php
+++ b/framework/yii/web/YiiAsset.php
@@ -8,6 +8,8 @@
namespace yii\web;
/**
+ * This asset bundle provides the base javascript files for the Yii Framework.
+ *
* @author Qiang Xue
* @since 2.0
*/
diff --git a/framework/yii/widgets/ActiveForm.php b/framework/yii/widgets/ActiveForm.php
index c018011..b218a2e 100644
--- a/framework/yii/widgets/ActiveForm.php
+++ b/framework/yii/widgets/ActiveForm.php
@@ -220,7 +220,7 @@ class ActiveForm extends Widget
$lines = [];
foreach ($models as $model) {
- /** @var $model Model */
+ /** @var Model $model */
foreach ($model->getFirstErrors() as $error) {
$lines[] = Html::encode($error);
}
diff --git a/framework/yii/widgets/Menu.php b/framework/yii/widgets/Menu.php
index 7ea7717..d5ff8ef 100644
--- a/framework/yii/widgets/Menu.php
+++ b/framework/yii/widgets/Menu.php
@@ -104,7 +104,7 @@ class Menu extends Widget
/**
* @var boolean whether to automatically activate items according to whether their route setting
* matches the currently requested route.
- * @see isItemActive
+ * @see isItemActive()
*/
public $activateItems = true;
/**
@@ -137,14 +137,14 @@ class Menu extends Widget
* @var string the route used to determine if a menu item is active or not.
* If not set, it will use the route of the current request.
* @see params
- * @see isItemActive
+ * @see isItemActive()
*/
public $route;
/**
* @var array the parameters used to determine if a menu item is active or not.
* If not set, it will use `$_GET`.
* @see route
- * @see isItemActive
+ * @see isItemActive()
*/
public $params;
diff --git a/tests/unit/data/views/layout.php b/tests/unit/data/views/layout.php
index ed7dc27..97a0888 100644
--- a/tests/unit/data/views/layout.php
+++ b/tests/unit/data/views/layout.php
@@ -1,7 +1,7 @@
beginPage(); ?>
@@ -19,4 +19,4 @@
endBody(); ?>