Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions framework/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ Yii Framework 2 Change Log
- Bug #20344: Fix `yii\helpers\VarDumper::dumpAsString()` leaving the `<?php` open tag in highlighted output on PHP 8.3+ (mixxael, terabytesoftw)
- Bug #21115: Fix PHPStan 2.3.0 `parameterByRef.type` error in `yii\db\QueryBuilder::getTableUniqueColumnNames()` (theluckystrike)
- Enh #20681: Add `yii\base\ErrorHandler::fallbackExceptionMessage()` to customize the message shown by `handleFallbackExceptionMessage()` when `YII_DEBUG` is disabled (ZhandosKz, terabytesoftw)
- Bug #21124: Fix `@var` annotation for `yii\db\ActiveRelationTrait::$inverseOf` (mspirkov)
- Bug #21124: Fix `@param` annotations for `$type` in `addColumn()` and `alterColumn()` of `yii\db\Migration`, `yii\db\Command` and `yii\db\QueryBuilder` (mspirkov)
- Enh #21124: Clarify the type of the `yii\log\Logger::$messages` (mspirkov)
- Bug #21124: Separate the `@property` annotations for `$request` and `$response` in `yii\web\Controller` and `yii\console\Controller` (mspirkov)
- Bug #21124: Fix `@return` annotations for `parseRequest()` in `yii\web\UrlManager`, `yii\web\UrlRuleInterface` and `yii\web\UrlRule` (mspirkov)

2.0.55 May 09, 2026
-------------------
Expand Down
6 changes: 4 additions & 2 deletions framework/console/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@
* where `<route>` is a route to a controller action and the params will be populated as properties of a command.
* See [[options()]] for details.
*
* @property Request $request The request object.
* @property Response $response The response object.
* @property-read Request $request The request object.
* @property-read Response $response The response object.
* @property-write Request|array|string $request The request object.
* @property-write Response|array|string $response The response object.
* @property-read string $help The help information for this controller.
* @property-write bool $help Whether to display help information about current command.
* @property-read string $helpSummary The one-line short summary describing this controller.
Expand Down
2 changes: 1 addition & 1 deletion framework/db/ActiveRelationTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ trait ActiveRelationTrait
*/
public $via;
/**
* @var string the name of the relation that is the inverse of this relation.
* @var string|null the name of the relation that is the inverse of this relation.
* For example, an order has a customer, which means the inverse of the "customer" relation
* is the "orders", and the inverse of the "orders" relation is the "customer".
* If this property is set, the primary record(s) will be referenced through the specified relation.
Expand Down
4 changes: 2 additions & 2 deletions framework/db/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ public function truncateTable($table)
* Creates a SQL command for adding a new DB column.
* @param string $table the table that the new column will be added to. The table name will be properly quoted by the method.
* @param string $column the name of the new column. The name will be properly quoted by the method.
* @param string $type the column type. [[\yii\db\QueryBuilder::getColumnType()]] will be called
* @param string|ColumnSchemaBuilder $type the column type. [[\yii\db\QueryBuilder::getColumnType()]] will be called
* to convert the given column type to the physical one. For example, `string` will be converted
* as `varchar(255)`, and `string not null` becomes `varchar(255) not null`.
* @return $this the command object itself
Expand Down Expand Up @@ -754,7 +754,7 @@ public function renameColumn($table, $oldName, $newName)
* Creates a SQL command for changing the definition of a column.
* @param string $table the table whose column is to be changed. The table name will be properly quoted by the method.
* @param string $column the name of the column to be changed. The name will be properly quoted by the method.
* @param string $type the column type. [[\yii\db\QueryBuilder::getColumnType()]] will be called
* @param string|ColumnSchemaBuilder $type the column type. [[\yii\db\QueryBuilder::getColumnType()]] will be called
* to convert the give column type to the physical one. For example, `string` will be converted
* as `varchar(255)`, and `string not null` becomes `varchar(255) not null`.
* @return $this the command object itself
Expand Down
4 changes: 2 additions & 2 deletions framework/db/Migration.php
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ public function truncateTable($table)
* Builds and executes a SQL statement for adding a new DB column.
* @param string $table the table that the new column will be added to. The table name will be properly quoted by the method.
* @param string $column the name of the new column. The name will be properly quoted by the method.
* @param string $type the column type. The [[QueryBuilder::getColumnType()]] method will be invoked to convert abstract column type (if any)
* @param string|ColumnSchemaBuilder $type the column type. The [[QueryBuilder::getColumnType()]] method will be invoked to convert abstract column type (if any)
* into the physical one. Anything that is not recognized as abstract type will be kept in the generated SQL.
* For example, 'string' will be turned into 'varchar(255)', while 'string not null' will become 'varchar(255) not null'.
*/
Expand Down Expand Up @@ -422,7 +422,7 @@ public function renameColumn($table, $name, $newName)
* Builds and executes a SQL statement for changing the definition of a column.
* @param string $table the table whose column is to be changed. The table name will be properly quoted by the method.
* @param string $column the name of the column to be changed. The name will be properly quoted by the method.
* @param string $type the new column type. The [[QueryBuilder::getColumnType()]] method will be invoked to convert abstract column type (if any)
* @param string|ColumnSchemaBuilder $type the new column type. The [[QueryBuilder::getColumnType()]] method will be invoked to convert abstract column type (if any)
* into the physical one. Anything that is not recognized as abstract type will be kept in the generated SQL.
* For example, 'string' will be turned into 'varchar(255)', while 'string not null' will become 'varchar(255) not null'.
*/
Expand Down
4 changes: 2 additions & 2 deletions framework/db/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ public function truncateTable($table)
* Builds a SQL statement for adding a new DB column.
* @param string $table the table that the new column will be added to. The table name will be properly quoted by the method.
* @param string $column the name of the new column. The name will be properly quoted by the method.
* @param string $type the column type. The [[getColumnType()]] method will be invoked to convert abstract column type (if any)
* @param string|ColumnSchemaBuilder $type the column type. The [[getColumnType()]] method will be invoked to convert abstract column type (if any)
* into the physical one. Anything that is not recognized as abstract type will be kept in the generated SQL.
* For example, 'string' will be turned into 'varchar(255)', while 'string not null' will become 'varchar(255) not null'.
* @return string the SQL statement for adding a new column.
Expand Down Expand Up @@ -845,7 +845,7 @@ public function renameColumn($table, $oldName, $newName)
* Builds a SQL statement for changing the definition of a column.
* @param string $table the table whose column is to be changed. The table name will be properly quoted by the method.
* @param string $column the name of the column to be changed. The name will be properly quoted by the method.
* @param string $type the new column type. The [[getColumnType()]] method will be invoked to convert abstract
* @param string|ColumnSchemaBuilder $type the new column type. The [[getColumnType()]] method will be invoked to convert abstract
* column type (if any) into the physical one. Anything that is not recognized as abstract type will be kept
* in the generated SQL. For example, 'string' will be turned into 'varchar(255)', while 'string not null'
* will become 'varchar(255) not null'.
Expand Down
3 changes: 2 additions & 1 deletion framework/db/mssql/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

use yii\base\InvalidArgumentException;
use yii\base\NotSupportedException;
use yii\db\ColumnSchemaBuilder;
use yii\db\Expression;
use yii\db\Query;
use yii\db\TableSchema;
Expand Down Expand Up @@ -168,7 +169,7 @@ public function renameColumn($table, $oldName, $newName)
* Builds a SQL statement for changing the definition of a column.
* @param string $table the table whose column is to be changed. The table name will be properly quoted by the method.
* @param string $column the name of the column to be changed. The name will be properly quoted by the method.
* @param string $type the new column type. The [[getColumnType]] method will be invoked to convert abstract column type (if any)
* @param string|ColumnSchemaBuilder $type the new column type. The [[getColumnType]] method will be invoked to convert abstract column type (if any)
* into the physical one. Anything that is not recognized as abstract type will be kept in the generated SQL.
* For example, 'string' will be turned into 'varchar(255)', while 'string not null' will become 'varchar(255) not null'.
* @return string the SQL statement for changing the definition of a column.
Expand Down
3 changes: 2 additions & 1 deletion framework/db/oci/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
namespace yii\db\oci;

use yii\base\InvalidArgumentException;
use yii\db\ColumnSchemaBuilder;
use yii\db\Connection;
use yii\db\Exception;
use yii\db\Expression;
Expand Down Expand Up @@ -111,7 +112,7 @@ public function renameTable($table, $newName)
*
* @param string $table the table whose column is to be changed. The table name will be properly quoted by the method.
* @param string $column the name of the column to be changed. The name will be properly quoted by the method.
* @param string $type the new column type. The [[getColumnType]] method will be invoked to convert abstract column type (if any)
* @param string|ColumnSchemaBuilder $type the new column type. The [[getColumnType]] method will be invoked to convert abstract column type (if any)
* into the physical one. Anything that is not recognized as abstract type will be kept in the generated SQL.
* For example, 'string' will be turned into 'varchar(255)', while 'string not null' will become 'varchar(255) not null'.
* @return string the SQL statement for changing the definition of a column.
Expand Down
3 changes: 2 additions & 1 deletion framework/db/pgsql/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
namespace yii\db\pgsql;

use yii\base\InvalidArgumentException;
use yii\db\ColumnSchemaBuilder;
use yii\db\Expression;
use yii\db\ExpressionInterface;
use yii\db\Query;
Expand Down Expand Up @@ -243,7 +244,7 @@ public function truncateTable($table)
* Builds a SQL statement for changing the definition of a column.
* @param string $table the table whose column is to be changed. The table name will be properly quoted by the method.
* @param string $column the name of the column to be changed. The name will be properly quoted by the method.
* @param string $type the new column type. The [[getColumnType()]] method will be invoked to convert abstract
* @param string|ColumnSchemaBuilder $type the new column type. The [[getColumnType()]] method will be invoked to convert abstract
* column type (if any) into the physical one. Anything that is not recognized as abstract type will be kept
* in the generated SQL. For example, 'string' will be turned into 'varchar(255)', while 'string not null'
* will become 'varchar(255) not null'. You can also use PostgreSQL-specific syntax such as `SET NOT NULL`.
Expand Down
3 changes: 2 additions & 1 deletion framework/db/sqlite/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

use yii\base\InvalidArgumentException;
use yii\base\NotSupportedException;
use yii\db\ColumnSchemaBuilder;
use yii\db\Connection;
use yii\db\Expression;
use yii\db\ExpressionInterface;
Expand Down Expand Up @@ -327,7 +328,7 @@ public function renameTable($table, $newName)
* Builds a SQL statement for changing the definition of a column.
* @param string $table the table whose column is to be changed. The table name will be properly quoted by the method.
* @param string $column the name of the column to be changed. The name will be properly quoted by the method.
* @param string $type the new column type. The [[getColumnType()]] method will be invoked to convert abstract
* @param string|ColumnSchemaBuilder $type the new column type. The [[getColumnType()]] method will be invoked to convert abstract
* column type (if any) into the physical one. Anything that is not recognized as abstract type will be kept
* in the generated SQL. For example, 'string' will be turned into 'varchar(255)', while 'string not null'
* will become 'varchar(255) not null'.
Expand Down
4 changes: 2 additions & 2 deletions framework/log/Logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ class Logger extends Component
*/
public const LEVEL_PROFILE_END = 0x60;
/**
* @var array logged messages. This property is managed by [[log()]] and [[flush()]].
* Each log message is of the following structure:
* @var array<array{mixed, int, string, float, array, int}> logged messages. This property is managed
* by [[log()]] and [[flush()]]. Each log message is of the following structure:
*
* ```
* [
Expand Down
6 changes: 4 additions & 2 deletions framework/web/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@
*
* For more details and usage information on Controller, see the [guide article on controllers](guide:structure-controllers).
*
* @property Request $request The request object.
* @property Response $response The response object.
* @property-read Request $request The request object.
* @property-read Response $response The response object.
* @property-write Request|array|string $request The request object.
* @property-write Response|array|string $response The response object.
* @property View $view The view object that can be used to render views or view files.
*
* @author Qiang Xue <qiang.xue@gmail.com>
Expand Down
2 changes: 1 addition & 1 deletion framework/web/UrlManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ protected function getBuiltRulesFromCache($ruleDeclarations)
/**
* Parses the user request.
* @param Request $request the request component
* @return array|bool the route and the associated parameters. The latter is always empty
* @return array|false the route and the associated parameters. The latter is always empty
* if [[enablePrettyUrl]] is `false`. `false` is returned if the current request cannot be successfully parsed.
*/
public function parseRequest($request)
Expand Down
2 changes: 1 addition & 1 deletion framework/web/UrlRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ protected function hasNormalizer($manager)
* Parses the given request and returns the corresponding route and parameters.
* @param UrlManager $manager the URL manager
* @param Request $request the request component
* @return array|bool the parsing result. The route and the parameters are returned as an array.
* @return array|false the parsing result. The route and the parameters are returned as an array.
* If `false`, it means this rule cannot be used to parse this path info.
*/
public function parseRequest($manager, $request)
Expand Down
2 changes: 1 addition & 1 deletion framework/web/UrlRuleInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ interface UrlRuleInterface
* Parses the given request and returns the corresponding route and parameters.
* @param UrlManager $manager the URL manager
* @param Request $request the request component
* @return array|bool the parsing result. The route and the parameters are returned as an array.
* @return array|false the parsing result. The route and the parameters are returned as an array.
* If false, it means this rule cannot be used to parse this path info.
*/
public function parseRequest($manager, $request);
Expand Down
14 changes: 7 additions & 7 deletions tests/framework/log/LoggerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public function testFlushWithoutDispatcher(): void
$dispatcher = $this->createMock(stdClass::class);
$dispatcher->expects($this->never())->method($this->anything());

$this->logger->messages = ['anything'];
$this->logger->messages = [['anything', Logger::LEVEL_INFO, 'category', 10.0, [], 1048576]];
// @phpstan-ignore assign.propertyType (We intentionally use an invalid value here to test its processing)
$this->logger->dispatcher = $dispatcher;
$this->logger->flush();
Expand All @@ -114,7 +114,7 @@ public function testFlushWithoutDispatcher(): void
*/
public function testFlushWithDispatcherAndDefaultParam(): void
{
$message = ['anything'];
$message = [['anything', Logger::LEVEL_INFO, 'category', 10.0, [], 1048576]];
$this->dispatcher->expects($this->once())
->method('dispatch')->with($this->equalTo($message), $this->equalTo(false));

Expand All @@ -129,7 +129,7 @@ public function testFlushWithDispatcherAndDefaultParam(): void
*/
public function testFlushWithDispatcherAndDefinedParam(): void
{
$message = ['anything'];
$message = [['anything', Logger::LEVEL_INFO, 'category', 10.0, [], 1048576]];
$this->dispatcher->expects($this->once())
->method('dispatch')->with($this->equalTo($message), $this->equalTo(true));

Expand Down Expand Up @@ -344,7 +344,7 @@ public function testGetLevelName(): void
*/
public function testGetProfilingWithEmptyCategoriesAndExcludeCategories(): void
{
$messages = ['anyData'];
$messages = [['anyData', Logger::LEVEL_PROFILE_BEGIN, 'category', 10.0, [], 1048576]];
$returnValue = 'return value';

$logger = $this->createPartialMock(Logger::class, ['calculateTimings']);
Expand All @@ -361,7 +361,7 @@ public function testGetProfilingWithEmptyCategoriesAndExcludeCategories(): void
*/
public function testGetProfilingWithNotEmptyCategoriesAndNotMatched(): void
{
$messages = ['anyData'];
$messages = [['anyData', Logger::LEVEL_PROFILE_BEGIN, 'category', 10.0, [], 1048576]];
$returnValue = [
[
'info' => 'token',
Expand All @@ -386,7 +386,7 @@ public function testGetProfilingWithNotEmptyCategoriesAndNotMatched(): void
*/
public function testGetProfilingWithNotEmptyCategoriesAndMatched(): void
{
$messages = ['anyData'];
$messages = [['anyData', Logger::LEVEL_PROFILE_BEGIN, 'category', 10.0, [], 1048576]];
$matchedByCategoryName = [
'info' => 'token',
'category' => 'category',
Expand Down Expand Up @@ -435,7 +435,7 @@ public function testGetProfilingWithNotEmptyCategoriesAndMatched(): void
*/
public function testGetProfilingWithNotEmptyCategoriesMatchedAndExcludeCategories(): void
{
$messages = ['anyData'];
$messages = [['anyData', Logger::LEVEL_PROFILE_BEGIN, 'category', 10.0, [], 1048576]];
$fistCategory = [
'info' => 'fistToken',
'category' => 'cat',
Expand Down
Loading