Compare commits

..

2 commits

Author SHA1 Message Date
71a9f12b02 fix: use func_num_args() to determine if $return should be used for Database\Model (#30)
It was not possible to set the return type explicitly as `null`, since that was the value we checked for if we should return the value of `$return` or not. We're not checking the total amount of arguments provided to check if a `$return` value was passed or not.

Reviewed-on: https://codeberg.org/vlw/scaffold/pulls/30
2026-02-22 14:41:41 +01:00
2d55d954a1 refactor: expose the Database property on Model as readonly public (#29)
Reviewed-on: https://codeberg.org/vlw/scaffold/pulls/29
2026-02-22 14:41:22 +01:00

View file

@ -15,7 +15,8 @@
abstract public int|string $id { get; } abstract public int|string $id { get; }
protected readonly Database $db; public readonly Database $db;
private bool $_resolved = false; private bool $_resolved = false;
private bool $_isset; private bool $_isset;
private ?array $_row; private ?array $_row;
@ -108,6 +109,6 @@
->where($this->where) ->where($this->where)
->update([$key => $value]); ->update([$key => $value]);
return $return ?? $value; return func_num_args() === 2 ? $value : $return;
} }
} }