From 38f038175f978efac5e626de23a936cf84a3e049 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Tue, 7 Jul 2020 14:40:16 +0300 Subject: [PATCH] Adjust changelog, correct phpdoc, minor code style fixes --- framework/CHANGELOG.md | 26 +++++++++++++------------- framework/base/Controller.php | 9 +++++---- framework/base/ErrorHandler.php | 4 ++-- framework/console/Controller.php | 4 ++-- framework/db/mssql/Schema.php | 15 ++++++++++----- framework/mutex/Mutex.php | 3 ++- 6 files changed, 34 insertions(+), 27 deletions(-) diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 09518ef869..ef8c9210ac 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -4,32 +4,32 @@ Yii Framework 2 Change Log 2.0.36 under development ------------------------ -- Bug #18127: Add resolving DI references inside of arrays in dependencies (hiqsol) -- Bug #18047: Fix colorization markers output in Table.php (cheeseq) -- Bug #18028: Fix division by zero exception in Table.php::calculateRowHeight (fourhundredfour) +- Bug #18127: Resolve DI references inside of arrays in dependencies (hiqsol) +- Bug #18047: Fix colorization markers output in console `Table` (cheeseq) +- Bug #18028: Fix division by zero exception in console `Table::calculateRowHeight()` (fourhundredfour) - Enh #18019: Allow jQuery 3.5.0 to be installed (wouter90) - Bug #18026: Fix `ArrayHelper::getValue()` did not work with `ArrayAccess` objects (mikk150) - Enh #18048: Use `Instance::ensure()` to set `User::$accessChecker` (lav45) - Bug #18051: Fix missing support for custom validation method in EachValidator (bizley) - Enh #17722: Add action injection support (SamMousa, samdark, erickskrauch) - Bug #18041: Fix RBAC migration for MSSQL (darkdef) -- Bug #18081: Fix for PDO_DBLIB/MSSQL. Set flag ANSI_NULL_DFLT_ON to ON for current connect to DB (darkdef) +- Bug #18081: Fix for PDO_DBLIB/MSSQL. Set flag `ANSI_NULL_DFLT_ON` to ON for current DB connection (darkdef) - Bug #13828: Fix retrieving inserted data for a primary key of type uniqueidentifier for SQL Server 2005 or later (darkdef) - Bug #17474: Fix retrieving inserted data for a primary key of type trigger for SQL Server 2005 or later (darkdef) - Bug #18001: Fix getting table metadata for tables `(` in their name (floor12) -- Bug #18096: Fix InlineValidator with anonymous inline function not working well from EachValidator (trombipeti) +- Bug #18096: Fix `InlineValidator` with anonymous inline function not working well from `EachValidator` (trombipeti) - Enh #18083: Add `Controller::$request` and `$response` (brandonkelly) -- Bug #18101: Fix behavior of OUTPUT INSERTED.* for SQL Server query: "insert default values"; correct MSSQL unit tests; turn off profiling echo message in migration test (darkdef) -- Bug #18105: Fix for old trigger in RBAC migration with/without prefixTable (darkdef) -- Enh #18120: Include path to the log file into error message if `FileTarget::export` fails (uaoleg) +- Bug #18101: Fix behavior of `OUTPUT INSERTED.*` for SQL Server query: "insert default values"; correct MSSQL unit tests; turn off profiling echo message in migration test (darkdef) +- Bug #18105: Fix for old trigger in RBAC migration with/without `prefixTable` (darkdef) +- Enh #18120: Include the path to the log file into error message if `FileTarget::export` fails (uaoleg) - Enh #15202: Add optional param `--silent-exit-on-exception` in `yii\console\Controller` (egorrishe) - Bug #18110: Add quotes to return value of viewName in MSSQL schema. It is `[someView]` now (darkdef) - Bug #17985: Convert migrationNamespaces to array if needed (darkdef) -- Bug #18031: HttpBasicAuth with auth callback now triggers login events same was as other authentication methods (samdark) -- Bug #18134: Expression as columnName should not be quoted in likeCondition (darkdef) -- Bug #18147: Fixed parameters binding for MySQL when prepare emulation is off (rskrzypczak) -- Enh #18151: Added `Mutex::isAcquired()` to check if lock is currently acquired (rhertogh) -- Bug #18094: Support for composite file extension validation (darkdef) +- Bug #18031: `HttpBasicAuth` with auth callback now triggers login events same was as other authentication methods (samdark) +- Bug #18134: `Expression` as `columnName` should not be quoted in `likeCondition` (darkdef) +- Bug #18147: Fix parameters binding for MySQL when prepare emulation is off (rskrzypczak) +- Enh #18151: Add `Mutex::isAcquired()` to check if lock is currently acquired (rhertogh) +- Bug #18094: Add support for composite file extension validation (darkdef) - Bug #18086: Fix accessing public properties of `ArrayAccess` via `ArrayHelper::getValue()` (samdark) - Bug #18051: Fix using `EachValidator` with custom validation function (bizley) diff --git a/framework/base/Controller.php b/framework/base/Controller.php index b98135c10c..79e4dc1efe 100644 --- a/framework/base/Controller.php +++ b/framework/base/Controller.php @@ -9,6 +9,7 @@ namespace yii\base; use Yii; use yii\di\Instance; +use yii\di\NotInstantiableException; /** * Controller is the base class for classes containing controller logic. @@ -65,12 +66,12 @@ class Controller extends Component implements ViewContextInterface */ public $action; /** - * @var Request|array|string The request + * @var Request|array|string The request. * @since 2.0.36 */ public $request = 'request'; /** - * @var Response|array|string + * @var Response|array|string The response. * @since 2.0.36 */ public $response = 'response'; @@ -553,8 +554,8 @@ class Controller extends Component implements ViewContextInterface * @param array &$args The array of arguments for the action, this function may append items to it. * @param array &$requestedParams The array with requested params, this function may write specific keys to it. * @throws ErrorException when we cannot load a required service. - * @throws \yii\base\InvalidConfigException Thrown when there is an error in the DI configuration. - * @throws \yii\di\NotInstantiableException Thrown when a definition cannot be resolved to a concrete class + * @throws InvalidConfigException Thrown when there is an error in the DI configuration. + * @throws NotInstantiableException Thrown when a definition cannot be resolved to a concrete class * (for example an interface type hint) without a proper definition in the container. * @since 2.0.36 */ diff --git a/framework/base/ErrorHandler.php b/framework/base/ErrorHandler.php index eb892e5f38..07b3c3cc16 100644 --- a/framework/base/ErrorHandler.php +++ b/framework/base/ErrorHandler.php @@ -42,8 +42,8 @@ abstract class ErrorHandler extends Component */ public $exception; /** - * @var bool if TRUE - `handleException()` will finish script with `ExitCode::OK`. - * FALSE - `ExitCode::UNSPECIFIED_ERROR`. + * @var bool if true - `handleException()` will finish script with `ExitCode::OK`. + * false - `ExitCode::UNSPECIFIED_ERROR`. * @since 2.0.36 */ public $silentExitOnException; diff --git a/framework/console/Controller.php b/framework/console/Controller.php index 402699711a..378b234445 100644 --- a/framework/console/Controller.php +++ b/framework/console/Controller.php @@ -66,8 +66,8 @@ class Controller extends \yii\base\Controller */ public $help; /** - * @var bool if TRUE - script finish with `ExitCode::OK` in case of exception. - * FALSE - `ExitCode::UNSPECIFIED_ERROR`. + * @var bool if true - script finish with `ExitCode::OK` in case of exception. + * false - `ExitCode::UNSPECIFIED_ERROR`. * Default: `YII_ENV_TEST` * @since 2.0.36 */ diff --git a/framework/db/mssql/Schema.php b/framework/db/mssql/Schema.php index 469e54e784..e92f9385e0 100644 --- a/framework/db/mssql/Schema.php +++ b/framework/db/mssql/Schema.php @@ -600,7 +600,7 @@ SQL; return '[' . $item . ']'; }, $views); - return $views; + return $views; } /** @@ -768,8 +768,8 @@ SQL; return false; } - $version2005orLater = version_compare($this->db->getSchema()->getServerVersion(), '9', '>='); - $inserted = $version2005orLater ? $command->pdoStatement->fetch() : []; + $isVersion2005orLater = version_compare($this->db->getSchema()->getServerVersion(), '9', '>='); + $inserted = $isVersion2005orLater ? $command->pdoStatement->fetch() : []; $tableSchema = $this->getTableSchema($table); $result = []; @@ -779,8 +779,13 @@ SQL; break; } // @see https://github.com/yiisoft/yii2/issues/13828 & https://github.com/yiisoft/yii2/issues/17474 - $result[$name] = isset($inserted[$name]) ? $inserted[$name] : - (isset($columns[$name]) ? $columns[$name] : $tableSchema->columns[$name]->defaultValue); + if (isset($inserted[$name])) { + $result[$name] = $inserted[$name]; + } elseif (isset($columns[$name])) { + $result[$name] = $columns[$name]; + } else { + $result[$name] = $tableSchema->columns[$name]->defaultValue; + } } return $result; diff --git a/framework/mutex/Mutex.php b/framework/mutex/Mutex.php index 9f4a4613c6..cfa683409a 100644 --- a/framework/mutex/Mutex.php +++ b/framework/mutex/Mutex.php @@ -104,7 +104,8 @@ abstract class Mutex extends Component * @return bool Returns true if currently acquired * @since 2.0.36 */ - public function isAcquired($name) { + public function isAcquired($name) + { return in_array($name, $this->_locks, true); }