From e6c7850b51d47f0a697796418d62328b6e4c2ca7 Mon Sep 17 00:00:00 2001 From: charescape Date: Tue, 23 Aug 2022 12:54:11 +0800 Subject: [PATCH] revert a87c02c7 --- framework/BaseYii.php | 2 +- framework/base/Application.php | 2 +- framework/base/ErrorException.php | 2 +- framework/base/ErrorHandler.php | 14 +++++++------- framework/base/ExitException.php | 2 +- framework/base/Module.php | 4 ++-- framework/base/Theme.php | 2 +- framework/base/View.php | 2 +- framework/base/Widget.php | 8 +------- .../behaviors/AttributeTypecastBehavior.php | 2 +- framework/behaviors/SluggableBehavior.php | 2 +- framework/caching/DbQueryDependency.php | 2 +- framework/caching/FileCache.php | 2 +- framework/captcha/CaptchaAction.php | 4 ++-- framework/console/ErrorHandler.php | 2 +- framework/console/UnknownCommandException.php | 4 ++-- .../controllers/BaseMigrateController.php | 4 ++-- .../console/controllers/MessageController.php | 4 ++-- framework/data/ArrayDataProvider.php | 2 +- framework/data/BaseDataProvider.php | 2 +- framework/data/Pagination.php | 6 +++--- framework/data/Sort.php | 6 +++--- framework/data/SqlDataProvider.php | 2 +- framework/db/ActiveRecord.php | 6 +++--- framework/db/Connection.php | 12 ++++++------ framework/db/Exception.php | 2 +- framework/db/Migration.php | 2 +- framework/db/Query.php | 2 +- framework/di/Instance.php | 8 ++------ framework/di/NotInstantiableException.php | 2 +- framework/filters/AccessControl.php | 2 +- framework/filters/AccessRule.php | 16 ++++++++-------- framework/filters/AjaxFilter.php | 2 +- framework/filters/ContentNegotiator.php | 6 +++--- framework/filters/Cors.php | 4 ++-- framework/filters/HostControl.php | 2 +- framework/filters/PageCache.php | 2 +- framework/filters/RateLimiter.php | 6 +++--- framework/filters/auth/AuthMethod.php | 6 +++--- framework/filters/auth/HttpBasicAuth.php | 2 +- framework/grid/ActionColumn.php | 4 ++-- framework/grid/DataColumn.php | 6 +++--- framework/grid/GridView.php | 6 +++--- framework/helpers/BaseArrayHelper.php | 2 +- framework/helpers/BaseFileHelper.php | 4 ++-- framework/helpers/BaseMarkdown.php | 2 +- framework/i18n/Formatter.php | 10 +++++----- framework/i18n/Locale.php | 2 +- framework/i18n/MessageSource.php | 2 +- framework/log/Dispatcher.php | 4 ++-- framework/log/FileTarget.php | 4 ++-- framework/log/Target.php | 2 +- framework/mail/BaseMailer.php | 2 +- framework/mutex/FileMutex.php | 4 ++-- framework/rbac/DbManager.php | 2 +- framework/rest/Action.php | 4 ++-- framework/rest/IndexAction.php | 2 +- framework/rest/Serializer.php | 6 +++--- framework/test/ActiveFixture.php | 4 ++-- framework/validators/DateValidator.php | 8 ++++---- framework/validators/ExistValidator.php | 6 +++--- framework/validators/IpValidator.php | 6 ++++-- framework/validators/StringValidator.php | 6 +++--- framework/validators/UniqueValidator.php | 4 ++-- framework/validators/Validator.php | 10 +++++----- framework/views/errorHandler/error.php | 2 +- framework/views/errorHandler/exception.php | 2 +- framework/web/AssetBundle.php | 2 +- framework/web/AssetManager.php | 4 ++-- framework/web/ConflictHttpException.php | 4 ++-- framework/web/ErrorAction.php | 6 +++--- framework/web/ErrorHandler.php | 10 +++++----- framework/web/ForbiddenHttpException.php | 4 ++-- framework/web/GoneHttpException.php | 4 ++-- framework/web/GroupUrlRule.php | 2 +- framework/web/MethodNotAllowedHttpException.php | 4 ++-- framework/web/NotAcceptableHttpException.php | 4 ++-- framework/web/NotFoundHttpException.php | 4 ++-- .../web/RangeNotSatisfiableHttpException.php | 4 ++-- framework/web/Response.php | 10 +++++----- framework/web/ServerErrorHttpException.php | 4 ++-- framework/web/TooManyRequestsHttpException.php | 4 ++-- framework/web/UnauthorizedHttpException.php | 4 ++-- .../web/UnprocessableEntityHttpException.php | 4 ++-- .../web/UnsupportedMediaTypeHttpException.php | 4 ++-- framework/web/UrlNormalizerRedirectException.php | 4 ++-- framework/web/UrlRule.php | 8 ++++---- framework/web/User.php | 6 +++--- framework/web/XmlResponseFormatter.php | 2 +- framework/widgets/ActiveField.php | 12 ++++++------ framework/widgets/ActiveForm.php | 2 +- framework/widgets/Breadcrumbs.php | 2 +- framework/widgets/DetailView.php | 4 ++-- framework/widgets/InputWidget.php | 6 +++--- framework/widgets/LinkSorter.php | 4 ++-- framework/widgets/Menu.php | 4 ++-- framework/widgets/Pjax.php | 4 ++-- 97 files changed, 206 insertions(+), 214 deletions(-) diff --git a/framework/BaseYii.php b/framework/BaseYii.php index 2f9c8c00c27..f1a3b6b4117 100644 --- a/framework/BaseYii.php +++ b/framework/BaseYii.php @@ -384,7 +384,7 @@ public static function getLogger() /** * Sets the logger object. - * @param Logger|null $logger the logger object. + * @param Logger $logger the logger object. */ public static function setLogger($logger) { diff --git a/framework/base/Application.php b/framework/base/Application.php index e49dd3e21fc..4aa1b77985e 100644 --- a/framework/base/Application.php +++ b/framework/base/Application.php @@ -134,7 +134,7 @@ abstract class Application extends Module */ public $requestedParams; /** - * @var array|null list of installed Yii extensions. Each array element represents a single extension + * @var array 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 24fdb6e8d7d..28ead79190b 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|null $previous [optional] + * @param \Throwable|\Exception|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 f74005d2c59..0a838092efa 100644 --- a/framework/base/ErrorHandler.php +++ b/framework/base/ErrorHandler.php @@ -44,7 +44,7 @@ abstract class ErrorHandler extends Component */ public $memoryReserveSize = 262144; /** - * @var \Throwable|null the exception that is being handled currently. + * @var \Exception|null the exception that is being handled currently. */ public $exception; /** @@ -59,7 +59,7 @@ abstract class ErrorHandler extends Component */ private $_memoryReserve; /** - * @var \Throwable from HHVM error that stores backtrace + * @var \Exception from HHVM error that stores backtrace */ private $_hhvmException; /** @@ -125,7 +125,7 @@ public function unregister() * * This method is implemented as a PHP exception handler. * - * @param \Throwable $exception the exception that is not caught + * @param \Exception $exception the exception that is not caught */ public function handleException($exception) { @@ -338,13 +338,13 @@ public function handleFatalError() /** * Renders the exception. - * @param \Throwable $exception the exception to be rendered. + * @param \Exception|\Error|\Throwable $exception the exception to be rendered. */ abstract protected function renderException($exception); /** * Logs the given exception. - * @param \Throwable $exception the exception to be logged + * @param \Exception $exception the exception to be logged * @since 2.0.3 this method is now public. */ public function logException($exception) @@ -386,7 +386,7 @@ public static function convertExceptionToError($exception) /** * Converts an exception into a simple string. - * @param \Throwable $exception the exception being converted + * @param \Exception|\Error|\Throwable $exception the exception being converted * @return string the string representation of the exception. */ public static function convertExceptionToString($exception) @@ -404,7 +404,7 @@ public static function convertExceptionToString($exception) /** * Converts an exception into a string that has verbose information about the exception and its trace. - * @param \Throwable $exception the exception being converted + * @param \Exception|\Error|\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 a1111abea05..74431577175 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|null $previous The previous exception used for the exception chaining. + * @param \Throwable|\Exception|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 48e040ad560..58a848c7734 100644 --- a/framework/base/Module.php +++ b/framework/base/Module.php @@ -131,7 +131,7 @@ class Module extends ServiceLocator */ private $_modules = []; /** - * @var string|callable|null the version of this module. + * @var string|callable 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|null $version the version of this module. + * @param string|callable $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 011c8c239a4..b50334426eb 100644 --- a/framework/base/Theme.php +++ b/framework/base/Theme.php @@ -74,7 +74,7 @@ class Theme extends Component { /** - * @var array|null the mapping between view directories and their corresponding themed versions. + * @var array 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 dce2a9b0a0d..6f25c60acde 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 \Throwable + * @throws \Exception */ public function renderPhpFile($_file_, $_params_ = []) { diff --git a/framework/base/Widget.php b/framework/base/Widget.php index ecd99ecdcd5..2670cd4f2f5 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 \Throwable + * @throws \Exception */ public static function widget($config = []) { @@ -152,12 +152,6 @@ 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 4c03e1f1d33..5f12734be66 100644 --- a/framework/behaviors/AttributeTypecastBehavior.php +++ b/framework/behaviors/AttributeTypecastBehavior.php @@ -121,7 +121,7 @@ class AttributeTypecastBehavior extends Behavior */ public $owner; /** - * @var array|null attribute typecast map in format: attributeName => type. + * @var array 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 f095204e067..b62ade8ea2c 100644 --- a/framework/behaviors/SluggableBehavior.php +++ b/framework/behaviors/SluggableBehavior.php @@ -111,7 +111,7 @@ class SluggableBehavior extends AttributeBehavior */ public $uniqueValidator = []; /** - * @var callable|null slug unique value generator. It is used in case [[ensureUnique]] enabled and generated + * @var callable 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 90ffb0ff1ad..3aafd0f457e 100644 --- a/framework/caching/DbQueryDependency.php +++ b/framework/caching/DbQueryDependency.php @@ -41,7 +41,7 @@ class DbQueryDependency extends Dependency */ public $query; /** - * @var string|callable|null method which should be invoked in over the [[query]] object. + * @var string|callable 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 33214209315..52a80c67b35 100644 --- a/framework/caching/FileCache.php +++ b/framework/caching/FileCache.php @@ -57,7 +57,7 @@ class FileCache extends Cache */ public $gcProbability = 10; /** - * @var int|null the permission to be set for newly created cache files. + * @var int 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 06aa7023f5f..0f0d7d32652 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|null the fixed verification code. When this property is set, + * @var string 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|null the rendering library to use. Currently supported only 'gd' and 'imagick'. + * @var string 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 f06b82f918f..526de75dfac 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 \Throwable $exception the exception to be rendered. + * @param \Exception $exception the exception to be rendered. */ protected function renderException($exception) { diff --git a/framework/console/UnknownCommandException.php b/framework/console/UnknownCommandException.php index 180d1c9a72b..305cc6ace6c 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 \Throwable|null $previous the previous exception used for the exception chaining. + * @param \Exception|null $previous the previous exception used for the exception chaining. */ - public function __construct($route, $application, $code = 0, $previous = null) + public function __construct($route, $application, $code = 0, \Exception $previous = null) { $this->command = $route; $this->application = $application; diff --git a/framework/console/controllers/BaseMigrateController.php b/framework/console/controllers/BaseMigrateController.php index 3cbfa91010e..2e87cf5c90a 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|null the permission to be set for newly generated migration files. + * @var int 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|null the user and/or group ownership to be set for newly generated migration files. + * @var string|int 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 2e950b312b2..67bc6c5d874 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|null list of patterns that specify which files/directories should NOT be processed. + * @var array 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|null list of patterns that specify which files (not directories) should be processed. + * @var array 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 17c90981757..5e507800a07 100644 --- a/framework/data/ArrayDataProvider.php +++ b/framework/data/ArrayDataProvider.php @@ -53,7 +53,7 @@ class ArrayDataProvider extends BaseDataProvider { /** - * @var string|callable|null the column that is used as the key of the data models. + * @var string|callable 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 9169cfe8b42..4bd8cc393a4 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|null an ID that uniquely identifies the data provider among all data providers. + * @var string 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 7e9f7bb1eb0..8b59a2ad491 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|null the route of the controller action for displaying the paged contents. + * @var string 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|null parameters (name => value) that should be used to obtain the current page number + * @var array 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|null the URL manager used for creating pagination URLs. If not set, + * @var \yii\web\UrlManager 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 cf08bb1e853..3ce65af3427 100644 --- a/framework/data/Sort.php +++ b/framework/data/Sort.php @@ -159,7 +159,7 @@ class Sort extends BaseObject */ public $defaultOrder; /** - * @var string|null the route of the controller action for displaying the sorted contents. + * @var string 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|null parameters (name => value) that should be used to obtain the current sort directions + * @var array 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|null the URL manager used for creating sort URLs. If not set, + * @var \yii\web\UrlManager 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 a179d9bca6d..cf851ef8f92 100644 --- a/framework/data/SqlDataProvider.php +++ b/framework/data/SqlDataProvider.php @@ -80,7 +80,7 @@ class SqlDataProvider extends BaseDataProvider */ public $params = []; /** - * @var string|callable|null the column that is used as the key of the data models. + * @var string|callable 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 fd7e9539ebd..177f4cd7408 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 \Throwable in case insert failed. + * @throws \Exception 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 \Throwable in case update failed. + * @throws \Exception 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 \Throwable in case delete failed. + * @throws \Exception in case delete failed. */ public function delete() { diff --git a/framework/db/Connection.php b/framework/db/Connection.php index eb6bc36d2c4..bfbf15e0f46 100644 --- a/framework/db/Connection.php +++ b/framework/db/Connection.php @@ -285,7 +285,7 @@ class Connection extends Component 'cubrid' => 'yii\db\cubrid\Schema', // CUBRID ]; /** - * @var string|null Custom PDO wrapper class. If not set, it will use [[PDO]] or [[\yii\db\mssql\PDO]] when MSSQL is used. + * @var string Custom PDO wrapper class. If not set, it will use [[PDO]] or [[\yii\db\mssql\PDO]] when MSSQL is used. * @see pdo */ public $pdoClass; @@ -498,7 +498,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 \Throwable if there is any exception during query + * @throws \Exception if there is any exception during query * @see enableQueryCache * @see queryCache * @see noCache() @@ -539,7 +539,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 \Throwable if there is any exception during query + * @throws \Exception if there is any exception during query * @see enableQueryCache * @see queryCache * @see cache() @@ -806,7 +806,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 \Throwable if there is any exception during query. In this case the transaction will be rolled back. + * @throws \Exception 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) @@ -1005,7 +1005,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|null name of the DB driver + * @return string name of the DB driver */ public function getDriverName() { @@ -1120,7 +1120,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 \Throwable if there is any exception thrown from the callback + * @throws \Exception 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 674e26b75c0..5bfe1d17f54 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|null $previous The previous exception used for the exception chaining. + * @param \Throwable|\Exception|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 2094800207d..f36beba9149 100644 --- a/framework/db/Migration.php +++ b/framework/db/Migration.php @@ -159,7 +159,7 @@ public function down() } /** - * @param \Throwable $e + * @param \Throwable|\Exception $e */ private function printException($e) { diff --git a/framework/db/Query.php b/framework/db/Query.php index 913e601ec7d..eb2d312f2a8 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 \Throwable if can't create command + * @throws \Exception if can't create command */ protected function queryScalar($selectExpression, $db) { diff --git a/framework/di/Instance.php b/framework/di/Instance.php index 41af21af910..e22af88ff3f 100644 --- a/framework/di/Instance.php +++ b/framework/di/Instance.php @@ -7,6 +7,7 @@ namespace yii\di; +use Exception; use Yii; use yii\base\InvalidConfigException; @@ -173,12 +174,7 @@ public function get($container = null) } return Yii::$container->get($this->id); - } catch (\Exception $e) { - if ($this->optional) { - return null; - } - throw $e; - } catch (\Throwable $e) { + } catch (Exception $e) { if ($this->optional) { return null; } diff --git a/framework/di/NotInstantiableException.php b/framework/di/NotInstantiableException.php index ccde5bf1c58..c80332ae08c 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, $previous = null) + public function __construct($class, $message = null, $code = 0, \Exception $previous = null) { if ($message === null) { $message = "Can not instantiate $class."; diff --git a/framework/filters/AccessControl.php b/framework/filters/AccessControl.php index d8a17d51469..3e91b80a22e 100644 --- a/framework/filters/AccessControl.php +++ b/framework/filters/AccessControl.php @@ -63,7 +63,7 @@ class AccessControl extends ActionFilter */ public $user = 'user'; /** - * @var callable|null a callback that will be called if the access should be denied + * @var callable 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 25251e5fc60..8cb4fca24b7 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 = false; + public $allow; /** - * @var array|null list of action IDs that this rule applies to. The comparison is case-sensitive. + * @var array 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|null list of the controller IDs that this rule applies to. + * @var array 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|null list of roles that this rule applies to (requires properly configured User component). + * @var array 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|null list of RBAC (Role-Based Access Control) permissions that this rules applies to. + * @var array 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|null list of user IP addresses that this rule applies to. An IP address + * @var array 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|null list of request methods (e.g. `GET`, `POST`) that this rule applies to. + * @var array 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|null a callback that will be called if this rule determines the access to + * @var callable 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 65becc8b506..265f01a5705 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|null the current request. If not set, the `request` application component will be used. + * @var Request 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 8414f702445..760c4a0fab2 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|null list of supported response formats. The keys are MIME types (e.g. `application/json`) + * @var array 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|null a list of supported languages. The array keys are the supported language variants (e.g. `en-GB`, `en-US`), + * @var array 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|null the response to be sent. If not set, the `response` application component will be used. + * @var Response 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 34cc5435649..356053f514b 100644 --- a/framework/filters/Cors.php +++ b/framework/filters/Cors.php @@ -70,11 +70,11 @@ class Cors extends ActionFilter { /** - * @var Request|null the current request. If not set, the `request` application component will be used. + * @var Request the current request. If not set, the `request` application component will be used. */ public $request; /** - * @var Response|null the response to be sent. If not set, the `response` application component will be used. + * @var Response 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 b2f76fdb515..51aa5bee24a 100644 --- a/framework/filters/HostControl.php +++ b/framework/filters/HostControl.php @@ -91,7 +91,7 @@ class HostControl extends ActionFilter */ public $allowedHosts; /** - * @var callable|null a callback that will be called if the current host does not match [[allowedHosts]]. + * @var callable 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 6fd7e9d8f4a..46a8d22e53f 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|null the view component to use for caching. If not set, the default application view component + * @var \yii\base\View 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 7ab7241539c..5ffc1a69ff2 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|null the user object that implements the RateLimitInterface. If not set, it will take the value of `Yii::$app->user->getIdentity(false)`. + * @var RateLimitInterface|Closure 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|null the current request. If not set, the `request` application component will be used. + * @var Request the current request. If not set, the `request` application component will be used. */ public $request; /** - * @var Response|null the response to be sent. If not set, the `response` application component will be used. + * @var Response 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 6612e67fc4a..9dcba078c30 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|null the user object representing the user authentication status. If not set, the `user` application component will be used. + * @var User the user object representing the user authentication status. If not set, the `user` application component will be used. */ public $user; /** - * @var Request|null the current request. If not set, the `request` application component will be used. + * @var Request the current request. If not set, the `request` application component will be used. */ public $request; /** - * @var Response|null the response to be sent. If not set, the `response` application component will be used. + * @var Response 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 03420efd70c..546d0e628e6 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|null a PHP callable that will authenticate the user with the HTTP basic auth information. + * @var callable 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 e54ba3c3d2d..d945e1ea1a0 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|null the ID of the controller that should handle the actions specified here. + * @var string 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|null a callback that creates a button URL using the specified model information. + * @var callable 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 98d70bd7c8b..c8a8e9d6d7f 100644 --- a/framework/grid/DataColumn.php +++ b/framework/grid/DataColumn.php @@ -46,7 +46,7 @@ class DataColumn extends Column */ public $attribute; /** - * @var string|null label to be displayed in the [[header|header cell]] and also to be used as the sorting + * @var string 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|null an anonymous function or a string that is used to determine the value to display in the current column. + * @var string|Closure 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|null the attribute name of the [[GridView::filterModel]] associated with this column. If not set, + * @var string 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 c1b6a6b386f..1fa783f9adb 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|null the formatter used to format model attribute values into displayable texts. + * @var array|Formatter 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|null the model that keeps the user-entered filter data. When this property is set, + * @var \yii\base\Model 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|null the URL for returning the filtering result. [[Url::to()]] will be called to + * @var string|array 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 84e67f43b5d..00451a14259 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 mixed $value the value to remove from the array + * @param string $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 dc2d965bbb7..bd1f8f261a3 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|null $magicFile the path (or alias) of the file that contains all available MIME type information. + * @param string $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|null $aliasesFile the path (or alias) of the file that contains MIME type aliases. + * @param string $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 8975c476396..a1427f7b76b 100644 --- a/framework/helpers/BaseMarkdown.php +++ b/framework/helpers/BaseMarkdown.php @@ -85,7 +85,7 @@ public static function processParagraph($markdown, $flavor = null) } /** - * @param string|null $flavor the markdown flavor to use. See [[$flavors]] for available values. + * @param string $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 82af552007b..39cb85a92a3 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|null the text to be displayed when formatting a `null` value. + * @var string 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|null the locale ID that is used to localize the date and number formatting. + * @var string 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|null the language code (e.g. `en-US`, `en`) that is used to translate internal messages. + * @var string 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|null the time zone to use for formatting time and date values. + * @var string 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|null the character displayed as the decimal point when formatting a currency. + * @var string 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 f81907644aa..77ce3fdaadc 100644 --- a/framework/i18n/Locale.php +++ b/framework/i18n/Locale.php @@ -23,7 +23,7 @@ class Locale extends Component { /** - * @var string|null the locale ID. + * @var string 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 6f33bed06bb..24a4a74cd9d 100644 --- a/framework/i18n/MessageSource.php +++ b/framework/i18n/MessageSource.php @@ -33,7 +33,7 @@ class MessageSource extends Component */ public $forceTranslation = false; /** - * @var string|null the language that the original messages are in. If not set, it will use the value of + * @var string 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 26b0281a79a..16f22be92be 100644 --- a/framework/log/Dispatcher.php +++ b/framework/log/Dispatcher.php @@ -69,7 +69,7 @@ class Dispatcher extends Component public $targets = []; /** - * @var Logger|null the logger. + * @var Logger 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 $throwable catched exception + * @param \Throwable|\Exception $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 d423bc41b42..90ad3034e32 100644 --- a/framework/log/FileTarget.php +++ b/framework/log/FileTarget.php @@ -29,7 +29,7 @@ class FileTarget extends Target { /** - * @var string|null log file path or [path alias](guide:concept-aliases). If not set, it will use the "@runtime/logs/app.log" file. + * @var string 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; @@ -49,7 +49,7 @@ class FileTarget extends Target */ public $maxLogFiles = 5; /** - * @var int|null the permission to be set for newly created log files. + * @var int 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 fa05f1751ea..d57c2614ec9 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|null a PHP callable that returns a string to be prefixed to every exported message. + * @var callable 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 d564ae8708e..1b2005888a4 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|null a PHP callback that will be called by [[send()]] when [[useFileTransport]] is true. + * @var callable 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 8d0c1385532..5dc71a088cb 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|null the permission to be set for newly created mutex files. + * @var int 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|null whether file handling should assume a Windows file system. + * @var bool 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 4f909e34545..9aa29ae9453 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|null the cache used to improve RBAC performance. This can be one of the following: + * @var CacheInterface|array|string 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 6afafca4502..466acfc2f31 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|null a PHP callable that will be called to return the model corresponding + * @var callable 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|null a PHP callable that will be called when running an action to determine + * @var callable 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 766ed2a6b6b..67440fac6d9 100644 --- a/framework/rest/IndexAction.php +++ b/framework/rest/IndexAction.php @@ -25,7 +25,7 @@ class IndexAction extends Action { /** - * @var callable|null a PHP callable that will be called to prepare a data provider that + * @var callable 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 4f889613ed5..2a47511e7f0 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|null the name of the envelope (e.g. `items`) for returning the resource objects in a collection. + * @var string 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|null the current request. If not set, the `request` application component will be used. + * @var Request the current request. If not set, the `request` application component will be used. */ public $request; /** - * @var Response|null the response to be sent. If not set, the `response` application component will be used. + * @var Response 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 9fd5ce02d6b..cdb847a8e53 100644 --- a/framework/test/ActiveFixture.php +++ b/framework/test/ActiveFixture.php @@ -34,13 +34,13 @@ class ActiveFixture extends BaseActiveFixture { /** - * @var string|null the name of the database table that this fixture is about. If this property is not set, + * @var string 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|null the file path or [path alias](guide:concept-aliases) of the data file that contains the fixture data + * @var string|bool 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 3df5018b321..b97d1b5e85d 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|null the date format that the value being validated should follow. + * @var string 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|null the locale ID that is used to localize the date parsing. + * @var string 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|null the timezone to use for parsing date and time values. + * @var string 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|null the format to use when populating the [[timestampAttribute]]. + * @var string 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 55c86094b86..07ea4707efc 100644 --- a/framework/validators/ExistValidator.php +++ b/framework/validators/ExistValidator.php @@ -49,13 +49,13 @@ class ExistValidator extends Validator { /** - * @var string|null the name of the ActiveRecord class that should be used to validate the existence + * @var string 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|null the name of the ActiveRecord attribute that should be used to + * @var string|array 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, @@ -189,7 +189,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|null $attribute the name of the ActiveRecord attribute that should be used to + * @param $targetAttribute array|string $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 6c8b9d2ba83..d1d99a8cb26 100644 --- a/framework/validators/IpValidator.php +++ b/framework/validators/IpValidator.php @@ -162,7 +162,7 @@ class IpValidator extends Validator */ public $wrongCidr; /** - * @var string|null user-defined error message is used when validation fails due to subnet [[subnet]] set to 'only', + * @var string 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: @@ -245,7 +245,9 @@ public function init() * - Recursively substitutes aliases (described in [[networks]]) with their values. * - Removes duplicates * - * @param array|string|null $ranges the IPv4 or IPv6 ranges that are allowed or forbidden. + * @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. * * 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 4db6314e259..5597907b103 100644 --- a/framework/validators/StringValidator.php +++ b/framework/validators/StringValidator.php @@ -35,12 +35,12 @@ class StringValidator extends Validator */ public $length; /** - * @var int|null maximum length. If not set, it means no maximum length limit. + * @var int 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|null minimum length. If not set, it means no minimum length limit. + * @var int minimum length. If not set, it means no minimum length limit. * @see tooShort for the customized message for a too short string. */ public $min; @@ -61,7 +61,7 @@ class StringValidator extends Validator */ public $notEqual; /** - * @var string|null the encoding of the string value to be validated (e.g. 'UTF-8'). + * @var string 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 1f82d44f52f..5679b225a75 100644 --- a/framework/validators/UniqueValidator.php +++ b/framework/validators/UniqueValidator.php @@ -42,13 +42,13 @@ class UniqueValidator extends Validator { /** - * @var string|null the name of the ActiveRecord class that should be used to validate the uniqueness + * @var string 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|null the name of the [[\yii\db\ActiveRecord|ActiveRecord]] attribute that should be used to + * @var string|array 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 eb5690ea3cd..4a70c706241 100644 --- a/framework/validators/Validator.php +++ b/framework/validators/Validator.php @@ -104,7 +104,7 @@ class Validator extends Component */ public $attributes = []; /** - * @var string|null the user-defined error message. It may contain the following placeholders which + * @var string 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 whether this validation rule should be skipped if the attribute value + * @var bool|null 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|null a PHP callable that replaces the default implementation of [[isEmpty()]]. + * @var callable 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|null a PHP callable whose return value determines whether this validator should be applied. + * @var callable 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|null a JavaScript function name whose return value determines whether this validator should be applied + * @var string 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 630bbec034f..9ef6dc7f13d 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 4601e7c42bd..d097a1c92fd 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 4f7f2904e98..aca626cd4d9 100644 --- a/framework/web/AssetBundle.php +++ b/framework/web/AssetBundle.php @@ -30,7 +30,7 @@ class AssetBundle extends BaseObject { /** - * @var string|null the directory that contains the source asset files for this asset bundle. + * @var string 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 f4b41b3cf2c..f0cf15a518d 100644 --- a/framework/web/AssetManager.php +++ b/framework/web/AssetManager.php @@ -123,7 +123,7 @@ class AssetManager extends Component */ public $linkAssets = false; /** - * @var int|null the permission to be set for newly published asset files. + * @var int 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|null a callback that will be called to produce hash for asset directory generation. + * @var callable 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 d3fd07c8e71..2849e9ab811 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 \Throwable|null $previous The previous exception used for the exception chaining. + * @param \Exception|null $previous The previous exception used for the exception chaining. */ - public function __construct($message = null, $code = 0, $previous = null) + public function __construct($message = null, $code = 0, \Exception $previous = null) { parent::__construct(409, $message, $code, $previous); } diff --git a/framework/web/ErrorAction.php b/framework/web/ErrorAction.php index dde5611b5c3..c291fc05034 100644 --- a/framework/web/ErrorAction.php +++ b/framework/web/ErrorAction.php @@ -51,7 +51,7 @@ class ErrorAction extends Action { /** - * @var string|null the view file to be rendered. If not set, it will take the value of [[id]]. + * @var string 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 \Throwable the exception object, normally is filled on [[init()]] method call. + * @var \Exception 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 \Throwable + * @return \Exception * @since 2.0.11 */ protected function findException() diff --git a/framework/web/ErrorHandler.php b/framework/web/ErrorHandler.php index 2600a8b51a0..5615716730d 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 \Throwable $exception the exception to be rendered. + * @param \Exception|\Error $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 \Throwable $exception the exception being converted + * @param \Exception|\Error $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 \Throwable $exception the exception whose precursors should be rendered. + * @param \Exception $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 \Throwable $exception exception to get call stack from + * @param \Exception|\ParseError $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 \Throwable $exception + * @param \Exception $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 81e1cf02060..4fc8530076f 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 \Throwable|null $previous The previous exception used for the exception chaining. + * @param \Exception|null $previous The previous exception used for the exception chaining. */ - public function __construct($message = null, $code = 0, $previous = null) + public function __construct($message = null, $code = 0, \Exception $previous = null) { parent::__construct(403, $message, $code, $previous); } diff --git a/framework/web/GoneHttpException.php b/framework/web/GoneHttpException.php index a03a1bb0dcb..8976b7f24c7 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 \Throwable|null $previous The previous exception used for the exception chaining. + * @param \Exception|null $previous The previous exception used for the exception chaining. */ - public function __construct($message = null, $code = 0, $previous = null) + public function __construct($message = null, $code = 0, \Exception $previous = null) { parent::__construct(410, $message, $code, $previous); } diff --git a/framework/web/GroupUrlRule.php b/framework/web/GroupUrlRule.php index e2f67da3120..93cdc4bfe17 100644 --- a/framework/web/GroupUrlRule.php +++ b/framework/web/GroupUrlRule.php @@ -60,7 +60,7 @@ class GroupUrlRule extends CompositeUrlRule */ public $prefix; /** - * @var string|null the prefix for the route part of every rule declared in [[rules]]. + * @var string 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 832641e31f1..98a2767e9c6 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 \Throwable|null $previous The previous exception used for the exception chaining. + * @param \Exception|null $previous The previous exception used for the exception chaining. */ - public function __construct($message = null, $code = 0, $previous = null) + public function __construct($message = null, $code = 0, \Exception $previous = null) { parent::__construct(405, $message, $code, $previous); } diff --git a/framework/web/NotAcceptableHttpException.php b/framework/web/NotAcceptableHttpException.php index a986195d828..200c6767a50 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 \Throwable|null $previous The previous exception used for the exception chaining. + * @param \Exception|null $previous The previous exception used for the exception chaining. */ - public function __construct($message = null, $code = 0, $previous = null) + public function __construct($message = null, $code = 0, \Exception $previous = null) { parent::__construct(406, $message, $code, $previous); } diff --git a/framework/web/NotFoundHttpException.php b/framework/web/NotFoundHttpException.php index ef064bab128..b409b7fd471 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 \Throwable|null $previous The previous exception used for the exception chaining. + * @param \Exception|null $previous The previous exception used for the exception chaining. */ - public function __construct($message = null, $code = 0, $previous = null) + public function __construct($message = null, $code = 0, \Exception $previous = null) { parent::__construct(404, $message, $code, $previous); } diff --git a/framework/web/RangeNotSatisfiableHttpException.php b/framework/web/RangeNotSatisfiableHttpException.php index 253d8e24074..f8058d0ad8c 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 \Throwable|null $previous The previous exception used for the exception chaining. + * @param \Exception|null $previous The previous exception used for the exception chaining. */ - public function __construct($message = null, $code = 0, $previous = null) + public function __construct($message = null, $code = 0, \Exception $previous = null) { parent::__construct(416, $message, $code, $previous); } diff --git a/framework/web/Response.php b/framework/web/Response.php index d2c64be8607..d3b9d68eb1e 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 \Throwable $statusCodeByException The exception object. + * @property-write \Exception|\Error|\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|null the response content. When [[data]] is not null, it will be converted into [[content]] + * @var string 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|null the charset of the text response. If not set, it will use + * @var string 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|null the version of the HTTP protocol to use. If not set, it will be determined via `$_SERVER['SERVER_PROTOCOL']`, + * @var string 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 \Throwable $e the exception object. + * @param \Exception|\Error|\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 c9a6578b1eb..5631ecdf3ab 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 \Throwable|null $previous The previous exception used for the exception chaining. + * @param \Exception|null $previous The previous exception used for the exception chaining. */ - public function __construct($message = null, $code = 0, $previous = null) + public function __construct($message = null, $code = 0, \Exception $previous = null) { parent::__construct(500, $message, $code, $previous); } diff --git a/framework/web/TooManyRequestsHttpException.php b/framework/web/TooManyRequestsHttpException.php index 6549936fd99..2810b25fb40 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 \Throwable|null $previous The previous exception used for the exception chaining. + * @param \Exception|null $previous The previous exception used for the exception chaining. */ - public function __construct($message = null, $code = 0, $previous = null) + public function __construct($message = null, $code = 0, \Exception $previous = null) { parent::__construct(429, $message, $code, $previous); } diff --git a/framework/web/UnauthorizedHttpException.php b/framework/web/UnauthorizedHttpException.php index c261e9f00f1..f4fb90875e6 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 \Throwable|null $previous The previous exception used for the exception chaining. + * @param \Exception|null $previous The previous exception used for the exception chaining. */ - public function __construct($message = null, $code = 0, $previous = null) + public function __construct($message = null, $code = 0, \Exception $previous = null) { parent::__construct(401, $message, $code, $previous); } diff --git a/framework/web/UnprocessableEntityHttpException.php b/framework/web/UnprocessableEntityHttpException.php index 8fdc65aff6d..dc1fd6ff7fc 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 \Throwable|null $previous The previous exception used for the exception chaining. + * @param \Exception|null $previous The previous exception used for the exception chaining. */ - public function __construct($message = null, $code = 0, $previous = null) + public function __construct($message = null, $code = 0, \Exception $previous = null) { parent::__construct(422, $message, $code, $previous); } diff --git a/framework/web/UnsupportedMediaTypeHttpException.php b/framework/web/UnsupportedMediaTypeHttpException.php index 7d2c0f5661c..6ffb15eedb6 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 \Throwable|null $previous The previous exception used for the exception chaining. + * @param \Exception|null $previous The previous exception used for the exception chaining. */ - public function __construct($message = null, $code = 0, $previous = null) + public function __construct($message = null, $code = 0, \Exception $previous = null) { parent::__construct(415, $message, $code, $previous); } diff --git a/framework/web/UrlNormalizerRedirectException.php b/framework/web/UrlNormalizerRedirectException.php index 9d550221832..7ecf865ead1 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 \Throwable|null $previous the previous exception used for the exception chaining + * @param \Exception|null $previous the previous exception used for the exception chaining */ - public function __construct($url, $statusCode = 302, $scheme = false, $message = null, $code = 0, $previous = null) + public function __construct($url, $statusCode = 302, $scheme = false, $message = null, $code = 0, \Exception $previous = null) { $this->url = $url; $this->scheme = $scheme; diff --git a/framework/web/UrlRule.php b/framework/web/UrlRule.php index 0584568cdc0..65c6745940e 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|null the name of this rule. If not set, it will use [[pattern]] as the name. + * @var string 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|null the URL suffix used for this rule. + * @var string 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|null the HTTP verb (e.g. GET, POST, DELETE) that this rule should match. + * @var string|array 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|null a value indicating if this rule should be used for both request parsing and URL creation, + * @var int 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 d2d3009480a..0df0e946253 100644 --- a/framework/web/User.php +++ b/framework/web/User.php @@ -99,21 +99,21 @@ class User extends Component */ public $identityCookie = ['name' => '_identity', 'httpOnly' => true]; /** - * @var int|null the number of seconds in which the user will be logged out automatically if the user + * @var int 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|null The access checker object to use for checking access or the application + * @var CheckAccessInterface|string|array 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|null the number of seconds in which the user will be logged out automatically + * @var int 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 346e5fd424b..cd48c3d4dc4 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|null the XML encoding. If not set, it will use the value of [[Response::charset]]. + * @var string 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 f5dcea062bd..b7886c54f87 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|null whether to enable client-side data validation. + * @var bool whether to enable client-side data validation. * If not set, it will take the value of [[ActiveForm::enableClientValidation]]. */ public $enableClientValidation; /** - * @var bool|null whether to enable AJAX-based data validation. + * @var bool whether to enable AJAX-based data validation. * If not set, it will take the value of [[ActiveForm::enableAjaxValidation]]. */ public $enableAjaxValidation; /** - * @var bool|null whether to perform validation when the value of the input field is changed. + * @var bool 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|null whether to perform validation when the input field loses focus. + * @var bool 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|null whether to perform validation while the user is typing in the input field. + * @var bool 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|null number of milliseconds that the validation should be delayed when the user types in the field + * @var int 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 f2b2fbbe844..1d5fdc6dbe4 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|null the URL for performing AJAX-based validation. This property will be processed by + * @var array|string 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 f439521c023..b56aa0fbdf8 100644 --- a/framework/widgets/Breadcrumbs.php +++ b/framework/widgets/Breadcrumbs.php @@ -68,7 +68,7 @@ class Breadcrumbs extends Widget */ public $encodeLabels = true; /** - * @var array|null the first hyperlink in the breadcrumbs (called home link). + * @var array 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 426281c3a6e..62e0987fbd4 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|null the HTML attributes for the container tag of this widget. The `tag` option specifies + * @var array 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|null the formatter used to format model attribute values into displayable texts. + * @var array|Formatter 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 e7aae1ce0d6..eed67443d07 100644 --- a/framework/widgets/InputWidget.php +++ b/framework/widgets/InputWidget.php @@ -43,15 +43,15 @@ class InputWidget extends Widget */ public $field; /** - * @var Model|null the data model that this widget is associated with. + * @var Model the data model that this widget is associated with. */ public $model; /** - * @var string|null the model attribute that this widget is associated with. + * @var string the model attribute that this widget is associated with. */ public $attribute; /** - * @var string|null the input name. This must be set if [[model]] and [[attribute]] are not set. + * @var string 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 620cf0e9326..a0e95990e38 100644 --- a/framework/widgets/LinkSorter.php +++ b/framework/widgets/LinkSorter.php @@ -26,11 +26,11 @@ class LinkSorter extends Widget { /** - * @var Sort|null the sort definition + * @var Sort the sort definition */ public $sort; /** - * @var array|null list of the attributes that support sorting. If not set, it will be determined + * @var array 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 859e092b058..db838f66fa3 100644 --- a/framework/widgets/Menu.php +++ b/framework/widgets/Menu.php @@ -151,14 +151,14 @@ class Menu extends Widget */ public $lastItemCssClass; /** - * @var string|null the route used to determine if a menu item is active or not. + * @var string the route used to determine if a menu item is active or not. * If not set, it will use the route of the current request. * @see params * @see isItemActive() */ public $route; /** - * @var array|null the parameters used to determine if a menu item is active or not. + * @var array the parameters used to determine if a menu item is active or not. * If not set, it will use `$_GET`. * @see route * @see isItemActive() diff --git a/framework/widgets/Pjax.php b/framework/widgets/Pjax.php index 69595e0d3b8..1e5d90104c1 100644 --- a/framework/widgets/Pjax.php +++ b/framework/widgets/Pjax.php @@ -55,14 +55,14 @@ class Pjax extends Widget */ public $options = []; /** - * @var string|null|false the jQuery selector of the links that should trigger pjax requests. + * @var string|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|null|false the jQuery selector of the forms whose submissions should trigger pjax requests. + * @var string|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.