refactor(entity): Don't type id

Some apps overwrite this and this breaks them.

Signed-off-by: Carl Schwan <carlschwan@kde.org>
pull/57442/head
Carl Schwan 2026-01-09 10:19:34 +07:00
parent 6fd76bfa0e
commit 81a21fb718
No known key found for this signature in database
GPG Key ID: 02325448204E452A
2 changed files with 4 additions and 2 deletions

@ -19,7 +19,8 @@ use function substr;
* @psalm-consistent-constructor
*/
abstract class Entity {
public int|string|null $id = null;
/** @var int $id */
public $id;
private array $_updatedFields = [];
/** @psalm-param $_fieldTypes array<string, Types::*> */
protected array $_fieldTypes = ['id' => 'integer'];

@ -35,6 +35,7 @@ abstract class SnowflakeAwareEntity extends Entity {
*/
public function generateId(): void {
if ($this->id === null) {
/** @psalm-suppress InvalidPropertyAssignmentValue */
$this->id = Server::get(ISnowflakeGenerator::class)->nextId();
$this->markFieldUpdated('id');
}
@ -50,7 +51,7 @@ abstract class SnowflakeAwareEntity extends Entity {
}
if ($this->snowflake === null) {
$this->snowflake = Server::get(ISnowflakeDecoder::class)->decode($this->id);
$this->snowflake = Server::get(ISnowflakeDecoder::class)->decode($this->getId());
}
return $this->snowflake;