Skip to content

Commit 1018656

Browse files
committed
fix: use static reference for model instantiation and update return type annotations
1 parent a48e86d commit 1018656

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/System/Database/MyModel/Model.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ public function hasOne($model, ?string $ref = null)
358358
} else {
359359
$table_name = $model;
360360
$join_ref = $ref ?? $this->primery_key;
361-
$model = new Model($this->pdo, []);
361+
$model = new static($this->pdo, []);
362362
}
363363
$result = MyQuery::from($this->table_name, $this->pdo)
364364
->select([$table_name . '.*'])
@@ -387,7 +387,7 @@ public function hasMany($model, ?string $ref = null)
387387
} else {
388388
$table_name = $model;
389389
$join_ref = $ref ?? $this->primery_key;
390-
$model = new Model($this->pdo, []);
390+
$model = new static($this->pdo, []);
391391
}
392392
$result = MyQuery::from($this->table_name, $this->pdo)
393393
->select([$table_name . '.*'])
@@ -573,7 +573,7 @@ public function offsetExists($offset): bool
573573
* @return mixed|null
574574
*/
575575
#[\ReturnTypeWillChange]
576-
public function offsetGet($offset)
576+
public function offsetGet($offset): mixed
577577
{
578578
return $this->getter($offset, null);
579579
}
@@ -679,7 +679,7 @@ public static function equal($column_name, $value, MyPDO $pdo): static
679679
/**
680680
* Fetch all records.
681681
*
682-
* @return ModelCollection<static<array-key, mixed>>
682+
* @return ModelCollection<array-key, static>
683683
*/
684684
public static function all(MyPDO $pdo): ModelCollection
685685
{

0 commit comments

Comments
 (0)