Fix @var annotations (#20517)

This commit is contained in:
Maksim Spirkov
2025-09-08 15:07:30 +05:00
committed by GitHub
parent 53256fdd24
commit 61f1bd7af9
4 changed files with 10 additions and 6 deletions

View File

@ -266,7 +266,10 @@ class ActiveQuery extends Query implements ActiveQueryInterface
private function removeDuplicatedModels($models)
{
$hash = [];
/** @var ActiveRecord $class */
/**
* @var ActiveRecord
* @phpstan-var class-string<ActiveRecord>
*/
$class = $this->modelClass;
$pks = $class::primaryKey();

View File

@ -339,7 +339,6 @@ trait ActiveRelationTrait
return;
}
$model = reset($models);
/** @var ActiveQueryInterface|ActiveQuery $relation */
if ($model instanceof ActiveRecordInterface) {
$relation = $model->getRelation($name);
} else {
@ -348,6 +347,7 @@ trait ActiveRelationTrait
$relation = $modelClass::instance()->getRelation($name);
}
/** @var ActiveQueryInterface|ActiveQuery $relation */
if ($relation->multiple) {
$buckets = $this->buildBuckets($primaryModels, $relation->link, null, null, false);
if ($model instanceof ActiveRecordInterface) {

View File

@ -49,15 +49,13 @@ if (version_compare(PHP_VERSION, '4.3', '<')) {
* Note: this class definition does not match ordinary Yii style, because it should match PHP 4.3
* and should not use features from newer PHP versions!
*
* @property array|null $result the check results, this property is for internal usage only.
*
* @author Paul Klimov <klimov.paul@gmail.com>
* @since 2.0
*/
class YiiRequirementChecker
{
/**
* @var Check result
* @var array|null the check results, this property is for internal usage only.
*/
public $result;

View File

@ -626,7 +626,10 @@ class User extends Component
$data = json_decode($value, true);
if (is_array($data) && count($data) == 3) {
list($id, $authKey, $duration) = $data;
/** @var IdentityInterface $class */
/**
* @var IdentityInterface
* @phpstan-var class-string<IdentityInterface>
*/
$class = $this->identityClass;
$identity = $class::findIdentity($id);
if ($identity !== null) {