mirror of
https://github.com/yiisoft/yii2.git
synced 2025-12-14 18:31:22 +08:00
Fix #20634: Fix PHPDoc annotations in yii\db namespace. Add PHPStan/Psalm annotations for yii\db\SqlTokenizer::startsWithAnyLongest()
This commit is contained in:
@@ -67,6 +67,7 @@ Yii Framework 2 Change Log
|
|||||||
- Bug #20617: Fix `@return` annotation for `DataColumn::getDataCellValue()` (mspirkov)
|
- Bug #20617: Fix `@return` annotation for `DataColumn::getDataCellValue()` (mspirkov)
|
||||||
- Bug #20628: Fix `@return` annotations for `lastInsertId` methods in `yii\db\mssql` namespace (mspirkov)
|
- Bug #20628: Fix `@return` annotations for `lastInsertId` methods in `yii\db\mssql` namespace (mspirkov)
|
||||||
- Bug #20630: Fix `@var` annotations for `yii\web\CompositeUrlRule::$rules` and `yii\web\GroupUrlRule::$rules` (mspirkov)
|
- Bug #20630: Fix `@var` annotations for `yii\web\CompositeUrlRule::$rules` and `yii\web\GroupUrlRule::$rules` (mspirkov)
|
||||||
|
- Bug #20634: Fix PHPDoc annotations in `yii\db` namespace. Add PHPStan/Psalm annotations for `yii\db\SqlTokenizer::startsWithAnyLongest()` (mspirkov)
|
||||||
- Bug #20636: Fix `@param` annotations for `$message` in logging methods (mspirkov)
|
- Bug #20636: Fix `@param` annotations for `$message` in logging methods (mspirkov)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -223,7 +223,7 @@ class DynamicModel extends Model
|
|||||||
*/
|
*/
|
||||||
public static function validateData(array $data, $rules = [])
|
public static function validateData(array $data, $rules = [])
|
||||||
{
|
{
|
||||||
/** @var self $model */
|
/** @var static $model */
|
||||||
$model = new static($data);
|
$model = new static($data);
|
||||||
if (!empty($rules)) {
|
if (!empty($rules)) {
|
||||||
$validators = $model->getValidators();
|
$validators = $model->getValidators();
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ trait ActiveRelationTrait
|
|||||||
*/
|
*/
|
||||||
public $link;
|
public $link;
|
||||||
/**
|
/**
|
||||||
* @var array|object the query associated with the junction table. Please call [[via()]]
|
* @var array|object|null the query associated with the junction table. Please call [[via()]]
|
||||||
* to set this property instead of directly setting it.
|
* to set this property instead of directly setting it.
|
||||||
* This property is only used in relational context.
|
* This property is only used in relational context.
|
||||||
* @see via()
|
* @see via()
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ class ColumnSchema extends BaseObject
|
|||||||
*/
|
*/
|
||||||
public $scale;
|
public $scale;
|
||||||
/**
|
/**
|
||||||
* @var bool whether this column is a primary key
|
* @var bool|null whether this column is a primary key
|
||||||
*/
|
*/
|
||||||
public $isPrimaryKey;
|
public $isPrimaryKey;
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -319,6 +319,7 @@ class QueryBuilder extends \yii\base\BaseObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($this->expressionBuilders[$className] === __CLASS__) {
|
if ($this->expressionBuilders[$className] === __CLASS__) {
|
||||||
|
/** @phpstan-var $this&ExpressionBuilderInterface */
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -176,12 +176,15 @@ abstract class SqlTokenizer extends Component
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the longest common prefix equals to the SQL code of the same length at the current offset.
|
* Returns whether the longest common prefix equals to the SQL code of the same length at the current offset.
|
||||||
* @param string[] $with strings to be tested.
|
* @param array $with strings to be tested.
|
||||||
* The method **will** modify this parameter to speed up lookups.
|
* The method **will** modify this parameter to speed up lookups.
|
||||||
* @param bool $caseSensitive whether to perform a case sensitive comparison.
|
* @param bool $caseSensitive whether to perform a case sensitive comparison.
|
||||||
* @param int|null $length length of the matched string.
|
* @param int|null $length length of the matched string.
|
||||||
* @param string|null $content matched string.
|
* @param string|null $content matched string.
|
||||||
* @return bool whether a match is found.
|
* @return bool whether a match is found.
|
||||||
|
*
|
||||||
|
* @phpstan-param array<int, string>|array<int, array<string, mixed>> $with
|
||||||
|
* @psalm-param array<int, string>|array<int, array<string, mixed>> $with
|
||||||
*/
|
*/
|
||||||
protected function startsWithAnyLongest(array &$with, $caseSensitive, &$length = null, &$content = null)
|
protected function startsWithAnyLongest(array &$with, $caseSensitive, &$length = null, &$content = null)
|
||||||
{
|
{
|
||||||
@@ -194,6 +197,7 @@ abstract class SqlTokenizer extends Component
|
|||||||
return mb_strlen($string2, 'UTF-8') - mb_strlen($string1, 'UTF-8');
|
return mb_strlen($string2, 'UTF-8') - mb_strlen($string1, 'UTF-8');
|
||||||
});
|
});
|
||||||
$map = [];
|
$map = [];
|
||||||
|
/** @var string $string */
|
||||||
foreach ($with as $string) {
|
foreach ($with as $string) {
|
||||||
$map[mb_strlen($string, 'UTF-8')][$caseSensitive ? $string : mb_strtoupper($string, 'UTF-8')] = true;
|
$map[mb_strlen($string, 'UTF-8')][$caseSensitive ? $string : mb_strtoupper($string, 'UTF-8')] = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ class ArrayExpressionBuilder implements ExpressionBuilderInterface
|
|||||||
*
|
*
|
||||||
* @param ArrayExpression $expression
|
* @param ArrayExpression $expression
|
||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
* @return JsonExpression
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
protected function typecastValue(ArrayExpression $expression, $value)
|
protected function typecastValue(ArrayExpression $expression, $value)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user