Add missing generics in yii\validators and yii\log namespaces (#20644)

This commit is contained in:
Maksim Spirkov
2025-10-28 14:58:17 +03:00
committed by GitHub
parent bfd3736653
commit 503828ef3a
3 changed files with 18 additions and 3 deletions

View File

@@ -116,13 +116,17 @@ class ExistValidator extends Validator
/**
* Validates existence of the current attribute based on relation name
* @param \yii\db\ActiveRecord $model the data model to be validated
* @param ActiveRecord $model the data model to be validated
* @param string $attribute the name of the attribute to be validated.
*/
private function checkTargetRelationExistence($model, $attribute)
{
$exists = false;
/** @var ActiveQuery $relationQuery */
/**
* @var ActiveQuery $relationQuery
* @phpstan-var ActiveQuery<ActiveRecord>
*/
$relationQuery = $model->{'get' . ucfirst($this->targetRelation)}();
if ($this->filter instanceof \Closure) {
@@ -316,6 +320,8 @@ class ExistValidator extends Validator
* @param array $conditions array of condition, keys to be modified
* @param string|null $alias set empty string for no apply alias. Set null for apply primary table alias
* @return array
*
* @phpstan-param ActiveQuery<ActiveRecord> $query
*/
private function applyTableAlias($query, $conditions, $alias = null)
{

View File

@@ -241,6 +241,8 @@ class UniqueValidator extends Validator
* @param array $conditions conditions, compatible with [[\yii\db\Query::where()|Query::where()]] key-value format
*
* @return ActiveQueryInterface|ActiveQuery
*
* @phpstan-return ActiveQueryInterface|ActiveQuery<ActiveRecord>
*/
private function prepareQuery($targetClass, $conditions)
{
@@ -319,6 +321,8 @@ class UniqueValidator extends Validator
* @param array $conditions array of condition, keys to be modified
* @param string|null $alias set empty string for no apply alias. Set null for apply primary table alias
* @return array
*
* @phpstan-param ActiveQuery<ActiveRecord> $query
*/
private function applyTableAlias($query, $conditions, $alias = null)
{