66 * @template TModel of object
77 * @template-extends Factory<TModel>
88 *
9- * @method static Proxy[]|object [] createMany(int $number, array|callable $attributes = [])
9+ * @method static Proxy[]|TModel [] createMany(int $number, array|callable $attributes = [])
1010 * @psalm-method static list<Proxy<TModel>> createMany(int $number, array|callable $attributes = [])
1111 *
1212 * @author Kevin Bond <kevinbond@gmail.com>
@@ -66,8 +66,7 @@ final public static function new($defaultAttributes = [], string ...$states): se
6666 /**
6767 * A shortcut to create a single model without states.
6868 *
69- * @return Proxy|object
70- *
69+ * @return Proxy<TModel>&TModel
7170 * @psalm-return Proxy<TModel>
7271 */
7372 final public static function createOne (array $ attributes = []): Proxy
@@ -79,8 +78,7 @@ final public static function createOne(array $attributes = []): Proxy
7978 * Try and find existing object for the given $attributes. If not found,
8079 * instantiate and persist.
8180 *
82- * @return Proxy|object
83- *
81+ * @return Proxy<TModel>&TModel
8482 * @psalm-return Proxy<TModel>
8583 */
8684 final public static function findOrCreate (array $ attributes ): Proxy
@@ -95,6 +93,9 @@ final public static function findOrCreate(array $attributes): Proxy
9593 /**
9694 * @see RepositoryProxy::first()
9795 *
96+ * @return Proxy<TModel>&TModel
97+ * @psalm-return Proxy<TModel>
98+ *
9899 * @throws \RuntimeException If no entities exist
99100 */
100101 final public static function first (string $ sortedField = 'id ' ): Proxy
@@ -109,6 +110,9 @@ final public static function first(string $sortedField = 'id'): Proxy
109110 /**
110111 * @see RepositoryProxy::last()
111112 *
113+ * @return Proxy<TModel>&TModel
114+ * @psalm-return Proxy<TModel>
115+ *
112116 * @throws \RuntimeException If no entities exist
113117 */
114118 final public static function last (string $ sortedField = 'id ' ): Proxy
@@ -122,6 +126,9 @@ final public static function last(string $sortedField = 'id'): Proxy
122126
123127 /**
124128 * @see RepositoryProxy::random()
129+ *
130+ * @return Proxy<TModel>&TModel
131+ * @psalm-return Proxy<TModel>
125132 */
126133 final public static function random (array $ attributes = []): Proxy
127134 {
@@ -131,8 +138,7 @@ final public static function random(array $attributes = []): Proxy
131138 /**
132139 * Fetch one random object and create a new object if none exists.
133140 *
134- * @return Proxy|object
135- *
141+ * @return Proxy<TModel>&TModel
136142 * @psalm-return Proxy<TModel>
137143 */
138144 final public static function randomOrCreate (array $ attributes = []): Proxy
@@ -146,6 +152,9 @@ final public static function randomOrCreate(array $attributes = []): Proxy
146152
147153 /**
148154 * @see RepositoryProxy::randomSet()
155+ *
156+ * @return list<TModel&Proxy<TModel>>
157+ * @psalm-return list<Proxy<TModel>>
149158 */
150159 final public static function randomSet (int $ number , array $ attributes = []): array
151160 {
@@ -154,6 +163,9 @@ final public static function randomSet(int $number, array $attributes = []): arr
154163
155164 /**
156165 * @see RepositoryProxy::randomRange()
166+ *
167+ * @return list<TModel&Proxy<TModel>>
168+ * @psalm-return list<Proxy<TModel>>
157169 */
158170 final public static function randomRange (int $ min , int $ max , array $ attributes = []): array
159171 {
@@ -178,6 +190,9 @@ final public static function truncate(): void
178190
179191 /**
180192 * @see RepositoryProxy::findAll()
193+ *
194+ * @return list<TModel&Proxy<TModel>>
195+ * @psalm-return list<Proxy<TModel>>
181196 */
182197 final public static function all (): array
183198 {
@@ -187,6 +202,9 @@ final public static function all(): array
187202 /**
188203 * @see RepositoryProxy::find()
189204 *
205+ * @return Proxy<TModel>&TModel
206+ * @psalm-return Proxy<TModel>
207+ *
190208 * @throws \RuntimeException If no entity found
191209 */
192210 final public static function find ($ criteria ): Proxy
@@ -200,6 +218,9 @@ final public static function find($criteria): Proxy
200218
201219 /**
202220 * @see RepositoryProxy::findBy()
221+ *
222+ * @return list<TModel&Proxy<TModel>>
223+ * @psalm-return list<Proxy<TModel>>
203224 */
204225 final public static function findBy (array $ attributes ): array
205226 {
0 commit comments