From 6ce2ce3cc3d6918bb487525e658182959879dc40 Mon Sep 17 00:00:00 2001 From: niqingyang Date: Tue, 2 Jan 2024 17:17:22 +0800 Subject: [PATCH] Update the comments of the method createQueryTo in ActiveRecordFactory so that the IDE can automatically identify the specific class of ActiveRecord --- src/ActiveQuery.php | 9 +++++++++ src/ActiveRecordFactory.php | 3 --- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/ActiveQuery.php b/src/ActiveQuery.php index 4cb8160d7..651ae80aa 100644 --- a/src/ActiveQuery.php +++ b/src/ActiveQuery.php @@ -107,6 +107,15 @@ class ActiveQuery extends Query implements ActiveQueryInterface private array $joinWith = []; private ActiveRecordInterface|null $arInstance = null; + /** + * @param string $arClass + * @param ConnectionInterface $db + * @param ActiveRecordFactory|null $arFactory + * @param string $tableName + * + * @psalm-template T of ActiveRecordInterface + * @psalm-param class-string $arClass + */ final public function __construct( protected string $arClass, protected ConnectionInterface $db, diff --git a/src/ActiveRecordFactory.php b/src/ActiveRecordFactory.php index bfb110982..09f67f957 100644 --- a/src/ActiveRecordFactory.php +++ b/src/ActiveRecordFactory.php @@ -31,11 +31,8 @@ public function __construct(private Factory $factory) * @throws NotInstantiableException * @return ActiveRecordInterface * - * @template T of ActiveRecordInterface - * @template-typeof T $arClass * @psalm-template T of ActiveRecordInterface * @psalm-param class-string $arClass - * @psalm-assert class-string $arClass * @psalm-return T */ public function createAR(