diff --git a/framework/BaseYii.php b/framework/BaseYii.php
index 7c2a1f794f3..d6c5b70f866 100644
--- a/framework/BaseYii.php
+++ b/framework/BaseYii.php
@@ -384,7 +384,7 @@ public static function getLogger()
/**
* Sets the logger object.
- * @param Logger $logger the logger object.
+ * @param Logger|null $logger the logger object.
*/
public static function setLogger($logger)
{
diff --git a/framework/base/Application.php b/framework/base/Application.php
index e012d3235ac..94910e1e3d5 100644
--- a/framework/base/Application.php
+++ b/framework/base/Application.php
@@ -134,7 +134,7 @@ abstract class Application extends Module
*/
public $requestedParams;
/**
- * @var array list of installed Yii extensions. Each array element represents a single extension
+ * @var array|null list of installed Yii extensions. Each array element represents a single extension
* with the following structure:
*
* ```php
diff --git a/framework/base/ErrorException.php b/framework/base/ErrorException.php
index 28ead79190b..24fdb6e8d7d 100644
--- a/framework/base/ErrorException.php
+++ b/framework/base/ErrorException.php
@@ -38,7 +38,7 @@ class ErrorException extends \ErrorException
* @param int $severity [optional]
* @param string $filename [optional]
* @param int $lineno [optional]
- * @param \Throwable|\Exception|null $previous [optional]
+ * @param \Throwable|null $previous [optional]
*/
public function __construct($message = '', $code = 0, $severity = 1, $filename = __FILE__, $lineno = __LINE__, $previous = null)
{
diff --git a/framework/base/ErrorHandler.php b/framework/base/ErrorHandler.php
index 4b36d481ec3..18f96fdf41d 100644
--- a/framework/base/ErrorHandler.php
+++ b/framework/base/ErrorHandler.php
@@ -38,7 +38,7 @@ abstract class ErrorHandler extends Component
*/
public $memoryReserveSize = 262144;
/**
- * @var \Exception|null the exception that is being handled currently.
+ * @var \Throwable|null the exception that is being handled currently.
*/
public $exception;
/**
@@ -53,7 +53,7 @@ abstract class ErrorHandler extends Component
*/
private $_memoryReserve;
/**
- * @var \Exception from HHVM error that stores backtrace
+ * @var \Throwable from HHVM error that stores backtrace
*/
private $_hhvmException;
/**
@@ -108,7 +108,7 @@ public function unregister()
*
* This method is implemented as a PHP exception handler.
*
- * @param \Exception $exception the exception that is not caught
+ * @param \Throwable $exception the exception that is not caught
*/
public function handleException($exception)
{
@@ -153,8 +153,8 @@ public function handleException($exception)
/**
* Handles exception thrown during exception processing in [[handleException()]].
- * @param \Exception|\Throwable $exception Exception that was thrown during main exception processing.
- * @param \Exception $previousException Main exception processed in [[handleException()]].
+ * @param |\Throwable $exception Exception that was thrown during main exception processing.
+ * @param \Throwable $previousException Main exception processed in [[handleException()]].
* @since 2.0.11
*/
protected function handleFallbackExceptionMessage($exception, $previousException)
@@ -298,13 +298,13 @@ public function handleFatalError()
/**
* Renders the exception.
- * @param \Exception|\Error|\Throwable $exception the exception to be rendered.
+ * @param \Throwable $exception the exception to be rendered.
*/
abstract protected function renderException($exception);
/**
* Logs the given exception.
- * @param \Exception $exception the exception to be logged
+ * @param \Throwable $exception the exception to be logged
* @since 2.0.3 this method is now public.
*/
public function logException($exception)
@@ -336,7 +336,7 @@ public function clearOutput()
*
* This method can be used to convert exceptions inside of methods like `__toString()`
* to PHP errors because exceptions cannot be thrown inside of them.
- * @param \Exception|\Throwable $exception the exception to convert to a PHP error.
+ * @param \Throwable $exception the exception to convert to a PHP error.
*/
public static function convertExceptionToError($exception)
{
@@ -345,7 +345,7 @@ public static function convertExceptionToError($exception)
/**
* Converts an exception into a simple string.
- * @param \Exception|\Error|\Throwable $exception the exception being converted
+ * @param \Throwable $exception the exception being converted
* @return string the string representation of the exception.
*/
public static function convertExceptionToString($exception)
@@ -363,7 +363,7 @@ public static function convertExceptionToString($exception)
/**
* Converts an exception into a string that has verbose information about the exception and its trace.
- * @param \Exception|\Error|\Throwable $exception the exception being converted
+ * @param \Throwable $exception the exception being converted
* @return string the string representation of the exception.
*
* @since 2.0.14
diff --git a/framework/base/ExitException.php b/framework/base/ExitException.php
index 74431577175..a1111abea05 100644
--- a/framework/base/ExitException.php
+++ b/framework/base/ExitException.php
@@ -28,7 +28,7 @@ class ExitException extends \Exception
* @param int $status the exit status code
* @param string $message error message
* @param int $code error code
- * @param \Throwable|\Exception|null $previous The previous exception used for the exception chaining.
+ * @param \Throwable|null $previous The previous exception used for the exception chaining.
*/
public function __construct($status = 0, $message = null, $code = 0, $previous = null)
{
diff --git a/framework/base/Module.php b/framework/base/Module.php
index 58a848c7734..48e040ad560 100644
--- a/framework/base/Module.php
+++ b/framework/base/Module.php
@@ -131,7 +131,7 @@ class Module extends ServiceLocator
*/
private $_modules = [];
/**
- * @var string|callable the version of this module.
+ * @var string|callable|null the version of this module.
* Version can be specified as a PHP callback, which can accept module instance as an argument and should
* return the actual version. For example:
*
@@ -342,7 +342,7 @@ public function getVersion()
/**
* Sets current module version.
- * @param string|callable $version the version of this module.
+ * @param string|callable|null $version the version of this module.
* Version can be specified as a PHP callback, which can accept module instance as an argument and should
* return the actual version. For example:
*
diff --git a/framework/base/Theme.php b/framework/base/Theme.php
index b50334426eb..011c8c239a4 100644
--- a/framework/base/Theme.php
+++ b/framework/base/Theme.php
@@ -74,7 +74,7 @@
class Theme extends Component
{
/**
- * @var array the mapping between view directories and their corresponding themed versions.
+ * @var array|null the mapping between view directories and their corresponding themed versions.
* This property is used by [[applyTo()]] when a view is trying to apply the theme.
* [Path aliases](guide:concept-aliases) can be used when specifying directories.
* If this property is empty or not set, a mapping [[Application::basePath]] to [[basePath]] will be used.
diff --git a/framework/base/View.php b/framework/base/View.php
index 6f25c60acde..dce2a9b0a0d 100644
--- a/framework/base/View.php
+++ b/framework/base/View.php
@@ -335,7 +335,7 @@ public function afterRender($viewFile, $params, &$output)
* @param string $_file_ the view file.
* @param array $_params_ the parameters (name-value pairs) that will be extracted and made available in the view file.
* @return string the rendering result
- * @throws \Exception
+ * @throws \Throwable
*/
public function renderPhpFile($_file_, $_params_ = [])
{
diff --git a/framework/base/Widget.php b/framework/base/Widget.php
index 696b803d8e4..cc6067b9cdc 100644
--- a/framework/base/Widget.php
+++ b/framework/base/Widget.php
@@ -131,7 +131,7 @@ public static function end()
* The widget rendering result is returned by this method.
* @param array $config name-value pairs that will be used to initialize the object properties
* @return string the rendering result of the widget.
- * @throws \Exception
+ * @throws \Throwable
*/
public static function widget($config = [])
{
@@ -152,6 +152,12 @@ public static function widget($config = [])
ob_end_clean();
}
throw $e;
+ } catch (\Throwable $e) {
+ // close the output buffer opened above if it has not been closed already
+ if (ob_get_level() > 0) {
+ ob_end_clean();
+ }
+ throw $e;
}
return ob_get_clean() . $out;
diff --git a/framework/behaviors/AttributeTypecastBehavior.php b/framework/behaviors/AttributeTypecastBehavior.php
index 5f12734be66..4c03e1f1d33 100644
--- a/framework/behaviors/AttributeTypecastBehavior.php
+++ b/framework/behaviors/AttributeTypecastBehavior.php
@@ -121,7 +121,7 @@ class AttributeTypecastBehavior extends Behavior
*/
public $owner;
/**
- * @var array attribute typecast map in format: attributeName => type.
+ * @var array|null attribute typecast map in format: attributeName => type.
* Type can be set via PHP callable, which accept raw value as an argument and should return
* typecast result.
* For example:
diff --git a/framework/behaviors/SluggableBehavior.php b/framework/behaviors/SluggableBehavior.php
index b62ade8ea2c..f095204e067 100644
--- a/framework/behaviors/SluggableBehavior.php
+++ b/framework/behaviors/SluggableBehavior.php
@@ -111,7 +111,7 @@ class SluggableBehavior extends AttributeBehavior
*/
public $uniqueValidator = [];
/**
- * @var callable slug unique value generator. It is used in case [[ensureUnique]] enabled and generated
+ * @var callable|null slug unique value generator. It is used in case [[ensureUnique]] enabled and generated
* slug is not unique. This should be a PHP callable with following signature:
*
* ```php
diff --git a/framework/caching/DbQueryDependency.php b/framework/caching/DbQueryDependency.php
index 3aafd0f457e..90ffb0ff1ad 100644
--- a/framework/caching/DbQueryDependency.php
+++ b/framework/caching/DbQueryDependency.php
@@ -41,7 +41,7 @@ class DbQueryDependency extends Dependency
*/
public $query;
/**
- * @var string|callable method which should be invoked in over the [[query]] object.
+ * @var string|callable|null method which should be invoked in over the [[query]] object.
*
* If specified as a string an own query method with such name will be invoked, passing [[db]] value as its
* first argument. For example: `exists`, `all`.
diff --git a/framework/caching/FileCache.php b/framework/caching/FileCache.php
index 52a80c67b35..33214209315 100644
--- a/framework/caching/FileCache.php
+++ b/framework/caching/FileCache.php
@@ -57,7 +57,7 @@ class FileCache extends Cache
*/
public $gcProbability = 10;
/**
- * @var int the permission to be set for newly created cache files.
+ * @var int|null the permission to be set for newly created cache files.
* This value will be used by PHP chmod() function. No umask will be applied.
* If not set, the permission will be determined by the current environment.
*/
diff --git a/framework/captcha/CaptchaAction.php b/framework/captcha/CaptchaAction.php
index 0f0d7d32652..06aa7023f5f 100644
--- a/framework/captcha/CaptchaAction.php
+++ b/framework/captcha/CaptchaAction.php
@@ -91,7 +91,7 @@ class CaptchaAction extends Action
*/
public $fontFile = '@yii/captcha/SpicyRice.ttf';
/**
- * @var string the fixed verification code. When this property is set,
+ * @var string|null the fixed verification code. When this property is set,
* [[getVerifyCode()]] will always return the value of this property.
* This is mainly used in automated tests where we want to be able to reproduce
* the same verification code each time we run the tests.
@@ -99,7 +99,7 @@ class CaptchaAction extends Action
*/
public $fixedVerifyCode;
/**
- * @var string the rendering library to use. Currently supported only 'gd' and 'imagick'.
+ * @var string|null the rendering library to use. Currently supported only 'gd' and 'imagick'.
* If not set, library will be determined automatically.
* @since 2.0.7
*/
diff --git a/framework/console/ErrorHandler.php b/framework/console/ErrorHandler.php
index 526de75dfac..f06b82f918f 100644
--- a/framework/console/ErrorHandler.php
+++ b/framework/console/ErrorHandler.php
@@ -25,7 +25,7 @@ class ErrorHandler extends \yii\base\ErrorHandler
{
/**
* Renders an exception using ansi format for console output.
- * @param \Exception $exception the exception to be rendered.
+ * @param \Throwable $exception the exception to be rendered.
*/
protected function renderException($exception)
{
diff --git a/framework/console/UnknownCommandException.php b/framework/console/UnknownCommandException.php
index 305cc6ace6c..180d1c9a72b 100644
--- a/framework/console/UnknownCommandException.php
+++ b/framework/console/UnknownCommandException.php
@@ -34,9 +34,9 @@ class UnknownCommandException extends Exception
* @param string $route the route of the command that could not be found.
* @param Application $application the console application instance involved.
* @param int $code the Exception code.
- * @param \Exception|null $previous the previous exception used for the exception chaining.
+ * @param \Throwable|null $previous the previous exception used for the exception chaining.
*/
- public function __construct($route, $application, $code = 0, \Exception $previous = null)
+ public function __construct($route, $application, $code = 0, $previous = null)
{
$this->command = $route;
$this->application = $application;
diff --git a/framework/console/controllers/BaseMigrateController.php b/framework/console/controllers/BaseMigrateController.php
index 2e87cf5c90a..3cbfa91010e 100644
--- a/framework/console/controllers/BaseMigrateController.php
+++ b/framework/console/controllers/BaseMigrateController.php
@@ -85,14 +85,14 @@ abstract class BaseMigrateController extends Controller
*/
public $templateFile;
/**
- * @var int the permission to be set for newly generated migration files.
+ * @var int|null the permission to be set for newly generated migration files.
* This value will be used by PHP chmod() function. No umask will be applied.
* If not set, the permission will be determined by the current environment.
* @since 2.0.43
*/
public $newFileMode;
/**
- * @var string|int the user and/or group ownership to be set for newly generated migration files.
+ * @var string|int|null the user and/or group ownership to be set for newly generated migration files.
* If not set, the ownership will be determined by the current environment.
* @since 2.0.43
* @see FileHelper::changeOwnership()
diff --git a/framework/console/controllers/MessageController.php b/framework/console/controllers/MessageController.php
index 67bc6c5d874..2e950b312b2 100644
--- a/framework/console/controllers/MessageController.php
+++ b/framework/console/controllers/MessageController.php
@@ -84,7 +84,7 @@ class MessageController extends \yii\console\Controller
*/
public $markUnused = true;
/**
- * @var array list of patterns that specify which files/directories should NOT be processed.
+ * @var array|null list of patterns that specify which files/directories should NOT be processed.
* If empty or not set, all files/directories will be processed.
* See helpers/FileHelper::findFiles() description for pattern matching rules.
* If a file/directory matches both a pattern in "only" and "except", it will NOT be processed.
@@ -99,7 +99,7 @@ class MessageController extends \yii\console\Controller
'/BaseYii.php', // contains examples about Yii::t()
];
/**
- * @var array list of patterns that specify which files (not directories) should be processed.
+ * @var array|null list of patterns that specify which files (not directories) should be processed.
* If empty or not set, all files will be processed.
* See helpers/FileHelper::findFiles() description for pattern matching rules.
* If a file/directory matches both a pattern in "only" and "except", it will NOT be processed.
diff --git a/framework/data/ArrayDataProvider.php b/framework/data/ArrayDataProvider.php
index 5e507800a07..17c90981757 100644
--- a/framework/data/ArrayDataProvider.php
+++ b/framework/data/ArrayDataProvider.php
@@ -53,7 +53,7 @@
class ArrayDataProvider extends BaseDataProvider
{
/**
- * @var string|callable the column that is used as the key of the data models.
+ * @var string|callable|null the column that is used as the key of the data models.
* This can be either a column name, or a callable that returns the key value of a given data model.
* If this is not set, the index of the [[models]] array will be used.
* @see getKeys()
diff --git a/framework/data/BaseDataProvider.php b/framework/data/BaseDataProvider.php
index 4bd8cc393a4..9169cfe8b42 100644
--- a/framework/data/BaseDataProvider.php
+++ b/framework/data/BaseDataProvider.php
@@ -37,7 +37,7 @@ abstract class BaseDataProvider extends Component implements DataProviderInterfa
*/
private static $counter = 0;
/**
- * @var string an ID that uniquely identifies the data provider among all data providers.
+ * @var string|null an ID that uniquely identifies the data provider among all data providers.
* Generated automatically the following way in case it is not set:
*
* - First data provider ID is empty.
diff --git a/framework/data/Pagination.php b/framework/data/Pagination.php
index 8b59a2ad491..7e9f7bb1eb0 100644
--- a/framework/data/Pagination.php
+++ b/framework/data/Pagination.php
@@ -96,12 +96,12 @@ class Pagination extends BaseObject implements Linkable
*/
public $forcePageParam = true;
/**
- * @var string the route of the controller action for displaying the paged contents.
+ * @var string|null the route of the controller action for displaying the paged contents.
* If not set, it means using the currently requested route.
*/
public $route;
/**
- * @var array parameters (name => value) that should be used to obtain the current page number
+ * @var array|null parameters (name => value) that should be used to obtain the current page number
* and to create new pagination URLs. If not set, all parameters from $_GET will be used instead.
*
* In order to add hash to all links use `array_merge($_GET, ['#' => 'my-hash'])`.
@@ -111,7 +111,7 @@ class Pagination extends BaseObject implements Linkable
*/
public $params;
/**
- * @var \yii\web\UrlManager the URL manager used for creating pagination URLs. If not set,
+ * @var \yii\web\UrlManager|null the URL manager used for creating pagination URLs. If not set,
* the "urlManager" application component will be used.
*/
public $urlManager;
diff --git a/framework/data/Sort.php b/framework/data/Sort.php
index 3ce65af3427..cf08bb1e853 100644
--- a/framework/data/Sort.php
+++ b/framework/data/Sort.php
@@ -159,7 +159,7 @@ class Sort extends BaseObject
*/
public $defaultOrder;
/**
- * @var string the route of the controller action for displaying the sorted contents.
+ * @var string|null the route of the controller action for displaying the sorted contents.
* If not set, it means using the currently requested route.
*/
public $route;
@@ -168,7 +168,7 @@ class Sort extends BaseObject
*/
public $separator = ',';
/**
- * @var array parameters (name => value) that should be used to obtain the current sort directions
+ * @var array|null parameters (name => value) that should be used to obtain the current sort directions
* and to create new sort URLs. If not set, `$_GET` will be used instead.
*
* In order to add hash to all links use `array_merge($_GET, ['#' => 'my-hash'])`.
@@ -181,7 +181,7 @@ class Sort extends BaseObject
*/
public $params;
/**
- * @var \yii\web\UrlManager the URL manager used for creating sort URLs. If not set,
+ * @var \yii\web\UrlManager|null the URL manager used for creating sort URLs. If not set,
* the `urlManager` application component will be used.
*/
public $urlManager;
diff --git a/framework/data/SqlDataProvider.php b/framework/data/SqlDataProvider.php
index cf851ef8f92..a179d9bca6d 100644
--- a/framework/data/SqlDataProvider.php
+++ b/framework/data/SqlDataProvider.php
@@ -80,7 +80,7 @@ class SqlDataProvider extends BaseDataProvider
*/
public $params = [];
/**
- * @var string|callable the column that is used as the key of the data models.
+ * @var string|callable|null the column that is used as the key of the data models.
* This can be either a column name, or a callable that returns the key value of a given data model.
*
* If this is not set, the keys of the [[models]] array will be used.
diff --git a/framework/db/ActiveRecord.php b/framework/db/ActiveRecord.php
index 177f4cd7408..fd7e9539ebd 100644
--- a/framework/db/ActiveRecord.php
+++ b/framework/db/ActiveRecord.php
@@ -557,7 +557,7 @@ public static function populateRecord($record, $row)
* @param array|null $attributes list of attributes that need to be saved. Defaults to `null`,
* meaning all attributes that are loaded from DB will be saved.
* @return bool whether the attributes are valid and the record is inserted successfully.
- * @throws \Exception in case insert failed.
+ * @throws \Throwable in case insert failed.
*/
public function insert($runValidation = true, $attributes = null)
{
@@ -667,7 +667,7 @@ protected function insertInternal($attributes = null)
* or [[beforeSave()]] stops the updating process.
* @throws StaleObjectException if [[optimisticLock|optimistic locking]] is enabled and the data
* being updated is outdated.
- * @throws \Exception in case update failed.
+ * @throws \Throwable in case update failed.
*/
public function update($runValidation = true, $attributeNames = null)
{
@@ -716,7 +716,7 @@ public function update($runValidation = true, $attributeNames = null)
* Note that it is possible the number of rows deleted is 0, even though the deletion execution is successful.
* @throws StaleObjectException if [[optimisticLock|optimistic locking]] is enabled and the data
* being deleted is outdated.
- * @throws \Exception in case delete failed.
+ * @throws \Throwable in case delete failed.
*/
public function delete()
{
diff --git a/framework/db/Connection.php b/framework/db/Connection.php
index c48b6e39479..a6f81ff6581 100644
--- a/framework/db/Connection.php
+++ b/framework/db/Connection.php
@@ -284,7 +284,7 @@ class Connection extends Component
'cubrid' => 'yii\db\cubrid\Schema', // CUBRID
];
/**
- * @var string Custom PDO wrapper class. If not set, it will use [[PDO]] or [[\yii\db\mssql\PDO]] when MSSQL is used.
+ * @var string|null Custom PDO wrapper class. If not set, it will use [[PDO]] or [[\yii\db\mssql\PDO]] when MSSQL is used.
* @see pdo
*/
public $pdoClass;
@@ -497,7 +497,7 @@ public function getIsActive()
* Use 0 to indicate that the cached data will never expire.
* @param \yii\caching\Dependency|null $dependency the cache dependency associated with the cached query results.
* @return mixed the return result of the callable
- * @throws \Exception if there is any exception during query
+ * @throws \Throwable if there is any exception during query
* @see enableQueryCache
* @see queryCache
* @see noCache()
@@ -538,7 +538,7 @@ public function cache(callable $callable, $duration = null, $dependency = null)
* @param callable $callable a PHP callable that contains DB queries which should not use query cache.
* The signature of the callable is `function (Connection $db)`.
* @return mixed the return result of the callable
- * @throws \Exception if there is any exception during query
+ * @throws \Throwable if there is any exception during query
* @see enableQueryCache
* @see queryCache
* @see cache()
@@ -805,7 +805,7 @@ public function beginTransaction($isolationLevel = null)
* @param callable $callback a valid PHP callback that performs the job. Accepts connection instance as parameter.
* @param string|null $isolationLevel The isolation level to use for this transaction.
* See [[Transaction::begin()]] for details.
- * @throws \Exception if there is any exception during query. In this case the transaction will be rolled back.
+ * @throws \Throwable if there is any exception during query. In this case the transaction will be rolled back.
* @return mixed result of callback function
*/
public function transaction(callable $callback, $isolationLevel = null)
@@ -1004,7 +1004,7 @@ function ($matches) {
/**
* Returns the name of the DB driver. Based on the the current [[dsn]], in case it was not set explicitly
* by an end user.
- * @return string name of the DB driver
+ * @return string|null name of the DB driver
*/
public function getDriverName()
{
@@ -1119,7 +1119,7 @@ public function getMaster()
* @param callable $callback a PHP callable to be executed by this method. Its signature is
* `function (Connection $db)`. Its return value will be returned by this method.
* @return mixed the return value of the callback
- * @throws \Exception if there is any exception thrown from the callback
+ * @throws \Throwable if there is any exception thrown from the callback
*/
public function useMaster(callable $callback)
{
diff --git a/framework/db/Exception.php b/framework/db/Exception.php
index 5bfe1d17f54..674e26b75c0 100644
--- a/framework/db/Exception.php
+++ b/framework/db/Exception.php
@@ -27,7 +27,7 @@ class Exception extends \yii\base\Exception
* @param string $message PDO error message
* @param array $errorInfo PDO error info
* @param string $code PDO error code
- * @param \Throwable|\Exception|null $previous The previous exception used for the exception chaining.
+ * @param \Throwable|null $previous The previous exception used for the exception chaining.
*/
public function __construct($message, $errorInfo = [], $code = '', $previous = null)
{
diff --git a/framework/db/Migration.php b/framework/db/Migration.php
index f36beba9149..2094800207d 100644
--- a/framework/db/Migration.php
+++ b/framework/db/Migration.php
@@ -159,7 +159,7 @@ public function down()
}
/**
- * @param \Throwable|\Exception $e
+ * @param \Throwable $e
*/
private function printException($e)
{
diff --git a/framework/db/Query.php b/framework/db/Query.php
index 5879f8a30a0..a1e9866a919 100644
--- a/framework/db/Query.php
+++ b/framework/db/Query.php
@@ -452,7 +452,7 @@ public function exists($db = null)
* @param string|ExpressionInterface $selectExpression
* @param Connection|null $db the database connection used to execute the query.
* @return bool|string|null
- * @throws \Exception if can't create command
+ * @throws \Throwable if can't create command
*/
protected function queryScalar($selectExpression, $db)
{
diff --git a/framework/di/Instance.php b/framework/di/Instance.php
index e22af88ff3f..41af21af910 100644
--- a/framework/di/Instance.php
+++ b/framework/di/Instance.php
@@ -7,7 +7,6 @@
namespace yii\di;
-use Exception;
use Yii;
use yii\base\InvalidConfigException;
@@ -174,7 +173,12 @@ public function get($container = null)
}
return Yii::$container->get($this->id);
- } catch (Exception $e) {
+ } catch (\Exception $e) {
+ if ($this->optional) {
+ return null;
+ }
+ throw $e;
+ } catch (\Throwable $e) {
if ($this->optional) {
return null;
}
diff --git a/framework/di/NotInstantiableException.php b/framework/di/NotInstantiableException.php
index c80332ae08c..ccde5bf1c58 100644
--- a/framework/di/NotInstantiableException.php
+++ b/framework/di/NotInstantiableException.php
@@ -21,7 +21,7 @@ class NotInstantiableException extends InvalidConfigException
/**
* {@inheritdoc}
*/
- public function __construct($class, $message = null, $code = 0, \Exception $previous = null)
+ public function __construct($class, $message = null, $code = 0, $previous = null)
{
if ($message === null) {
$message = "Can not instantiate $class.";
diff --git a/framework/filters/AccessControl.php b/framework/filters/AccessControl.php
index 3e91b80a22e..d8a17d51469 100644
--- a/framework/filters/AccessControl.php
+++ b/framework/filters/AccessControl.php
@@ -63,7 +63,7 @@ class AccessControl extends ActionFilter
*/
public $user = 'user';
/**
- * @var callable a callback that will be called if the access should be denied
+ * @var callable|null a callback that will be called if the access should be denied
* to the current user. This is the case when either no rule matches, or a rule with
* [[AccessRule::$allow|$allow]] set to `false` matches.
* If not set, [[denyAccess()]] will be called.
diff --git a/framework/filters/AccessRule.php b/framework/filters/AccessRule.php
index 8cb4fca24b7..25251e5fc60 100644
--- a/framework/filters/AccessRule.php
+++ b/framework/filters/AccessRule.php
@@ -28,14 +28,14 @@ class AccessRule extends Component
/**
* @var bool whether this is an 'allow' rule or 'deny' rule.
*/
- public $allow;
+ public $allow = false;
/**
- * @var array list of action IDs that this rule applies to. The comparison is case-sensitive.
+ * @var array|null list of action IDs that this rule applies to. The comparison is case-sensitive.
* If not set or empty, it means this rule applies to all actions.
*/
public $actions;
/**
- * @var array list of the controller IDs that this rule applies to.
+ * @var array|null list of the controller IDs that this rule applies to.
*
* The comparison uses [[\yii\base\Controller::uniqueId]], so each controller ID is prefixed
* with the module ID (if any). For a `product` controller in the application, you would specify
@@ -50,7 +50,7 @@ class AccessRule extends Component
*/
public $controllers;
/**
- * @var array list of roles that this rule applies to (requires properly configured User component).
+ * @var array|null list of roles that this rule applies to (requires properly configured User component).
* Two special roles are recognized, and they are checked via [[User::isGuest]]:
*
* - `?`: matches a guest user (not authenticated yet)
@@ -67,7 +67,7 @@ class AccessRule extends Component
*/
public $roles;
/**
- * @var array list of RBAC (Role-Based Access Control) permissions that this rules applies to.
+ * @var array|null list of RBAC (Role-Based Access Control) permissions that this rules applies to.
* [[User::can()]] will be called to check access.
*
* If this property is not set or empty, it means this rule applies regardless of permissions.
@@ -111,7 +111,7 @@ class AccessRule extends Component
*/
public $roleParams = [];
/**
- * @var array list of user IP addresses that this rule applies to. An IP address
+ * @var array|null list of user IP addresses that this rule applies to. An IP address
* can contain the wildcard `*` at the end so that it matches IP addresses with the same prefix.
* For example, '192.168.*' matches all IP addresses in the segment '192.168.'.
* It may also contain a pattern/mask like '172.16.0.0/12' which would match all IPs from the
@@ -122,7 +122,7 @@ class AccessRule extends Component
*/
public $ips;
/**
- * @var array list of request methods (e.g. `GET`, `POST`) that this rule applies to.
+ * @var array|null list of request methods (e.g. `GET`, `POST`) that this rule applies to.
* If not set or empty, it means this rule applies to all request methods.
* @see \yii\web\Request::method
*/
@@ -140,7 +140,7 @@ class AccessRule extends Component
*/
public $matchCallback;
/**
- * @var callable a callback that will be called if this rule determines the access to
+ * @var callable|null a callback that will be called if this rule determines the access to
* the current action should be denied. This is the case when this rule matches
* and [[$allow]] is set to `false`.
*
diff --git a/framework/filters/AjaxFilter.php b/framework/filters/AjaxFilter.php
index 265f01a5705..65becc8b506 100644
--- a/framework/filters/AjaxFilter.php
+++ b/framework/filters/AjaxFilter.php
@@ -37,7 +37,7 @@ class AjaxFilter extends ActionFilter
*/
public $errorMessage = 'Request must be XMLHttpRequest.';
/**
- * @var Request the current request. If not set, the `request` application component will be used.
+ * @var Request|null the current request. If not set, the `request` application component will be used.
*/
public $request;
diff --git a/framework/filters/ContentNegotiator.php b/framework/filters/ContentNegotiator.php
index 760c4a0fab2..8414f702445 100644
--- a/framework/filters/ContentNegotiator.php
+++ b/framework/filters/ContentNegotiator.php
@@ -102,7 +102,7 @@ class ContentNegotiator extends ActionFilter implements BootstrapInterface
*/
public $languageParam = '_lang';
/**
- * @var array list of supported response formats. The keys are MIME types (e.g. `application/json`)
+ * @var array|null list of supported response formats. The keys are MIME types (e.g. `application/json`)
* while the values are the corresponding formats (e.g. `html`, `json`) which must be supported
* as declared in [[\yii\web\Response::$formatters]].
*
@@ -110,7 +110,7 @@ class ContentNegotiator extends ActionFilter implements BootstrapInterface
*/
public $formats;
/**
- * @var array a list of supported languages. The array keys are the supported language variants (e.g. `en-GB`, `en-US`),
+ * @var array|null a list of supported languages. The array keys are the supported language variants (e.g. `en-GB`, `en-US`),
* while the array values are the corresponding language codes (e.g. `en`, `de`) recognized by the application.
*
* Array keys are not always required. When an array value does not have a key, the matching of the requested language
@@ -124,7 +124,7 @@ class ContentNegotiator extends ActionFilter implements BootstrapInterface
*/
public $request;
/**
- * @var Response the response to be sent. If not set, the `response` application component will be used.
+ * @var Response|null the response to be sent. If not set, the `response` application component will be used.
*/
public $response;
diff --git a/framework/filters/Cors.php b/framework/filters/Cors.php
index 356053f514b..34cc5435649 100644
--- a/framework/filters/Cors.php
+++ b/framework/filters/Cors.php
@@ -70,11 +70,11 @@
class Cors extends ActionFilter
{
/**
- * @var Request the current request. If not set, the `request` application component will be used.
+ * @var Request|null the current request. If not set, the `request` application component will be used.
*/
public $request;
/**
- * @var Response the response to be sent. If not set, the `response` application component will be used.
+ * @var Response|null the response to be sent. If not set, the `response` application component will be used.
*/
public $response;
/**
diff --git a/framework/filters/HostControl.php b/framework/filters/HostControl.php
index 51aa5bee24a..b2f76fdb515 100644
--- a/framework/filters/HostControl.php
+++ b/framework/filters/HostControl.php
@@ -91,7 +91,7 @@ class HostControl extends ActionFilter
*/
public $allowedHosts;
/**
- * @var callable a callback that will be called if the current host does not match [[allowedHosts]].
+ * @var callable|null a callback that will be called if the current host does not match [[allowedHosts]].
* If not set, [[denyAccess()]] will be called.
*
* The signature of the callback should be as follows:
diff --git a/framework/filters/PageCache.php b/framework/filters/PageCache.php
index 46a8d22e53f..6fd7e9d8f4a 100644
--- a/framework/filters/PageCache.php
+++ b/framework/filters/PageCache.php
@@ -116,7 +116,7 @@ class PageCache extends ActionFilter implements DynamicContentAwareInterface
*/
public $enabled = true;
/**
- * @var \yii\base\View the view component to use for caching. If not set, the default application view component
+ * @var \yii\base\View|null the view component to use for caching. If not set, the default application view component
* [[\yii\web\Application::view]] will be used.
*/
public $view;
diff --git a/framework/filters/RateLimiter.php b/framework/filters/RateLimiter.php
index 5ffc1a69ff2..7ab7241539c 100644
--- a/framework/filters/RateLimiter.php
+++ b/framework/filters/RateLimiter.php
@@ -49,7 +49,7 @@ class RateLimiter extends ActionFilter
*/
public $errorMessage = 'Rate limit exceeded.';
/**
- * @var RateLimitInterface|Closure the user object that implements the RateLimitInterface. If not set, it will take the value of `Yii::$app->user->getIdentity(false)`.
+ * @var RateLimitInterface|Closure|null the user object that implements the RateLimitInterface. If not set, it will take the value of `Yii::$app->user->getIdentity(false)`.
* {@since 2.0.38} It's possible to provide a closure function in order to assign the user identity on runtime. Using a closure to assign the user identity is recommend
* when you are **not** using the standard `Yii::$app->user` component. See the example below:
* ```php
@@ -60,11 +60,11 @@ class RateLimiter extends ActionFilter
*/
public $user;
/**
- * @var Request the current request. If not set, the `request` application component will be used.
+ * @var Request|null the current request. If not set, the `request` application component will be used.
*/
public $request;
/**
- * @var Response the response to be sent. If not set, the `response` application component will be used.
+ * @var Response|null the response to be sent. If not set, the `response` application component will be used.
*/
public $response;
diff --git a/framework/filters/auth/AuthMethod.php b/framework/filters/auth/AuthMethod.php
index 9dcba078c30..6612e67fc4a 100644
--- a/framework/filters/auth/AuthMethod.php
+++ b/framework/filters/auth/AuthMethod.php
@@ -25,15 +25,15 @@
abstract class AuthMethod extends ActionFilter implements AuthInterface
{
/**
- * @var User the user object representing the user authentication status. If not set, the `user` application component will be used.
+ * @var User|null the user object representing the user authentication status. If not set, the `user` application component will be used.
*/
public $user;
/**
- * @var Request the current request. If not set, the `request` application component will be used.
+ * @var Request|null the current request. If not set, the `request` application component will be used.
*/
public $request;
/**
- * @var Response the response to be sent. If not set, the `response` application component will be used.
+ * @var Response|null the response to be sent. If not set, the `response` application component will be used.
*/
public $response;
/**
diff --git a/framework/filters/auth/HttpBasicAuth.php b/framework/filters/auth/HttpBasicAuth.php
index 546d0e628e6..03420efd70c 100644
--- a/framework/filters/auth/HttpBasicAuth.php
+++ b/framework/filters/auth/HttpBasicAuth.php
@@ -64,7 +64,7 @@ class HttpBasicAuth extends AuthMethod
*/
public $realm = 'api';
/**
- * @var callable a PHP callable that will authenticate the user with the HTTP basic auth information.
+ * @var callable|null a PHP callable that will authenticate the user with the HTTP basic auth information.
* The callable receives a username and a password as its parameters. It should return an identity object
* that matches the username and password. Null should be returned if there is no such identity.
* The callable will be called only if current user is not authenticated.
diff --git a/framework/grid/ActionColumn.php b/framework/grid/ActionColumn.php
index d945e1ea1a0..e54ba3c3d2d 100644
--- a/framework/grid/ActionColumn.php
+++ b/framework/grid/ActionColumn.php
@@ -38,7 +38,7 @@ class ActionColumn extends Column
*/
public $headerOptions = ['class' => 'action-column'];
/**
- * @var string the ID of the controller that should handle the actions specified here.
+ * @var string|null the ID of the controller that should handle the actions specified here.
* If not set, it will use the currently active controller. This property is mainly used by
* [[urlCreator]] to create URLs for different actions. The value of this property will be prefixed
* to each action name to form the route of the action.
@@ -125,7 +125,7 @@ class ActionColumn extends Column
*/
public $visibleButtons = [];
/**
- * @var callable a callback that creates a button URL using the specified model information.
+ * @var callable|null a callback that creates a button URL using the specified model information.
* The signature of the callback should be the same as that of [[createUrl()]]
* Since 2.0.10 it can accept additional parameter, which refers to the column instance itself:
*
diff --git a/framework/grid/DataColumn.php b/framework/grid/DataColumn.php
index 8760104aba6..8554abd3f86 100644
--- a/framework/grid/DataColumn.php
+++ b/framework/grid/DataColumn.php
@@ -46,7 +46,7 @@ class DataColumn extends Column
*/
public $attribute;
/**
- * @var string label to be displayed in the [[header|header cell]] and also to be used as the sorting
+ * @var string|null label to be displayed in the [[header|header cell]] and also to be used as the sorting
* link label when sorting is enabled for this column.
* If it is not set and the models provided by the GridViews data provider are instances
* of [[\yii\db\ActiveRecord]], the label will be determined using [[\yii\db\ActiveRecord::getAttributeLabel()]].
@@ -60,7 +60,7 @@ class DataColumn extends Column
*/
public $encodeLabel = true;
/**
- * @var string|Closure an anonymous function or a string that is used to determine the value to display in the current column.
+ * @var string|Closure|null an anonymous function or a string that is used to determine the value to display in the current column.
*
* If this is an anonymous function, it will be called for each row and the return value will be used as the value to
* display for every data model. The signature of this function should be: `function ($model, $key, $index, $column)`.
@@ -118,7 +118,7 @@ class DataColumn extends Column
*/
public $filterInputOptions = ['class' => 'form-control', 'id' => null];
/**
- * @var string the attribute name of the [[GridView::filterModel]] associated with this column. If not set,
+ * @var string|null the attribute name of the [[GridView::filterModel]] associated with this column. If not set,
* will have the same value as [[attribute]].
* @since 2.0.41
*/
diff --git a/framework/grid/GridView.php b/framework/grid/GridView.php
index 1fa783f9adb..c1b6a6b386f 100644
--- a/framework/grid/GridView.php
+++ b/framework/grid/GridView.php
@@ -137,7 +137,7 @@ class GridView extends BaseListView
*/
public $showOnEmpty = true;
/**
- * @var array|Formatter the formatter used to format model attribute values into displayable texts.
+ * @var array|Formatter|null the formatter used to format model attribute values into displayable texts.
* This can be either an instance of [[Formatter]] or an configuration array for creating the [[Formatter]]
* instance. If this property is not set, the "formatter" application component will be used.
*/
@@ -202,7 +202,7 @@ class GridView extends BaseListView
*/
public $emptyCell = ' ';
/**
- * @var \yii\base\Model the model that keeps the user-entered filter data. When this property is set,
+ * @var \yii\base\Model|null the model that keeps the user-entered filter data. When this property is set,
* the grid view will enable column-based filtering. Each data column by default will display a text field
* at the top that users can fill in to filter the data.
*
@@ -214,7 +214,7 @@ class GridView extends BaseListView
*/
public $filterModel;
/**
- * @var string|array the URL for returning the filtering result. [[Url::to()]] will be called to
+ * @var string|array|null the URL for returning the filtering result. [[Url::to()]] will be called to
* normalize the URL. If not set, the current controller action will be used.
* When the user makes change to any filter input, the current filtering inputs will be appended
* as GET parameters to this URL.
diff --git a/framework/helpers/BaseArrayHelper.php b/framework/helpers/BaseArrayHelper.php
index ab66c9e1e3c..5e0b0d76ab3 100644
--- a/framework/helpers/BaseArrayHelper.php
+++ b/framework/helpers/BaseArrayHelper.php
@@ -351,7 +351,7 @@ public static function remove(&$array, $key, $default = null)
* ```
*
* @param array $array the array where to look the value from
- * @param string $value the value to remove from the array
+ * @param mixed $value the value to remove from the array
* @return array the items that were removed from the array
* @since 2.0.11
*/
diff --git a/framework/helpers/BaseFileHelper.php b/framework/helpers/BaseFileHelper.php
index bd1f8f261a3..dc2d965bbb7 100644
--- a/framework/helpers/BaseFileHelper.php
+++ b/framework/helpers/BaseFileHelper.php
@@ -221,7 +221,7 @@ public static function getExtensionsByMimeType($mimeType, $magicFile = null)
/**
* Loads MIME types from the specified file.
- * @param string $magicFile the path (or alias) of the file that contains all available MIME type information.
+ * @param string|null $magicFile the path (or alias) of the file that contains all available MIME type information.
* If this is not set, the file specified by [[mimeMagicFile]] will be used.
* @return array the mapping from file extensions to MIME types
*/
@@ -242,7 +242,7 @@ protected static function loadMimeTypes($magicFile)
/**
* Loads MIME aliases from the specified file.
- * @param string $aliasesFile the path (or alias) of the file that contains MIME type aliases.
+ * @param string|null $aliasesFile the path (or alias) of the file that contains MIME type aliases.
* If this is not set, the file specified by [[mimeAliasesFile]] will be used.
* @return array the mapping from file extensions to MIME types
* @since 2.0.14
diff --git a/framework/helpers/BaseMarkdown.php b/framework/helpers/BaseMarkdown.php
index a1427f7b76b..8975c476396 100644
--- a/framework/helpers/BaseMarkdown.php
+++ b/framework/helpers/BaseMarkdown.php
@@ -85,7 +85,7 @@ public static function processParagraph($markdown, $flavor = null)
}
/**
- * @param string $flavor the markdown flavor to use. See [[$flavors]] for available values.
+ * @param string|null $flavor the markdown flavor to use. See [[$flavors]] for available values.
* Defaults to [[$defaultFlavor]], if not set.
* @return \cebe\markdown\Parser
* @throws InvalidArgumentException when an undefined flavor is given.
diff --git a/framework/i18n/Formatter.php b/framework/i18n/Formatter.php
index af6b4df05e6..bdba6ef41af 100644
--- a/framework/i18n/Formatter.php
+++ b/framework/i18n/Formatter.php
@@ -79,7 +79,7 @@ class Formatter extends Component
const UNIT_WEIGHT = 'mass';
/**
- * @var string the text to be displayed when formatting a `null` value.
+ * @var string|null the text to be displayed when formatting a `null` value.
* Defaults to `'(not set)'`, where `(not set)`
* will be translated according to [[locale]].
*/
@@ -92,21 +92,21 @@ class Formatter extends Component
*/
public $booleanFormat;
/**
- * @var string the locale ID that is used to localize the date and number formatting.
+ * @var string|null the locale ID that is used to localize the date and number formatting.
* For number and date formatting this is only effective when the
* [PHP intl extension](https://www.php.net/manual/en/book.intl.php) is installed.
* If not set, [[\yii\base\Application::language]] will be used.
*/
public $locale;
/**
- * @var string the language code (e.g. `en-US`, `en`) that is used to translate internal messages.
+ * @var string|null the language code (e.g. `en-US`, `en`) that is used to translate internal messages.
* If not set, [[locale]] will be used (without the `@calendar` param, if included).
*
* @since 2.0.28
*/
public $language;
/**
- * @var string the time zone to use for formatting time and date values.
+ * @var string|null the time zone to use for formatting time and date values.
*
* This can be any value that may be passed to [date_default_timezone_set()](https://www.php.net/manual/en/function.date-default-timezone-set.php)
* e.g. `UTC`, `Europe/Berlin` or `America/Chicago`.
@@ -218,7 +218,7 @@ class Formatter extends Component
*/
public $decimalSeparator;
/**
- * @var string the character displayed as the decimal point when formatting a currency.
+ * @var string|null the character displayed as the decimal point when formatting a currency.
* If not set, the currency decimal separator corresponding to [[locale]] will be used.
* If [PHP intl extension](https://www.php.net/manual/en/book.intl.php) is not available, setting this property will have no effect.
* @since 2.0.35
diff --git a/framework/i18n/Locale.php b/framework/i18n/Locale.php
index 77ce3fdaadc..f81907644aa 100644
--- a/framework/i18n/Locale.php
+++ b/framework/i18n/Locale.php
@@ -23,7 +23,7 @@
class Locale extends Component
{
/**
- * @var string the locale ID.
+ * @var string|null the locale ID.
* If not set, [[\yii\base\Application::language]] will be used.
*/
public $locale;
diff --git a/framework/i18n/MessageSource.php b/framework/i18n/MessageSource.php
index 24a4a74cd9d..6f33bed06bb 100644
--- a/framework/i18n/MessageSource.php
+++ b/framework/i18n/MessageSource.php
@@ -33,7 +33,7 @@ class MessageSource extends Component
*/
public $forceTranslation = false;
/**
- * @var string the language that the original messages are in. If not set, it will use the value of
+ * @var string|null the language that the original messages are in. If not set, it will use the value of
* [[\yii\base\Application::sourceLanguage]].
*/
public $sourceLanguage;
diff --git a/framework/log/Dispatcher.php b/framework/log/Dispatcher.php
index 16f22be92be..26b0281a79a 100644
--- a/framework/log/Dispatcher.php
+++ b/framework/log/Dispatcher.php
@@ -69,7 +69,7 @@ class Dispatcher extends Component
public $targets = [];
/**
- * @var Logger the logger.
+ * @var Logger|null the logger.
*/
private $_logger;
@@ -210,7 +210,7 @@ public function dispatch($messages, $final)
* Generate target error message
*
* @param Target $target log target object
- * @param \Throwable|\Exception $throwable catched exception
+ * @param \Throwable $throwable catched exception
* @param string $method full method path
* @return array generated error message data
* @since 2.0.32
diff --git a/framework/log/FileTarget.php b/framework/log/FileTarget.php
index 157c0db50ed..3fa91c2371a 100644
--- a/framework/log/FileTarget.php
+++ b/framework/log/FileTarget.php
@@ -26,7 +26,7 @@
class FileTarget extends Target
{
/**
- * @var string log file path or [path alias](guide:concept-aliases). If not set, it will use the "@runtime/logs/app.log" file.
+ * @var string|null log file path or [path alias](guide:concept-aliases). If not set, it will use the "@runtime/logs/app.log" file.
* The directory containing the log files will be automatically created if not existing.
*/
public $logFile;
@@ -46,7 +46,7 @@ class FileTarget extends Target
*/
public $maxLogFiles = 5;
/**
- * @var int the permission to be set for newly created log files.
+ * @var int|null the permission to be set for newly created log files.
* This value will be used by PHP chmod() function. No umask will be applied.
* If not set, the permission will be determined by the current environment.
*/
diff --git a/framework/log/Target.php b/framework/log/Target.php
index d57c2614ec9..fa05f1751ea 100644
--- a/framework/log/Target.php
+++ b/framework/log/Target.php
@@ -99,7 +99,7 @@ abstract class Target extends Component
'_SERVER.PHP_AUTH_PW',
];
/**
- * @var callable a PHP callable that returns a string to be prefixed to every exported message.
+ * @var callable|null a PHP callable that returns a string to be prefixed to every exported message.
*
* If not set, [[getMessagePrefix()]] will be used, which prefixes the message with context information
* such as user IP, user ID and session ID.
diff --git a/framework/mail/BaseMailer.php b/framework/mail/BaseMailer.php
index 1b2005888a4..d564ae8708e 100644
--- a/framework/mail/BaseMailer.php
+++ b/framework/mail/BaseMailer.php
@@ -87,7 +87,7 @@ abstract class BaseMailer extends Component implements MailerInterface, ViewCont
*/
public $fileTransportPath = '@runtime/mail';
/**
- * @var callable a PHP callback that will be called by [[send()]] when [[useFileTransport]] is true.
+ * @var callable|null a PHP callback that will be called by [[send()]] when [[useFileTransport]] is true.
* The callback should return a file name which will be used to save the email message.
* If not set, the file name will be generated based on the current timestamp.
*
diff --git a/framework/mutex/FileMutex.php b/framework/mutex/FileMutex.php
index 5dc71a088cb..8d0c1385532 100644
--- a/framework/mutex/FileMutex.php
+++ b/framework/mutex/FileMutex.php
@@ -49,7 +49,7 @@ class FileMutex extends Mutex
*/
public $mutexPath = '@runtime/mutex';
/**
- * @var int the permission to be set for newly created mutex files.
+ * @var int|null the permission to be set for newly created mutex files.
* This value will be used by PHP chmod() function. No umask will be applied.
* If not set, the permission will be determined by the current environment.
*/
@@ -62,7 +62,7 @@ class FileMutex extends Mutex
*/
public $dirMode = 0775;
/**
- * @var bool whether file handling should assume a Windows file system.
+ * @var bool|null whether file handling should assume a Windows file system.
* This value will determine how [[releaseLock()]] goes about deleting the lock file.
* If not set, it will be determined by checking the DIRECTORY_SEPARATOR constant.
* @since 2.0.16
diff --git a/framework/rbac/DbManager.php b/framework/rbac/DbManager.php
index 9aa29ae9453..4f909e34545 100644
--- a/framework/rbac/DbManager.php
+++ b/framework/rbac/DbManager.php
@@ -62,7 +62,7 @@ class DbManager extends BaseManager
*/
public $ruleTable = '{{%auth_rule}}';
/**
- * @var CacheInterface|array|string the cache used to improve RBAC performance. This can be one of the following:
+ * @var CacheInterface|array|string|null the cache used to improve RBAC performance. This can be one of the following:
*
* - an application component ID (e.g. `cache`)
* - a configuration array
diff --git a/framework/rest/Action.php b/framework/rest/Action.php
index 466acfc2f31..6afafca4502 100644
--- a/framework/rest/Action.php
+++ b/framework/rest/Action.php
@@ -29,7 +29,7 @@ class Action extends \yii\base\Action
*/
public $modelClass;
/**
- * @var callable a PHP callable that will be called to return the model corresponding
+ * @var callable|null a PHP callable that will be called to return the model corresponding
* to the specified primary key value. If not set, [[findModel()]] will be used instead.
* The signature of the callable should be:
*
@@ -45,7 +45,7 @@ class Action extends \yii\base\Action
*/
public $findModel;
/**
- * @var callable a PHP callable that will be called when running an action to determine
+ * @var callable|null a PHP callable that will be called when running an action to determine
* if the current user has the permission to execute the action. If not set, the access
* check will not be performed. The signature of the callable should be as follows,
*
diff --git a/framework/rest/IndexAction.php b/framework/rest/IndexAction.php
index c7a8ba50b1e..7befdbbfbe0 100644
--- a/framework/rest/IndexAction.php
+++ b/framework/rest/IndexAction.php
@@ -25,7 +25,7 @@
class IndexAction extends Action
{
/**
- * @var callable a PHP callable that will be called to prepare a data provider that
+ * @var callable|null a PHP callable that will be called to prepare a data provider that
* should return a collection of the models. If not set, [[prepareDataProvider()]] will be used instead.
* The signature of the callable should be:
*
diff --git a/framework/rest/Serializer.php b/framework/rest/Serializer.php
index 2a47511e7f0..4f889613ed5 100644
--- a/framework/rest/Serializer.php
+++ b/framework/rest/Serializer.php
@@ -64,7 +64,7 @@ class Serializer extends Component
*/
public $perPageHeader = 'X-Pagination-Per-Page';
/**
- * @var string the name of the envelope (e.g. `items`) for returning the resource objects in a collection.
+ * @var string|null the name of the envelope (e.g. `items`) for returning the resource objects in a collection.
* This is used when serving a resource collection. When this is set and pagination is enabled, the serializer
* will return a collection in the following format:
*
@@ -102,11 +102,11 @@ class Serializer extends Component
*/
public $metaEnvelope = '_meta';
/**
- * @var Request the current request. If not set, the `request` application component will be used.
+ * @var Request|null the current request. If not set, the `request` application component will be used.
*/
public $request;
/**
- * @var Response the response to be sent. If not set, the `response` application component will be used.
+ * @var Response|null the response to be sent. If not set, the `response` application component will be used.
*/
public $response;
/**
diff --git a/framework/test/ActiveFixture.php b/framework/test/ActiveFixture.php
index cdb847a8e53..9fd5ce02d6b 100644
--- a/framework/test/ActiveFixture.php
+++ b/framework/test/ActiveFixture.php
@@ -34,13 +34,13 @@
class ActiveFixture extends BaseActiveFixture
{
/**
- * @var string the name of the database table that this fixture is about. If this property is not set,
+ * @var string|null the name of the database table that this fixture is about. If this property is not set,
* the table name will be determined via [[modelClass]].
* @see modelClass
*/
public $tableName;
/**
- * @var string|bool the file path or [path alias](guide:concept-aliases) of the data file that contains the fixture data
+ * @var string|bool|null the file path or [path alias](guide:concept-aliases) of the data file that contains the fixture data
* to be returned by [[getData()]]. If this is not set, it will default to `FixturePath/data/TableName.php`,
* where `FixturePath` stands for the directory containing this fixture class, and `TableName` stands for the
* name of the table associated with this fixture. You can set this property to be false to prevent loading any data.
diff --git a/framework/validators/DateValidator.php b/framework/validators/DateValidator.php
index b97d1b5e85d..3df5018b321 100644
--- a/framework/validators/DateValidator.php
+++ b/framework/validators/DateValidator.php
@@ -72,7 +72,7 @@ class DateValidator extends Validator
*/
public $type = self::TYPE_DATE;
/**
- * @var string the date format that the value being validated should follow.
+ * @var string|null the date format that the value being validated should follow.
* This can be a date time pattern as described in the [ICU manual](http://userguide.icu-project.org/formatparse/datetime#TOC-Date-Time-Format-Syntax).
*
* Alternatively this can be a string prefixed with `php:` representing a format that can be recognized by the PHP Datetime class.
@@ -104,14 +104,14 @@ class DateValidator extends Validator
*/
public $format;
/**
- * @var string the locale ID that is used to localize the date parsing.
+ * @var string|null the locale ID that is used to localize the date parsing.
* This is only effective when the [PHP intl extension](https://www.php.net/manual/en/book.intl.php) is installed.
* If not set, the locale of the [[\yii\base\Application::formatter|formatter]] will be used.
* See also [[\yii\i18n\Formatter::locale]].
*/
public $locale;
/**
- * @var string the timezone to use for parsing date and time values.
+ * @var string|null the timezone to use for parsing date and time values.
* This can be any value that may be passed to [date_default_timezone_set()](https://www.php.net/manual/en/function.date-default-timezone-set.php)
* e.g. `UTC`, `Europe/Berlin` or `America/Chicago`.
* Refer to the [php manual](https://www.php.net/manual/en/timezones.php) for available timezones.
@@ -137,7 +137,7 @@ class DateValidator extends Validator
*/
public $timestampAttribute;
/**
- * @var string the format to use when populating the [[timestampAttribute]].
+ * @var string|null the format to use when populating the [[timestampAttribute]].
* The format can be specified in the same way as for [[format]].
*
* If not set, [[timestampAttribute]] will receive a UNIX timestamp.
diff --git a/framework/validators/ExistValidator.php b/framework/validators/ExistValidator.php
index 1a1468651e9..5388b11f634 100644
--- a/framework/validators/ExistValidator.php
+++ b/framework/validators/ExistValidator.php
@@ -49,13 +49,13 @@
class ExistValidator extends Validator
{
/**
- * @var string the name of the ActiveRecord class that should be used to validate the existence
+ * @var string|null the name of the ActiveRecord class that should be used to validate the existence
* of the current attribute value. If not set, it will use the ActiveRecord class of the attribute being validated.
* @see targetAttribute
*/
public $targetClass;
/**
- * @var string|array the name of the ActiveRecord attribute that should be used to
+ * @var string|array|null the name of the ActiveRecord attribute that should be used to
* validate the existence of the current attribute value. If not set, it will use the name
* of the attribute currently being validated. You may use an array to validate the existence
* of multiple columns at the same time. The array key is the name of the attribute with the value to validate,
@@ -181,7 +181,7 @@ private function checkTargetAttributeExistence($model, $attribute)
* Processes attributes' relations described in $targetAttribute parameter into conditions, compatible with
* [[\yii\db\Query::where()|Query::where()]] key-value format.
*
- * @param $targetAttribute array|string $attribute the name of the ActiveRecord attribute that should be used to
+ * @param $targetAttribute array|string|null $attribute the name of the ActiveRecord attribute that should be used to
* validate the existence of the current attribute value. If not set, it will use the name
* of the attribute currently being validated. You may use an array to validate the existence
* of multiple columns at the same time. The array key is the name of the attribute with the value to validate,
diff --git a/framework/validators/IpValidator.php b/framework/validators/IpValidator.php
index f7a52ac637f..02ac99eb0b7 100644
--- a/framework/validators/IpValidator.php
+++ b/framework/validators/IpValidator.php
@@ -163,7 +163,7 @@ class IpValidator extends Validator
*/
public $wrongCidr;
/**
- * @var string user-defined error message is used when validation fails due to subnet [[subnet]] set to 'only',
+ * @var string|null user-defined error message is used when validation fails due to subnet [[subnet]] set to 'only',
* but the CIDR prefix is not set.
*
* You may use the following placeholders in the message:
@@ -246,9 +246,7 @@ public function init()
* - Recursively substitutes aliases (described in [[networks]]) with their values.
* - Removes duplicates
*
- * @property array the IPv4 or IPv6 ranges that are allowed or forbidden.
- * See [[setRanges()]] for detailed description.
- * @param array|string $ranges the IPv4 or IPv6 ranges that are allowed or forbidden.
+ * @param array|string|null $ranges the IPv4 or IPv6 ranges that are allowed or forbidden.
*
* When the array is empty, or the option not set, all IP addresses are allowed.
*
diff --git a/framework/validators/StringValidator.php b/framework/validators/StringValidator.php
index f06dbfc2208..3f44ce29dea 100644
--- a/framework/validators/StringValidator.php
+++ b/framework/validators/StringValidator.php
@@ -34,12 +34,12 @@ class StringValidator extends Validator
*/
public $length;
/**
- * @var int maximum length. If not set, it means no maximum length limit.
+ * @var int|null maximum length. If not set, it means no maximum length limit.
* @see tooLong for the customized message for a too long string.
*/
public $max;
/**
- * @var int minimum length. If not set, it means no minimum length limit.
+ * @var int|null minimum length. If not set, it means no minimum length limit.
* @see tooShort for the customized message for a too short string.
*/
public $min;
@@ -60,7 +60,7 @@ class StringValidator extends Validator
*/
public $notEqual;
/**
- * @var string the encoding of the string value to be validated (e.g. 'UTF-8').
+ * @var string|null the encoding of the string value to be validated (e.g. 'UTF-8').
* If this property is not set, [[\yii\base\Application::charset]] will be used.
*/
public $encoding;
diff --git a/framework/validators/UniqueValidator.php b/framework/validators/UniqueValidator.php
index 15583110e90..3a9623627d9 100644
--- a/framework/validators/UniqueValidator.php
+++ b/framework/validators/UniqueValidator.php
@@ -42,13 +42,13 @@
class UniqueValidator extends Validator
{
/**
- * @var string the name of the ActiveRecord class that should be used to validate the uniqueness
+ * @var string|null the name of the ActiveRecord class that should be used to validate the uniqueness
* of the current attribute value. If not set, it will use the ActiveRecord class of the attribute being validated.
* @see targetAttribute
*/
public $targetClass;
/**
- * @var string|array the name of the [[\yii\db\ActiveRecord|ActiveRecord]] attribute that should be used to
+ * @var string|array|null the name of the [[\yii\db\ActiveRecord|ActiveRecord]] attribute that should be used to
* validate the uniqueness of the current attribute value. If not set, it will use the name
* of the attribute currently being validated. You may use an array to validate the uniqueness
* of multiple columns at the same time. The array values are the attributes that will be
diff --git a/framework/validators/Validator.php b/framework/validators/Validator.php
index 7e3c1eb610f..9e232ef8e9b 100644
--- a/framework/validators/Validator.php
+++ b/framework/validators/Validator.php
@@ -104,7 +104,7 @@ class Validator extends Component
*/
public $attributes = [];
/**
- * @var string the user-defined error message. It may contain the following placeholders which
+ * @var string|null the user-defined error message. It may contain the following placeholders which
* will be replaced accordingly by the validator:
*
* - `{attribute}`: the label of the attribute being validated
@@ -132,7 +132,7 @@ class Validator extends Component
*/
public $skipOnError = true;
/**
- * @var bool|null whether this validation rule should be skipped if the attribute value
+ * @var bool whether this validation rule should be skipped if the attribute value
* is null or an empty string. This property is used only when validating [[yii\base\Model]].
*/
public $skipOnEmpty = true;
@@ -144,14 +144,14 @@ class Validator extends Component
*/
public $enableClientValidation = true;
/**
- * @var callable a PHP callable that replaces the default implementation of [[isEmpty()]].
+ * @var callable|null a PHP callable that replaces the default implementation of [[isEmpty()]].
* If not set, [[isEmpty()]] will be used to check if a value is empty. The signature
* of the callable should be `function ($value)` which returns a boolean indicating
* whether the value is empty.
*/
public $isEmpty;
/**
- * @var callable a PHP callable whose return value determines whether this validator should be applied.
+ * @var callable|null a PHP callable whose return value determines whether this validator should be applied.
* The signature of the callable should be `function ($model, $attribute)`, where `$model` and `$attribute`
* refer to the model and the attribute currently being validated. The callable should return a boolean value.
*
@@ -170,7 +170,7 @@ class Validator extends Component
*/
public $when;
/**
- * @var string a JavaScript function name whose return value determines whether this validator should be applied
+ * @var string|null a JavaScript function name whose return value determines whether this validator should be applied
* on the client-side. The signature of the function should be `function (attribute, value)`, where
* `attribute` is an object describing the attribute being validated (see [[clientValidateAttribute()]])
* and `value` the current value of the attribute.
diff --git a/framework/views/errorHandler/error.php b/framework/views/errorHandler/error.php
index 9ef6dc7f13d..630bbec034f 100644
--- a/framework/views/errorHandler/error.php
+++ b/framework/views/errorHandler/error.php
@@ -1,5 +1,5 @@
statusCode;
diff --git a/framework/views/errorHandler/exception.php b/framework/views/errorHandler/exception.php
index d097a1c92fd..4601e7c42bd 100644
--- a/framework/views/errorHandler/exception.php
+++ b/framework/views/errorHandler/exception.php
@@ -1,6 +1,6 @@
diff --git a/framework/web/AssetBundle.php b/framework/web/AssetBundle.php
index aca626cd4d9..4f7f2904e98 100644
--- a/framework/web/AssetBundle.php
+++ b/framework/web/AssetBundle.php
@@ -30,7 +30,7 @@
class AssetBundle extends BaseObject
{
/**
- * @var string the directory that contains the source asset files for this asset bundle.
+ * @var string|null the directory that contains the source asset files for this asset bundle.
* A source asset file is a file that is part of your source code repository of your Web application.
*
* You must set this property if the directory containing the source asset files is not Web accessible.
diff --git a/framework/web/AssetManager.php b/framework/web/AssetManager.php
index 2d28d9246ed..fbd35a03b72 100644
--- a/framework/web/AssetManager.php
+++ b/framework/web/AssetManager.php
@@ -123,7 +123,7 @@ class AssetManager extends Component
*/
public $linkAssets = false;
/**
- * @var int the permission to be set for newly published asset files.
+ * @var int|null the permission to be set for newly published asset files.
* This value will be used by PHP chmod() function. No umask will be applied.
* If not set, the permission will be determined by the current environment.
*/
@@ -171,7 +171,7 @@ class AssetManager extends Component
*/
public $appendTimestamp = false;
/**
- * @var callable a callback that will be called to produce hash for asset directory generation.
+ * @var callable|null a callback that will be called to produce hash for asset directory generation.
* The signature of the callback should be as follows:
*
* ```
diff --git a/framework/web/ConflictHttpException.php b/framework/web/ConflictHttpException.php
index 2849e9ab811..d3fd07c8e71 100644
--- a/framework/web/ConflictHttpException.php
+++ b/framework/web/ConflictHttpException.php
@@ -20,9 +20,9 @@ class ConflictHttpException extends HttpException
* Constructor.
* @param string|null $message error message
* @param int $code error code
- * @param \Exception|null $previous The previous exception used for the exception chaining.
+ * @param \Throwable|null $previous The previous exception used for the exception chaining.
*/
- public function __construct($message = null, $code = 0, \Exception $previous = null)
+ public function __construct($message = null, $code = 0, $previous = null)
{
parent::__construct(409, $message, $code, $previous);
}
diff --git a/framework/web/ErrorAction.php b/framework/web/ErrorAction.php
index c291fc05034..dde5611b5c3 100644
--- a/framework/web/ErrorAction.php
+++ b/framework/web/ErrorAction.php
@@ -51,7 +51,7 @@
class ErrorAction extends Action
{
/**
- * @var string the view file to be rendered. If not set, it will take the value of [[id]].
+ * @var string|null the view file to be rendered. If not set, it will take the value of [[id]].
* That means, if you name the action as "error" in "SiteController", then the view name
* would be "error", and the corresponding view file would be "views/site/error.php".
*/
@@ -75,7 +75,7 @@ class ErrorAction extends Action
public $layout;
/**
- * @var \Exception the exception object, normally is filled on [[init()]] method call.
+ * @var \Throwable the exception object, normally is filled on [[init()]] method call.
* @see findException() to know default way of obtaining exception.
* @since 2.0.11
*/
@@ -157,7 +157,7 @@ protected function getViewRenderParams()
* Gets exception from the [[yii\web\ErrorHandler|ErrorHandler]] component.
* In case there is no exception in the component, treat as the action has been invoked
* not from error handler, but by direct route, so '404 Not Found' error will be displayed.
- * @return \Exception
+ * @return \Throwable
* @since 2.0.11
*/
protected function findException()
diff --git a/framework/web/ErrorHandler.php b/framework/web/ErrorHandler.php
index 5615716730d..2600a8b51a0 100644
--- a/framework/web/ErrorHandler.php
+++ b/framework/web/ErrorHandler.php
@@ -84,7 +84,7 @@ class ErrorHandler extends \yii\base\ErrorHandler
/**
* Renders the exception.
- * @param \Exception|\Error $exception the exception to be rendered.
+ * @param \Throwable $exception the exception to be rendered.
*/
protected function renderException($exception)
{
@@ -138,7 +138,7 @@ protected function renderException($exception)
/**
* Converts an exception into an array.
- * @param \Exception|\Error $exception the exception being converted
+ * @param \Throwable $exception the exception being converted
* @return array the array representation of the exception.
*/
protected function convertExceptionToArray($exception)
@@ -272,7 +272,7 @@ public function renderFile($_file_, $_params_)
/**
* Renders the previous exception stack for a given Exception.
- * @param \Exception $exception the exception whose precursors should be rendered.
+ * @param \Throwable $exception the exception whose precursors should be rendered.
* @return string HTML content of the rendered previous exceptions.
* Empty string if there are none.
*/
@@ -326,7 +326,7 @@ public function renderCallStackItem($file, $line, $class, $method, $args, $index
/**
* Renders call stack.
- * @param \Exception|\ParseError $exception exception to get call stack from
+ * @param \Throwable $exception exception to get call stack from
* @return string HTML content of the rendered call stack.
* @since 2.0.12
*/
@@ -482,7 +482,7 @@ public function argumentsToString($args)
/**
* Returns human-readable exception name.
- * @param \Exception $exception
+ * @param \Throwable $exception
* @return string|null human-readable exception name or null if it cannot be determined
*/
public function getExceptionName($exception)
diff --git a/framework/web/ForbiddenHttpException.php b/framework/web/ForbiddenHttpException.php
index 4fc8530076f..81e1cf02060 100644
--- a/framework/web/ForbiddenHttpException.php
+++ b/framework/web/ForbiddenHttpException.php
@@ -25,9 +25,9 @@ class ForbiddenHttpException extends HttpException
* Constructor.
* @param string|null $message error message
* @param int $code error code
- * @param \Exception|null $previous The previous exception used for the exception chaining.
+ * @param \Throwable|null $previous The previous exception used for the exception chaining.
*/
- public function __construct($message = null, $code = 0, \Exception $previous = null)
+ public function __construct($message = null, $code = 0, $previous = null)
{
parent::__construct(403, $message, $code, $previous);
}
diff --git a/framework/web/GoneHttpException.php b/framework/web/GoneHttpException.php
index 8976b7f24c7..a03a1bb0dcb 100644
--- a/framework/web/GoneHttpException.php
+++ b/framework/web/GoneHttpException.php
@@ -25,9 +25,9 @@ class GoneHttpException extends HttpException
* Constructor.
* @param string|null $message error message
* @param int $code error code
- * @param \Exception|null $previous The previous exception used for the exception chaining.
+ * @param \Throwable|null $previous The previous exception used for the exception chaining.
*/
- public function __construct($message = null, $code = 0, \Exception $previous = null)
+ public function __construct($message = null, $code = 0, $previous = null)
{
parent::__construct(410, $message, $code, $previous);
}
diff --git a/framework/web/GroupUrlRule.php b/framework/web/GroupUrlRule.php
index 93cdc4bfe17..e2f67da3120 100644
--- a/framework/web/GroupUrlRule.php
+++ b/framework/web/GroupUrlRule.php
@@ -60,7 +60,7 @@ class GroupUrlRule extends CompositeUrlRule
*/
public $prefix;
/**
- * @var string the prefix for the route part of every rule declared in [[rules]].
+ * @var string|null the prefix for the route part of every rule declared in [[rules]].
* The prefix and the route will be separated with a slash.
* If this property is not set, it will take the value of [[prefix]].
*/
diff --git a/framework/web/MethodNotAllowedHttpException.php b/framework/web/MethodNotAllowedHttpException.php
index 98a2767e9c6..832641e31f1 100644
--- a/framework/web/MethodNotAllowedHttpException.php
+++ b/framework/web/MethodNotAllowedHttpException.php
@@ -20,9 +20,9 @@ class MethodNotAllowedHttpException extends HttpException
* Constructor.
* @param string|null $message error message
* @param int $code error code
- * @param \Exception|null $previous The previous exception used for the exception chaining.
+ * @param \Throwable|null $previous The previous exception used for the exception chaining.
*/
- public function __construct($message = null, $code = 0, \Exception $previous = null)
+ public function __construct($message = null, $code = 0, $previous = null)
{
parent::__construct(405, $message, $code, $previous);
}
diff --git a/framework/web/NotAcceptableHttpException.php b/framework/web/NotAcceptableHttpException.php
index 200c6767a50..a986195d828 100644
--- a/framework/web/NotAcceptableHttpException.php
+++ b/framework/web/NotAcceptableHttpException.php
@@ -24,9 +24,9 @@ class NotAcceptableHttpException extends HttpException
* Constructor.
* @param string|null $message error message
* @param int $code error code
- * @param \Exception|null $previous The previous exception used for the exception chaining.
+ * @param \Throwable|null $previous The previous exception used for the exception chaining.
*/
- public function __construct($message = null, $code = 0, \Exception $previous = null)
+ public function __construct($message = null, $code = 0, $previous = null)
{
parent::__construct(406, $message, $code, $previous);
}
diff --git a/framework/web/NotFoundHttpException.php b/framework/web/NotFoundHttpException.php
index b409b7fd471..ef064bab128 100644
--- a/framework/web/NotFoundHttpException.php
+++ b/framework/web/NotFoundHttpException.php
@@ -20,9 +20,9 @@ class NotFoundHttpException extends HttpException
* Constructor.
* @param string|null $message error message
* @param int $code error code
- * @param \Exception|null $previous The previous exception used for the exception chaining.
+ * @param \Throwable|null $previous The previous exception used for the exception chaining.
*/
- public function __construct($message = null, $code = 0, \Exception $previous = null)
+ public function __construct($message = null, $code = 0, $previous = null)
{
parent::__construct(404, $message, $code, $previous);
}
diff --git a/framework/web/RangeNotSatisfiableHttpException.php b/framework/web/RangeNotSatisfiableHttpException.php
index f8058d0ad8c..253d8e24074 100644
--- a/framework/web/RangeNotSatisfiableHttpException.php
+++ b/framework/web/RangeNotSatisfiableHttpException.php
@@ -26,9 +26,9 @@ class RangeNotSatisfiableHttpException extends HttpException
* Constructor.
* @param string|null $message error message
* @param int $code error code
- * @param \Exception|null $previous The previous exception used for the exception chaining.
+ * @param \Throwable|null $previous The previous exception used for the exception chaining.
*/
- public function __construct($message = null, $code = 0, \Exception $previous = null)
+ public function __construct($message = null, $code = 0, $previous = null)
{
parent::__construct(416, $message, $code, $previous);
}
diff --git a/framework/web/Response.php b/framework/web/Response.php
index 40860c44218..ba426433801 100644
--- a/framework/web/Response.php
+++ b/framework/web/Response.php
@@ -52,7 +52,7 @@
* @property-read bool $isServerError Whether this response indicates a server error.
* @property-read bool $isSuccessful Whether this response is successful.
* @property int $statusCode The HTTP status code to send with the response.
- * @property-write \Exception|\Error|\Throwable $statusCodeByException The exception object.
+ * @property-write \Throwable $statusCodeByException The exception object.
*
* @author Qiang Xue
* @author Carsten Brandt
@@ -127,7 +127,7 @@ class Response extends \yii\base\Response
*/
public $data;
/**
- * @var string the response content. When [[data]] is not null, it will be converted into [[content]]
+ * @var string|null the response content. When [[data]] is not null, it will be converted into [[content]]
* according to [[format]] when the response is being sent out.
* @see data
*/
@@ -142,7 +142,7 @@ class Response extends \yii\base\Response
*/
public $stream;
/**
- * @var string the charset of the text response. If not set, it will use
+ * @var string|null the charset of the text response. If not set, it will use
* the value of [[Application::charset]].
*/
public $charset;
@@ -152,7 +152,7 @@ class Response extends \yii\base\Response
*/
public $statusText = 'OK';
/**
- * @var string the version of the HTTP protocol to use. If not set, it will be determined via `$_SERVER['SERVER_PROTOCOL']`,
+ * @var string|null the version of the HTTP protocol to use. If not set, it will be determined via `$_SERVER['SERVER_PROTOCOL']`,
* or '1.1' if that is not available.
*/
public $version;
@@ -297,7 +297,7 @@ public function setStatusCode($value, $text = null)
/**
* Sets the response status code based on the exception.
- * @param \Exception|\Error|\Throwable $e the exception object.
+ * @param \Throwable $e the exception object.
* @throws InvalidArgumentException if the status code is invalid.
* @return $this the response object itself
* @since 2.0.12
diff --git a/framework/web/ServerErrorHttpException.php b/framework/web/ServerErrorHttpException.php
index 5631ecdf3ab..c9a6578b1eb 100644
--- a/framework/web/ServerErrorHttpException.php
+++ b/framework/web/ServerErrorHttpException.php
@@ -20,9 +20,9 @@ class ServerErrorHttpException extends HttpException
* Constructor.
* @param string|null $message error message
* @param int $code error code
- * @param \Exception|null $previous The previous exception used for the exception chaining.
+ * @param \Throwable|null $previous The previous exception used for the exception chaining.
*/
- public function __construct($message = null, $code = 0, \Exception $previous = null)
+ public function __construct($message = null, $code = 0, $previous = null)
{
parent::__construct(500, $message, $code, $previous);
}
diff --git a/framework/web/TooManyRequestsHttpException.php b/framework/web/TooManyRequestsHttpException.php
index 2810b25fb40..6549936fd99 100644
--- a/framework/web/TooManyRequestsHttpException.php
+++ b/framework/web/TooManyRequestsHttpException.php
@@ -24,9 +24,9 @@ class TooManyRequestsHttpException extends HttpException
* Constructor.
* @param string|null $message error message
* @param int $code error code
- * @param \Exception|null $previous The previous exception used for the exception chaining.
+ * @param \Throwable|null $previous The previous exception used for the exception chaining.
*/
- public function __construct($message = null, $code = 0, \Exception $previous = null)
+ public function __construct($message = null, $code = 0, $previous = null)
{
parent::__construct(429, $message, $code, $previous);
}
diff --git a/framework/web/UnauthorizedHttpException.php b/framework/web/UnauthorizedHttpException.php
index f4fb90875e6..c261e9f00f1 100644
--- a/framework/web/UnauthorizedHttpException.php
+++ b/framework/web/UnauthorizedHttpException.php
@@ -27,9 +27,9 @@ class UnauthorizedHttpException extends HttpException
* Constructor.
* @param string|null $message error message
* @param int $code error code
- * @param \Exception|null $previous The previous exception used for the exception chaining.
+ * @param \Throwable|null $previous The previous exception used for the exception chaining.
*/
- public function __construct($message = null, $code = 0, \Exception $previous = null)
+ public function __construct($message = null, $code = 0, $previous = null)
{
parent::__construct(401, $message, $code, $previous);
}
diff --git a/framework/web/UnprocessableEntityHttpException.php b/framework/web/UnprocessableEntityHttpException.php
index dc1fd6ff7fc..8fdc65aff6d 100644
--- a/framework/web/UnprocessableEntityHttpException.php
+++ b/framework/web/UnprocessableEntityHttpException.php
@@ -26,9 +26,9 @@ class UnprocessableEntityHttpException extends HttpException
* Constructor.
* @param string|null $message error message
* @param int $code error code
- * @param \Exception|null $previous The previous exception used for the exception chaining.
+ * @param \Throwable|null $previous The previous exception used for the exception chaining.
*/
- public function __construct($message = null, $code = 0, \Exception $previous = null)
+ public function __construct($message = null, $code = 0, $previous = null)
{
parent::__construct(422, $message, $code, $previous);
}
diff --git a/framework/web/UnsupportedMediaTypeHttpException.php b/framework/web/UnsupportedMediaTypeHttpException.php
index 6ffb15eedb6..7d2c0f5661c 100644
--- a/framework/web/UnsupportedMediaTypeHttpException.php
+++ b/framework/web/UnsupportedMediaTypeHttpException.php
@@ -25,9 +25,9 @@ class UnsupportedMediaTypeHttpException extends HttpException
* Constructor.
* @param string|null $message error message
* @param int $code error code
- * @param \Exception|null $previous The previous exception used for the exception chaining.
+ * @param \Throwable|null $previous The previous exception used for the exception chaining.
*/
- public function __construct($message = null, $code = 0, \Exception $previous = null)
+ public function __construct($message = null, $code = 0, $previous = null)
{
parent::__construct(415, $message, $code, $previous);
}
diff --git a/framework/web/UrlNormalizerRedirectException.php b/framework/web/UrlNormalizerRedirectException.php
index 7ecf865ead1..9d550221832 100644
--- a/framework/web/UrlNormalizerRedirectException.php
+++ b/framework/web/UrlNormalizerRedirectException.php
@@ -40,9 +40,9 @@ class UrlNormalizerRedirectException extends \yii\base\Exception
* This will be used as second parameter for [[\yii\helpers\Url::to()]]
* @param string|null $message the error message
* @param int $code the error code
- * @param \Exception|null $previous the previous exception used for the exception chaining
+ * @param \Throwable|null $previous the previous exception used for the exception chaining
*/
- public function __construct($url, $statusCode = 302, $scheme = false, $message = null, $code = 0, \Exception $previous = null)
+ public function __construct($url, $statusCode = 302, $scheme = false, $message = null, $code = 0, $previous = null)
{
$this->url = $url;
$this->scheme = $scheme;
diff --git a/framework/web/UrlRule.php b/framework/web/UrlRule.php
index f120722fc2a..a9027b42a7f 100644
--- a/framework/web/UrlRule.php
+++ b/framework/web/UrlRule.php
@@ -68,7 +68,7 @@ class UrlRule extends BaseObject implements UrlRuleInterface
const CREATE_STATUS_PARAMS_MISMATCH = 4;
/**
- * @var string the name of this rule. If not set, it will use [[pattern]] as the name.
+ * @var string|null the name of this rule. If not set, it will use [[pattern]] as the name.
*/
public $name;
/**
@@ -94,20 +94,20 @@ class UrlRule extends BaseObject implements UrlRuleInterface
*/
public $defaults = [];
/**
- * @var string the URL suffix used for this rule.
+ * @var string|null the URL suffix used for this rule.
* For example, ".html" can be used so that the URL looks like pointing to a static HTML page.
* If not set, the value of [[UrlManager::suffix]] will be used.
*/
public $suffix;
/**
- * @var string|array the HTTP verb (e.g. GET, POST, DELETE) that this rule should match.
+ * @var string|array|null the HTTP verb (e.g. GET, POST, DELETE) that this rule should match.
* Use array to represent multiple verbs that this rule may match.
* If this property is not set, the rule can match any verb.
* Note that this property is only used when parsing a request. It is ignored for URL creation.
*/
public $verb;
/**
- * @var int a value indicating if this rule should be used for both request parsing and URL creation,
+ * @var int|null a value indicating if this rule should be used for both request parsing and URL creation,
* parsing only, or creation only.
* If not set or 0, it means the rule is both request parsing and URL creation.
* If it is [[PARSING_ONLY]], the rule is for request parsing only.
diff --git a/framework/web/User.php b/framework/web/User.php
index 973d825c093..81945a96abf 100644
--- a/framework/web/User.php
+++ b/framework/web/User.php
@@ -98,21 +98,21 @@ class User extends Component
*/
public $identityCookie = ['name' => '_identity', 'httpOnly' => true];
/**
- * @var int the number of seconds in which the user will be logged out automatically if the user
+ * @var int|null the number of seconds in which the user will be logged out automatically if the user
* remains inactive. If this property is not set, the user will be logged out after
* the current session expires (c.f. [[Session::timeout]]).
* Note that this will not work if [[enableAutoLogin]] is `true`.
*/
public $authTimeout;
/**
- * @var CheckAccessInterface|string|array The access checker object to use for checking access or the application
+ * @var CheckAccessInterface|string|array|null The access checker object to use for checking access or the application
* component ID of the access checker.
* If not set the application auth manager will be used.
* @since 2.0.9
*/
public $accessChecker;
/**
- * @var int the number of seconds in which the user will be logged out automatically
+ * @var int|null the number of seconds in which the user will be logged out automatically
* regardless of activity.
* Note that this will not work if [[enableAutoLogin]] is `true`.
*/
diff --git a/framework/web/XmlResponseFormatter.php b/framework/web/XmlResponseFormatter.php
index cd48c3d4dc4..346e5fd424b 100644
--- a/framework/web/XmlResponseFormatter.php
+++ b/framework/web/XmlResponseFormatter.php
@@ -33,7 +33,7 @@ class XmlResponseFormatter extends Component implements ResponseFormatterInterfa
*/
public $version = '1.0';
/**
- * @var string the XML encoding. If not set, it will use the value of [[Response::charset]].
+ * @var string|null the XML encoding. If not set, it will use the value of [[Response::charset]].
*/
public $encoding;
/**
diff --git a/framework/widgets/ActiveField.php b/framework/widgets/ActiveField.php
index b7886c54f87..f5dcea062bd 100644
--- a/framework/widgets/ActiveField.php
+++ b/framework/widgets/ActiveField.php
@@ -97,33 +97,33 @@ class ActiveField extends Component
*/
public $hintOptions = ['class' => 'hint-block'];
/**
- * @var bool whether to enable client-side data validation.
+ * @var bool|null whether to enable client-side data validation.
* If not set, it will take the value of [[ActiveForm::enableClientValidation]].
*/
public $enableClientValidation;
/**
- * @var bool whether to enable AJAX-based data validation.
+ * @var bool|null whether to enable AJAX-based data validation.
* If not set, it will take the value of [[ActiveForm::enableAjaxValidation]].
*/
public $enableAjaxValidation;
/**
- * @var bool whether to perform validation when the value of the input field is changed.
+ * @var bool|null whether to perform validation when the value of the input field is changed.
* If not set, it will take the value of [[ActiveForm::validateOnChange]].
*/
public $validateOnChange;
/**
- * @var bool whether to perform validation when the input field loses focus.
+ * @var bool|null whether to perform validation when the input field loses focus.
* If not set, it will take the value of [[ActiveForm::validateOnBlur]].
*/
public $validateOnBlur;
/**
- * @var bool whether to perform validation while the user is typing in the input field.
+ * @var bool|null whether to perform validation while the user is typing in the input field.
* If not set, it will take the value of [[ActiveForm::validateOnType]].
* @see validationDelay
*/
public $validateOnType;
/**
- * @var int number of milliseconds that the validation should be delayed when the user types in the field
+ * @var int|null number of milliseconds that the validation should be delayed when the user types in the field
* and [[validateOnType]] is set `true`.
* If not set, it will take the value of [[ActiveForm::validationDelay]].
*/
diff --git a/framework/widgets/ActiveForm.php b/framework/widgets/ActiveForm.php
index 1d5fdc6dbe4..f2b2fbbe844 100644
--- a/framework/widgets/ActiveForm.php
+++ b/framework/widgets/ActiveForm.php
@@ -133,7 +133,7 @@ class ActiveForm extends Widget
*/
public $enableClientScript = true;
/**
- * @var array|string the URL for performing AJAX-based validation. This property will be processed by
+ * @var array|string|null the URL for performing AJAX-based validation. This property will be processed by
* [[Url::to()]]. Please refer to [[Url::to()]] for more details on how to configure this property.
* If this property is not set, it will take the value of the form's action attribute.
*/
diff --git a/framework/widgets/Breadcrumbs.php b/framework/widgets/Breadcrumbs.php
index b56aa0fbdf8..f439521c023 100644
--- a/framework/widgets/Breadcrumbs.php
+++ b/framework/widgets/Breadcrumbs.php
@@ -68,7 +68,7 @@ class Breadcrumbs extends Widget
*/
public $encodeLabels = true;
/**
- * @var array the first hyperlink in the breadcrumbs (called home link).
+ * @var array|null the first hyperlink in the breadcrumbs (called home link).
* Please refer to [[links]] on the format of the link.
* If this property is not set, it will default to a link pointing to [[\yii\web\Application::homeUrl]]
* with the label 'Home'. If this property is false, the home link will not be rendered.
diff --git a/framework/widgets/DetailView.php b/framework/widgets/DetailView.php
index 62e0987fbd4..426281c3a6e 100644
--- a/framework/widgets/DetailView.php
+++ b/framework/widgets/DetailView.php
@@ -108,13 +108,13 @@ class DetailView extends Widget
*/
public $template = '{label} | {value} |
';
/**
- * @var array the HTML attributes for the container tag of this widget. The `tag` option specifies
+ * @var array|null the HTML attributes for the container tag of this widget. The `tag` option specifies
* what container tag should be used. It defaults to `table` if not set.
* @see \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
*/
public $options = ['class' => 'table table-striped table-bordered detail-view'];
/**
- * @var array|Formatter the formatter used to format model attribute values into displayable texts.
+ * @var array|Formatter|null the formatter used to format model attribute values into displayable texts.
* This can be either an instance of [[Formatter]] or an configuration array for creating the [[Formatter]]
* instance. If this property is not set, the `formatter` application component will be used.
*/
diff --git a/framework/widgets/InputWidget.php b/framework/widgets/InputWidget.php
index eed67443d07..e7aae1ce0d6 100644
--- a/framework/widgets/InputWidget.php
+++ b/framework/widgets/InputWidget.php
@@ -43,15 +43,15 @@ class InputWidget extends Widget
*/
public $field;
/**
- * @var Model the data model that this widget is associated with.
+ * @var Model|null the data model that this widget is associated with.
*/
public $model;
/**
- * @var string the model attribute that this widget is associated with.
+ * @var string|null the model attribute that this widget is associated with.
*/
public $attribute;
/**
- * @var string the input name. This must be set if [[model]] and [[attribute]] are not set.
+ * @var string|null the input name. This must be set if [[model]] and [[attribute]] are not set.
*/
public $name;
/**
diff --git a/framework/widgets/LinkSorter.php b/framework/widgets/LinkSorter.php
index a0e95990e38..620cf0e9326 100644
--- a/framework/widgets/LinkSorter.php
+++ b/framework/widgets/LinkSorter.php
@@ -26,11 +26,11 @@
class LinkSorter extends Widget
{
/**
- * @var Sort the sort definition
+ * @var Sort|null the sort definition
*/
public $sort;
/**
- * @var array list of the attributes that support sorting. If not set, it will be determined
+ * @var array|null list of the attributes that support sorting. If not set, it will be determined
* using [[Sort::attributes]].
*/
public $attributes;
diff --git a/framework/widgets/Menu.php b/framework/widgets/Menu.php
index db838f66fa3..859e092b058 100644
--- a/framework/widgets/Menu.php
+++ b/framework/widgets/Menu.php
@@ -151,14 +151,14 @@ class Menu extends Widget
*/
public $lastItemCssClass;
/**
- * @var string the route used to determine if a menu item is active or not.
+ * @var string|null 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()
*/
public $route;
/**
- * @var array the parameters used to determine if a menu item is active or not.
+ * @var array|null the parameters used to determine if a menu item is active or not.
* If not set, it will use `$_GET`.
* @see route
* @see isItemActive()
diff --git a/framework/widgets/Pjax.php b/framework/widgets/Pjax.php
index 1e5d90104c1..69595e0d3b8 100644
--- a/framework/widgets/Pjax.php
+++ b/framework/widgets/Pjax.php
@@ -55,14 +55,14 @@ class Pjax extends Widget
*/
public $options = [];
/**
- * @var string|false the jQuery selector of the links that should trigger pjax requests.
+ * @var string|null|false the jQuery selector of the links that should trigger pjax requests.
* If not set, all links within the enclosed content of Pjax will trigger pjax requests.
* If set to false, no code will be registered to handle links.
* Note that if the response to the pjax request is a full page, a normal request will be sent again.
*/
public $linkSelector;
/**
- * @var string|false the jQuery selector of the forms whose submissions should trigger pjax requests.
+ * @var string|null|false the jQuery selector of the forms whose submissions should trigger pjax requests.
* If not set, all forms with `data-pjax` attribute within the enclosed content of Pjax will trigger pjax requests.
* If set to false, no code will be registered to handle forms.
* Note that if the response to the pjax request is a full page, a normal request will be sent again.